You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9d89215
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,11 @@
1
1
# Changelog
2
2
3
+
## 3.20.5
4
+
5
+
### Fixes
6
+
7
+
-**`Image.renderSVG()`** bounds the points paths are made of. An arc between far-apart ends gets a radius of half their distance and was drawn with as many curves as that radius took: a 139-byte path (`M 1e25 100 A 40 30 20 1 1 160 100`, stroked) ran the process out of memory. An arc now gets at most 64 curves a turn (from a radius of about 6e9, more than any output resolves), and the points of all paths (path data read, curves flattened, also of each copy drawn through `<use>`) count against 2^25 plus 4 per pixel of the output in one render, and 2^21 in one path (a text's glyphs excepted). More throw a `RangeError` ("SVG too complex").
thrownewRangeError(`SVG too complex: its paths are made of more points than a render of this size allows (${MAX_POINTS} and ${POINTS_PER_PIXEL} per output pixel)`);
3129
+
}
3130
+
3108
3131
functionparsePath(d: string): PathCommand[]{
3109
3132
constpath: PathCommand[]=[];
3110
3133
// numbers stay strings so compact arc flags can be split later
@@ -3116,6 +3139,8 @@ function parsePath(d: string): PathCommand[] {
3116
3139
end=m.index+m[0].length;
3117
3140
items.push(m[1] ? {command: m[1]} : m[2]);
3118
3141
}
3142
+
// (reading takes about the time of flattening 2 points a number or command)
3143
+
chargePoints(2*items.length);
3119
3144
3120
3145
leti=0;
3121
3146
letcommand: string|null=null;
@@ -3267,8 +3292,12 @@ function arcToCubics(path: PathCommand[], x1: number, y1: number, rx: number, ry
3267
3292
elseif(sweep&&delta<0)delta+=2*Math.PI;
3268
3293
3269
3294
// as many cubics as kurbo makes for usvg (at a tolerance of 0.1), which places mid markers at their ends
0 commit comments