Closed danset closed 4 months ago
Yep, my bad. I had to include the base image as well.
max_bbox
should not indeed affect rendering. But there are some issues with rendering elements outside the canvas/viewbox and moving them back to canvas. Aka filters/clips/masks + transform are not playing well in some cases.
So while max_bbox
fixes your issue, the fundamental issue is still present.
Rendering this svg with three images in it plus an extra one that's offscreen:
Resvg is clipping the images that have the blur filter applied to them along a line that shifts to the left as the offscreen image goes further offscreen to the left.
It looks like this clipping is being done intentionally here for performance reasons but the comment says it shouldn't affect the final result. Skipping that last line and just returning the
bbox
directly does cause it to render correctly: https://github.com/RazrFalcon/resvg/blob/11a842362284730f700f2ca9a5b9ef2a8d8bfecf/crates/resvg/src/render.rs#L74-L82I noticed the
max_bbox
being calculated here is adding more space to the left and top than the right and bottom so the rect with onscreen coordinates isn't centered within the fullmax_bbox
rect. Changing it to multiply the width/height by 1.5 instead of 2 to get the x/y values so the original box is centered within the max one also seems to fix the issue but I'm not sure what other effects that might have: https://github.com/RazrFalcon/resvg/blob/11a842362284730f700f2ca9a5b9ef2a8d8bfecf/crates/resvg/src/lib.rs#L40-L49