Skip to content

Preserve affine transforms when rendering feImage - #1165

Closed
Cees-Kettenis wants to merge 1 commit into
linebender:mainfrom
Cees-Kettenis:fix-feimage-affine-transform
Closed

Cees-Kettenis wants to merge 1 commit into
linebender:mainfrom
Cees-Kettenis:fix-feimage-affine-transform

Conversation

@Cees-Kettenis

Copy link
Copy Markdown
Contributor

feImage discards rotation, skew, and reflection from the filter transform, so referenced artwork is painted with the wrong geometry.

Apply the complete transform to the image at the primitive origin and clip skewed or rotated output to the transformed primitive rectangle, because extracting positive scale components loses both orientation and the correct clipping shape. The regression compares filtered artwork with an ordinary use at 1x and 2x scale and fails on main; two existing golden images are updated after Chrome comparisons, and the full workspace tests, formatting, copyright check, and no-default-feature checks pass.

Before and after rendering the same rotated feImage SVG

Download the SVG reproducer

@LaurenzV

Copy link
Copy Markdown
Collaborator

Pretty sure #1155 should fix this more generally, could you please check? If so, i think this PR can be closed in favor of #1155.

@Cees-Kettenis

Copy link
Copy Markdown
Contributor Author

Thanks, I tested #1155 against my reproducer and agree that it addresses the problem more generally.

For this particular SVG rendered at 2×, using Chrome as the reference, I measured:
My patch: 0.216% differing pixels.
#1155: 0.476% differing pixels.

Both restore the correct geometry, though my narrower patch produces fewer pixel differences in this example.

That doesn’t establish that it renders better overall.
I’d be happy to contribute the reproducer and investigate whether the remaining differences can be reduced within #1155’s approach.

@LaurenzV

Copy link
Copy Markdown
Collaborator

0.4% seems small enough, probably just some anti-aliasing? I've merged the other PR so will close this one, thanks though! And feel free to open another issue/PR if you notice anything else.

@LaurenzV LaurenzV closed this Oct 16, 2026
@Cees-Kettenis

Copy link
Copy Markdown
Contributor Author

0.4% seems small enough, probably just some anti-aliasing? I've merged the other PR so will close this one, thanks though! And feel free to open another issue/PR if you notice anything else.

I will check the newly merged code and see if i can improve it. I do have other PR open to fix other issues. Feel free to have a look. Happy to help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants