Repository navigation
faster SVG rendering - #63
Merged
Merged
Conversation
Layers remember the rectangle they painted. Compositing a layer (groups with opacity, clip paths, masks, nested viewports) and converting the canvas to RGBA only walk that rectangle instead of every pixel of the image: everything outside it is transparent and was skipped pixel by pixel before. The results are bit-identical: the 1822 SVGs of the resvg test suite checked against master at 300 and 1000 pixels wide. tests/svgs/features.svg at 1920 pixels wide renders 15-20% faster. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YJgRK5qpwJEbHPuFv6kgAQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Faster SVG rendering: layers remember the rectangle they painted. Compositing a layer (groups with opacity, clip paths, masks, nested viewports) and converting the canvas to RGBA only walk that rectangle, instead of checking every transparent pixel of the image one by one.
Identical results: the 1822 SVGs of the resvg test suite, rendered 300 and 1000 pixels wide, checked against master (3644 renders, 0 different).
Speed: rendering
tests/svgs/features.svg1920 pixels wide takes about 20% less time.