Use cr:save and cr:restore instead
This commit is contained in:
parent
4eff88679c
commit
7f7793378e
|
@ -67,7 +67,9 @@ function module.star(cr, width, height, n)
|
||||||
n = n or 5
|
n = n or 5
|
||||||
local a = 2 * math.pi / n
|
local a = 2 * math.pi / n
|
||||||
|
|
||||||
|
|
||||||
-- place the star at the center
|
-- place the star at the center
|
||||||
|
cr:save()
|
||||||
cr:translate(width/2, height/2)
|
cr:translate(width/2, height/2)
|
||||||
cr:rotate(-math.pi/2)
|
cr:rotate(-math.pi/2)
|
||||||
|
|
||||||
|
@ -77,8 +79,7 @@ function module.star(cr, width, height, n)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- restore the context
|
-- restore the context
|
||||||
cr:rotate(math.pi/2)
|
cr:restore()
|
||||||
cr:translate(-width/2, -height/2)
|
|
||||||
|
|
||||||
cr:close_path()
|
cr:close_path()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue