fix(gears: colors: recolor_image): always duplicate the surface (#3233)
This commit is contained in:
parent
54e9cb4e1d
commit
6ef3a8f059
|
@ -341,9 +341,7 @@ end
|
||||||
-- @return Recolored image.
|
-- @return Recolored image.
|
||||||
-- @staticfct gears.color.recolor_image
|
-- @staticfct gears.color.recolor_image
|
||||||
function color.recolor_image(image, new_color)
|
function color.recolor_image(image, new_color)
|
||||||
if type(image) == 'string' then
|
|
||||||
image = surface.duplicate_surface(image)
|
image = surface.duplicate_surface(image)
|
||||||
end
|
|
||||||
local cr = cairo.Context.create(image)
|
local cr = cairo.Context.create(image)
|
||||||
cr:set_source(color.create_pattern(new_color))
|
cr:set_source(color.create_pattern(new_color))
|
||||||
cr:mask(cairo.Pattern.create_for_surface(image), 0, 0)
|
cr:mask(cairo.Pattern.create_for_surface(image), 0, 0)
|
||||||
|
|
Loading…
Reference in New Issue