fix(gears: colors: recolor_image): always duplicate the surface (#3233)

This commit is contained in:
Yauhen Kirylau 2021-03-28 08:48:48 +02:00 committed by GitHub
parent 54e9cb4e1d
commit 6ef3a8f059
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -341,9 +341,7 @@ end
-- @return Recolored image.
-- @staticfct gears.color.recolor_image
function color.recolor_image(image, new_color)
if type(image) == 'string' then
image = surface.duplicate_surface(image)
end
image = surface.duplicate_surface(image)
local cr = cairo.Context.create(image)
cr:set_source(color.create_pattern(new_color))
cr:mask(cairo.Pattern.create_for_surface(image), 0, 0)