From 7f7793378e6c59456ec95a86139b07a399fa3fca Mon Sep 17 00:00:00 2001 From: hung Date: Sat, 28 Mar 2020 20:43:07 +0700 Subject: [PATCH] Use cr:save and cr:restore instead --- lib/gears/shape.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/gears/shape.lua b/lib/gears/shape.lua index 26d08c7f..eaea8202 100644 --- a/lib/gears/shape.lua +++ b/lib/gears/shape.lua @@ -67,7 +67,9 @@ function module.star(cr, width, height, n) n = n or 5 local a = 2 * math.pi / n + -- place the star at the center + cr:save() cr:translate(width/2, height/2) cr:rotate(-math.pi/2) @@ -77,8 +79,7 @@ function module.star(cr, width, height, n) end -- restore the context - cr:rotate(math.pi/2) - cr:translate(-width/2, -height/2) + cr:restore() cr:close_path() end