imagebox: apply shape before scale (#2793)

This commit is contained in:
worron 2019-06-13 02:39:01 +03:00 committed by Emmanuel Lepage Vallée
parent 9865f4592b
commit 99e81c097a
1 changed files with 5 additions and 5 deletions

View File

@ -21,6 +21,11 @@ function imagebox:draw(_, cr, width, height)
if not self._private.image then return end
if width == 0 or height == 0 then return end
-- Set the clip
if self._private.clip_shape then
cr:clip(self._private.clip_shape(cr, width, height, unpack(self._private.clip_args)))
end
if not self._private.resize_forbidden then
-- Let's scale the image so that it fits into (width, height)
local w = self._private.image:get_width()
@ -32,11 +37,6 @@ function imagebox:draw(_, cr, width, height)
cr:scale(aspect, aspect)
end
-- Set the clip
if self._private.clip_shape then
cr:clip(self._private.clip_shape(cr, width, height, unpack(self._private.clip_args)))
end
cr:set_source_surface(self._private.image, 0, 0)
cr:paint()
end