imagebox: apply shape before scale (#2793)
This commit is contained in:
parent
9865f4592b
commit
99e81c097a
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue