Repository navigation
Commit 475a41c
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 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_01YJgRK5qpwJEbHPuFv6kgAQ1 parent 6b80937 commit 475a41c
2 files changed
Lines changed: 42 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1010 | 1010 | | |
1011 | 1011 | | |
1012 | 1012 | | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
1013 | 1018 | | |
1014 | 1019 | | |
1015 | 1020 | | |
1016 | 1021 | | |
1017 | 1022 | | |
1018 | 1023 | | |
1019 | 1024 | | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
1020 | 1032 | | |
1021 | 1033 | | |
1022 | 1034 | | |
1023 | 1035 | | |
| 1036 | + | |
1024 | 1037 | | |
1025 | 1038 | | |
1026 | 1039 | | |
| |||
1064 | 1077 | | |
1065 | 1078 | | |
1066 | 1079 | | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
1067 | 1083 | | |
1068 | | - | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
1072 | | - | |
1073 | | - | |
1074 | | - | |
1075 | | - | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
1079 | 1097 | | |
1080 | 1098 | | |
1081 | 1099 | | |
1082 | 1100 | | |
1083 | 1101 | | |
1084 | 1102 | | |
1085 | 1103 | | |
1086 | | - | |
1087 | | - | |
1088 | | - | |
1089 | | - | |
1090 | | - | |
1091 | | - | |
1092 | | - | |
1093 | | - | |
1094 | | - | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
1095 | 1115 | | |
1096 | 1116 | | |
1097 | 1117 | | |
| |||
0 commit comments