Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imagebox resize svg fix #3881

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions lib/wibox/widget/imagebox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,16 @@ function imagebox:draw(ctx, cr, width, height)
cr:clip(self._private.clip_shape(cr, w*aspects.w, h*aspects.h, unpack(self._private.clip_args)))
end

cr:scale(aspects.w, aspects.h)
if self._private.handle then
self._private.handle:render_document(cr, Rsvg.Rectangle {
x = 0,
y = 0,
width = w * aspects.w,
height = h * aspects.h
})
else
cr:scale(aspects.w, aspects.h)
end
else
if self._private.halign == "center" then
translate.x = math.floor((width - w)/2)
Expand All @@ -253,11 +262,13 @@ function imagebox:draw(ctx, cr, width, height)
if self._private.clip_shape then
cr:clip(self._private.clip_shape(cr, w, h, unpack(self._private.clip_args)))
end

if self._private.handle then
self._private.handle:render_document(cr, Rsvg.Rectangle {x = 0, y = 0, width = w, height = h})
end
end

if self._private.handle then
self._private.handle:render_cairo(cr)
else
if not self._private.handle then
cr:set_source_surface(self._private.image, 0, 0)

local filter = self._private.scaling_quality
Expand Down
Loading