emf-converter 4.24.0 → 4.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/browser.js +1786 -616
- package/dist/browser.mjs +1786 -616
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1788 -618
- package/dist/index.mjs +1788 -618
- package/package.json +6 -3
package/dist/browser.mjs
CHANGED
|
@@ -11,7 +11,11 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
11
11
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
12
12
|
});
|
|
13
13
|
var __commonJS = (cb, mod3) => function __require2() {
|
|
14
|
-
|
|
14
|
+
try {
|
|
15
|
+
return mod3 || (0, cb[__getOwnPropNames(cb)[0]])((mod3 = { exports: {} }).exports, mod3), mod3.exports;
|
|
16
|
+
} catch (e) {
|
|
17
|
+
throw mod3 = 0, e;
|
|
18
|
+
}
|
|
15
19
|
};
|
|
16
20
|
var __copyProps = (to, from, except, desc) => {
|
|
17
21
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -2718,10 +2722,10 @@ var require_lib2 = __commonJS({
|
|
|
2718
2722
|
};
|
|
2719
2723
|
exports.decompressFrame = decompressFrame2;
|
|
2720
2724
|
var decompressFrames = function decompressFrames2(parsedGif, buildImagePatches) {
|
|
2721
|
-
return parsedGif.frames.filter(function(
|
|
2722
|
-
return
|
|
2723
|
-
}).map(function(
|
|
2724
|
-
return decompressFrame2(
|
|
2725
|
+
return parsedGif.frames.filter(function(f2) {
|
|
2726
|
+
return f2.image;
|
|
2727
|
+
}).map(function(f2) {
|
|
2728
|
+
return decompressFrame2(f2, parsedGif.gct, buildImagePatches);
|
|
2725
2729
|
});
|
|
2726
2730
|
};
|
|
2727
2731
|
exports.decompressFrames = decompressFrames;
|
|
@@ -2950,7 +2954,7 @@ var require_trees = __commonJS({
|
|
|
2950
2954
|
var n, m;
|
|
2951
2955
|
var bits;
|
|
2952
2956
|
var xbits;
|
|
2953
|
-
var
|
|
2957
|
+
var f2;
|
|
2954
2958
|
var overflow = 0;
|
|
2955
2959
|
for (bits = 0; bits <= MAX_BITS; bits++) {
|
|
2956
2960
|
s.bl_count[bits] = 0;
|
|
@@ -2972,10 +2976,10 @@ var require_trees = __commonJS({
|
|
|
2972
2976
|
if (n >= base) {
|
|
2973
2977
|
xbits = extra[n - base];
|
|
2974
2978
|
}
|
|
2975
|
-
|
|
2976
|
-
s.opt_len +=
|
|
2979
|
+
f2 = tree[n * 2];
|
|
2980
|
+
s.opt_len += f2 * (bits + xbits);
|
|
2977
2981
|
if (has_stree) {
|
|
2978
|
-
s.static_len +=
|
|
2982
|
+
s.static_len += f2 * (stree[n * 2 + 1] + xbits);
|
|
2979
2983
|
}
|
|
2980
2984
|
}
|
|
2981
2985
|
if (overflow === 0) {
|
|
@@ -3589,8 +3593,8 @@ var require_deflate = __commonJS({
|
|
|
3589
3593
|
strm.msg = msg[errorCode];
|
|
3590
3594
|
return errorCode;
|
|
3591
3595
|
}
|
|
3592
|
-
function rank(
|
|
3593
|
-
return (
|
|
3596
|
+
function rank(f2) {
|
|
3597
|
+
return (f2 << 1) - (f2 > 4 ? 9 : 0);
|
|
3594
3598
|
}
|
|
3595
3599
|
function zero(buf) {
|
|
3596
3600
|
var len = buf.length;
|
|
@@ -6979,22 +6983,22 @@ var require_UTIF = __commonJS({
|
|
|
6979
6983
|
this.B = -1;
|
|
6980
6984
|
}
|
|
6981
6985
|
function W(a, d) {
|
|
6982
|
-
for (var
|
|
6986
|
+
for (var f2 = 0, e = [], b, B, k = 16; 0 < k && !a[k - 1]; ) k--;
|
|
6983
6987
|
e.push({ children: [], index: 0 });
|
|
6984
6988
|
var l = e[0], r;
|
|
6985
6989
|
for (b = 0; b < k; b++) {
|
|
6986
6990
|
for (B = 0; B < a[b]; B++) {
|
|
6987
6991
|
l = e.pop();
|
|
6988
|
-
for (l.children[l.index] = d[
|
|
6992
|
+
for (l.children[l.index] = d[f2]; 0 < l.index; ) l = e.pop();
|
|
6989
6993
|
l.index++;
|
|
6990
6994
|
for (e.push(l); e.length <= b; ) e.push(r = { children: [], index: 0 }), l.children[l.index] = r.children, l = r;
|
|
6991
|
-
|
|
6995
|
+
f2++;
|
|
6992
6996
|
}
|
|
6993
6997
|
b + 1 < k && (e.push(r = { children: [], index: 0 }), l.children[l.index] = r.children, l = r);
|
|
6994
6998
|
}
|
|
6995
6999
|
return e[0].children;
|
|
6996
7000
|
}
|
|
6997
|
-
function X(a, d,
|
|
7001
|
+
function X(a, d, f2, e, b, B, k, l, r) {
|
|
6998
7002
|
function n() {
|
|
6999
7003
|
if (0 < x) return x--, z >> x & 1;
|
|
7000
7004
|
z = a[d++];
|
|
@@ -7004,7 +7008,7 @@ var require_UTIF = __commonJS({
|
|
|
7004
7008
|
if (220 === c2 && g2) {
|
|
7005
7009
|
d += 2;
|
|
7006
7010
|
var b2 = a[d++] << 8 | a[d++];
|
|
7007
|
-
if (0 < b2 && b2 !==
|
|
7011
|
+
if (0 < b2 && b2 !== f2.g) throw new P("Found DNL marker (0xFFDC) while parsing scan data", b2);
|
|
7008
7012
|
}
|
|
7009
7013
|
throw new D("unexpected marker " + (z << 8 | c2).toString(16));
|
|
7010
7014
|
}
|
|
@@ -7052,51 +7056,51 @@ var require_UTIF = __commonJS({
|
|
|
7052
7056
|
function m(a2, b2) {
|
|
7053
7057
|
if (0 < A) A--;
|
|
7054
7058
|
else for (var d2 = B; d2 <= k; ) {
|
|
7055
|
-
var e2 = q(a2.o),
|
|
7059
|
+
var e2 = q(a2.o), f3 = e2 & 15;
|
|
7056
7060
|
e2 >>= 4;
|
|
7057
|
-
if (0 ===
|
|
7061
|
+
if (0 === f3) {
|
|
7058
7062
|
if (15 > e2) {
|
|
7059
7063
|
A = h(e2) + (1 << e2) - 1;
|
|
7060
7064
|
break;
|
|
7061
7065
|
}
|
|
7062
7066
|
d2 += 16;
|
|
7063
|
-
} else d2 += e2, a2.a[b2 + J[d2]] = c(
|
|
7067
|
+
} else d2 += e2, a2.a[b2 + J[d2]] = c(f3) * (1 << r), d2++;
|
|
7064
7068
|
}
|
|
7065
7069
|
}
|
|
7066
7070
|
function t(a2, d2) {
|
|
7067
|
-
for (var b2 = B, e2 = 0,
|
|
7068
|
-
|
|
7069
|
-
var l2 = 0 > a2.a[
|
|
7071
|
+
for (var b2 = B, e2 = 0, f3; b2 <= k; ) {
|
|
7072
|
+
f3 = d2 + J[b2];
|
|
7073
|
+
var l2 = 0 > a2.a[f3] ? -1 : 1;
|
|
7070
7074
|
switch (E) {
|
|
7071
7075
|
case 0:
|
|
7072
7076
|
e2 = q(a2.o);
|
|
7073
|
-
|
|
7077
|
+
f3 = e2 & 15;
|
|
7074
7078
|
e2 >>= 4;
|
|
7075
|
-
if (0 ===
|
|
7079
|
+
if (0 === f3) 15 > e2 ? (A = h(e2) + (1 << e2), E = 4) : (e2 = 16, E = 1);
|
|
7076
7080
|
else {
|
|
7077
|
-
if (1 !==
|
|
7078
|
-
Q = c(
|
|
7081
|
+
if (1 !== f3) throw new D("invalid ACn encoding");
|
|
7082
|
+
Q = c(f3);
|
|
7079
7083
|
E = e2 ? 2 : 3;
|
|
7080
7084
|
}
|
|
7081
7085
|
continue;
|
|
7082
7086
|
case 1:
|
|
7083
7087
|
case 2:
|
|
7084
|
-
a2.a[
|
|
7088
|
+
a2.a[f3] ? a2.a[f3] += l2 * (n() << r) : (e2--, 0 === e2 && (E = 2 === E ? 3 : 0));
|
|
7085
7089
|
break;
|
|
7086
7090
|
case 3:
|
|
7087
|
-
a2.a[
|
|
7091
|
+
a2.a[f3] ? a2.a[f3] += l2 * (n() << r) : (a2.a[f3] = Q << r, E = 0);
|
|
7088
7092
|
break;
|
|
7089
7093
|
case 4:
|
|
7090
|
-
a2.a[
|
|
7094
|
+
a2.a[f3] && (a2.a[f3] += l2 * (n() << r));
|
|
7091
7095
|
}
|
|
7092
7096
|
b2++;
|
|
7093
7097
|
}
|
|
7094
7098
|
4 === E && (A--, 0 === A && (E = 0));
|
|
7095
7099
|
}
|
|
7096
|
-
var g2 = 9 < arguments.length && void 0 !== arguments[9] ? arguments[9] : false, u =
|
|
7097
|
-
var R =
|
|
7100
|
+
var g2 = 9 < arguments.length && void 0 !== arguments[9] ? arguments[9] : false, u = f2.P, v = d, z = 0, x = 0, A = 0, E = 0, Q, K = e.length, F, L, M, I;
|
|
7101
|
+
var R = f2.S ? 0 === B ? 0 === l ? w : p : 0 === l ? m : t : C;
|
|
7098
7102
|
var G = 0;
|
|
7099
|
-
var O = 1 === K ? e[0].c * e[0].l : u *
|
|
7103
|
+
var O = 1 === K ? e[0].c * e[0].l : u * f2.O;
|
|
7100
7104
|
for (var S, T; G < O; ) {
|
|
7101
7105
|
var U = b ? Math.min(O - G, b) : O;
|
|
7102
7106
|
for (F = 0; F < K; F++) e[F].m = 0;
|
|
@@ -7119,7 +7123,7 @@ var require_UTIF = __commonJS({
|
|
|
7119
7123
|
return d - v;
|
|
7120
7124
|
}
|
|
7121
7125
|
function Y(a, d) {
|
|
7122
|
-
for (var
|
|
7126
|
+
for (var f2 = d.c, e = d.l, b = new Int16Array(64), B = 0; B < e; B++) for (var k = 0; k < f2; k++) {
|
|
7123
7127
|
var l = 64 * ((d.c + 1) * B + k), r = b, n = d.G, q = d.a;
|
|
7124
7128
|
if (!n) throw new D("missing required Quantization Table.");
|
|
7125
7129
|
for (var h = 0; 64 > h; h += 8) {
|
|
@@ -7183,16 +7187,16 @@ var require_UTIF = __commonJS({
|
|
|
7183
7187
|
return d.a;
|
|
7184
7188
|
}
|
|
7185
7189
|
function N2(a, d) {
|
|
7186
|
-
var
|
|
7187
|
-
|
|
7190
|
+
var f2 = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : d, e = a.length - 1;
|
|
7191
|
+
f2 = f2 < d ? f2 : d;
|
|
7188
7192
|
if (d >= e) return null;
|
|
7189
7193
|
var b = a[d] << 8 | a[d + 1];
|
|
7190
7194
|
if (65472 <= b && 65534 >= b) return { f: null, F: b, offset: d };
|
|
7191
|
-
for (var B = a[
|
|
7192
|
-
if (++
|
|
7193
|
-
B = a[
|
|
7195
|
+
for (var B = a[f2] << 8 | a[f2 + 1]; !(65472 <= B && 65534 >= B); ) {
|
|
7196
|
+
if (++f2 >= e) return null;
|
|
7197
|
+
B = a[f2] << 8 | a[f2 + 1];
|
|
7194
7198
|
}
|
|
7195
|
-
return { f: b.toString(16), F: B, offset:
|
|
7199
|
+
return { f: b.toString(16), F: B, offset: f2 };
|
|
7196
7200
|
}
|
|
7197
7201
|
var J = new Uint8Array([
|
|
7198
7202
|
0,
|
|
@@ -7266,7 +7270,7 @@ var require_UTIF = __commonJS({
|
|
|
7266
7270
|
k += 2;
|
|
7267
7271
|
return d2;
|
|
7268
7272
|
}
|
|
7269
|
-
function
|
|
7273
|
+
function f2() {
|
|
7270
7274
|
var b2 = d();
|
|
7271
7275
|
b2 = k + b2 - 2;
|
|
7272
7276
|
var c2 = N2(a, b2, k);
|
|
@@ -7278,10 +7282,10 @@ var require_UTIF = __commonJS({
|
|
|
7278
7282
|
function e(a2) {
|
|
7279
7283
|
for (var b2 = Math.ceil(a2.v / 8 / a2.s), c2 = Math.ceil(a2.g / 8 / a2.u), d2 = 0; d2 < a2.b.length; d2++) {
|
|
7280
7284
|
v = a2.b[d2];
|
|
7281
|
-
var e2 = Math.ceil(Math.ceil(a2.v / 8) * v.h / a2.s),
|
|
7285
|
+
var e2 = Math.ceil(Math.ceil(a2.v / 8) * v.h / a2.s), f3 = Math.ceil(Math.ceil(a2.g / 8) * v.j / a2.u);
|
|
7282
7286
|
v.a = new Int16Array(64 * c2 * v.j * (b2 * v.h + 1));
|
|
7283
7287
|
v.c = e2;
|
|
7284
|
-
v.l =
|
|
7288
|
+
v.l = f3;
|
|
7285
7289
|
}
|
|
7286
7290
|
a2.P = b2;
|
|
7287
7291
|
a2.O = c2;
|
|
@@ -7309,7 +7313,7 @@ var require_UTIF = __commonJS({
|
|
|
7309
7313
|
case 65518:
|
|
7310
7314
|
case 65519:
|
|
7311
7315
|
case 65534:
|
|
7312
|
-
var c =
|
|
7316
|
+
var c = f2();
|
|
7313
7317
|
65518 === h && 65 === c[0] && 100 === c[1] && 111 === c[2] && 98 === c[3] && 101 === c[4] && (l = { version: c[5] << 8 | c[6], Y: c[7] << 8 | c[8], Z: c[9] << 8 | c[10], W: c[11] });
|
|
7314
7318
|
break;
|
|
7315
7319
|
case 65499:
|
|
@@ -7415,10 +7419,10 @@ var require_UTIF = __commonJS({
|
|
|
7415
7419
|
}
|
|
7416
7420
|
this.i = this.b.length;
|
|
7417
7421
|
}, L: function(a, d) {
|
|
7418
|
-
var
|
|
7422
|
+
var f2 = this.width / a, e = this.height / d, b, g2, k = this.b.length, l = a * d * k, r = new Uint8ClampedArray(l), n = new Uint32Array(a);
|
|
7419
7423
|
for (g2 = 0; g2 < k; g2++) {
|
|
7420
7424
|
var q = this.b[g2];
|
|
7421
|
-
var h = q.U *
|
|
7425
|
+
var h = q.U * f2;
|
|
7422
7426
|
var c = q.V * e;
|
|
7423
7427
|
var C = g2;
|
|
7424
7428
|
var w = q.R;
|
|
@@ -7426,32 +7430,32 @@ var require_UTIF = __commonJS({
|
|
|
7426
7430
|
for (b = 0; b < a; b++) q = 0 | b * h, n[b] = (q & 4294967288) << 3 | q & 7;
|
|
7427
7431
|
for (h = 0; h < d; h++) for (q = 0 | h * c, q = p * (q & 4294967288) | (q & 7) << 3, b = 0; b < a; b++) r[C] = w[q + n[b]], C += k;
|
|
7428
7432
|
}
|
|
7429
|
-
if (e = this.M) for (g2 = 0; g2 < l; ) for (
|
|
7433
|
+
if (e = this.M) for (g2 = 0; g2 < l; ) for (f2 = q = 0; q < k; q++, g2++, f2 += 2) r[g2] = (r[g2] * e[f2] >> 8) + e[f2 + 1];
|
|
7430
7434
|
return r;
|
|
7431
7435
|
}, w: function() {
|
|
7432
7436
|
return this.A ? !!this.A.W : 3 === this.i ? 0 === this.B ? false : true : 1 === this.B ? true : false;
|
|
7433
7437
|
}, I: function(a) {
|
|
7434
|
-
for (var d,
|
|
7438
|
+
for (var d, f2, e, b = 0, g2 = a.length; b < g2; b += 3) d = a[b], f2 = a[b + 1], e = a[b + 2], a[b] = d - 179.456 + 1.402 * e, a[b + 1] = d + 135.459 - 0.344 * f2 - 0.714 * e, a[b + 2] = d - 226.816 + 1.772 * f2;
|
|
7435
7439
|
return a;
|
|
7436
7440
|
}, K: function(a) {
|
|
7437
|
-
for (var d,
|
|
7441
|
+
for (var d, f2, e, b, g2 = 0, k = 0, l = a.length; k < l; k += 4) d = a[k], f2 = a[k + 1], e = a[k + 2], b = a[k + 3], a[g2++] = -122.67195406894 + f2 * (-660635669420364e-19 * f2 + 437130475926232e-18 * e - 54080610064599e-18 * d + 48449797120281e-17 * b - 0.154362151871126) + e * (-957964378445773e-18 * e + 817076911346625e-18 * d - 0.00477271405408747 * b + 1.53380253221734) + d * (961250184130688e-18 * d - 0.00266257332283933 * b + 0.48357088451265) + b * (-336197177618394e-18 * b + 0.484791561490776), a[g2++] = 107.268039397724 + f2 * (219927104525741e-19 * f2 - 640992018297945e-18 * e + 659397001245577e-18 * d + 426105652938837e-18 * b - 0.176491792462875) + e * (-778269941513683e-18 * e + 0.00130872261408275 * d + 770482631801132e-18 * b - 0.151051492775562) + d * (0.00126935368114843 * d - 0.00265090189010898 * b + 0.25802910206845) + b * (-318913117588328e-18 * b - 0.213742400323665), a[g2++] = -20.810012546947 + f2 * (-570115196973677e-18 * f2 - 263409051004589e-19 * e + 0.0020741088115012 * d - 0.00288260236853442 * b + 0.814272968359295) + e * (-153496057440975e-19 * e - 132689043961446e-18 * d + 560833691242812e-18 * b - 0.195152027534049) + d * (0.00174418132927582 * d - 0.00255243321439347 * b + 0.116935020465145) + b * (-343531996510555e-18 * b + 0.24165260232407);
|
|
7438
7442
|
return a.subarray(
|
|
7439
7443
|
0,
|
|
7440
7444
|
g2
|
|
7441
7445
|
);
|
|
7442
7446
|
}, J: function(a) {
|
|
7443
|
-
for (var d,
|
|
7447
|
+
for (var d, f2, e, b = 0, g2 = a.length; b < g2; b += 4) d = a[b], f2 = a[b + 1], e = a[b + 2], a[b] = 434.456 - d - 1.402 * e, a[b + 1] = 119.541 - d + 0.344 * f2 + 0.714 * e, a[b + 2] = 481.816 - d - 1.772 * f2;
|
|
7444
7448
|
return a;
|
|
7445
7449
|
}, H: function(a) {
|
|
7446
|
-
for (var d,
|
|
7450
|
+
for (var d, f2, e, b, g2 = 0, k = 1 / 255, l = 0, r = a.length; l < r; l += 4) d = a[l] * k, f2 = a[l + 1] * k, e = a[l + 2] * k, b = a[l + 3] * k, a[g2++] = 255 + d * (-4.387332384609988 * d + 54.48615194189176 * f2 + 18.82290502165302 * e + 212.25662451639585 * b - 285.2331026137004) + f2 * (1.7149763477362134 * f2 - 5.6096736904047315 * e - 17.873870861415444 * b - 5.497006427196366) + e * (-2.5217340131683033 * e - 21.248923337353073 * b + 17.5119270841813) - b * (21.86122147463605 * b + 189.48180835922747), a[g2++] = 255 + d * (8.841041422036149 * d + 60.118027045597366 * f2 + 6.871425592049007 * e + 31.159100130055922 * b - 79.2970844816548) + f2 * (-15.310361306967817 * f2 + 17.575251261109482 * e + 131.35250912493976 * b - 190.9453302588951) + e * (4.444339102852739 * e + 9.8632861493405 * b - 24.86741582555878) - b * (20.737325471181034 * b + 187.80453709719578), a[g2++] = 255 + d * (0.8842522430003296 * d + 8.078677503112928 * f2 + 30.89978309703729 * e - 0.23883238689178934 * b - 14.183576799673286) + f2 * (10.49593273432072 * f2 + 63.02378494754052 * e + 50.606957656360734 * b - 112.23884253719248) + e * (0.03296041114873217 * e + 115.60384449646641 * b - 193.58209356861505) - b * (22.33816807309886 * b + 180.12613974708367);
|
|
7447
7451
|
return a.subarray(0, g2);
|
|
7448
|
-
}, getData: function(a, d,
|
|
7452
|
+
}, getData: function(a, d, f2) {
|
|
7449
7453
|
if (4 < this.i) throw new D("Unsupported color mode");
|
|
7450
7454
|
a = this.L(a, d);
|
|
7451
|
-
if (1 === this.i &&
|
|
7452
|
-
|
|
7453
|
-
d = new Uint8ClampedArray(3 *
|
|
7454
|
-
for (var e = 0, b = 0; b <
|
|
7455
|
+
if (1 === this.i && f2) {
|
|
7456
|
+
f2 = a.length;
|
|
7457
|
+
d = new Uint8ClampedArray(3 * f2);
|
|
7458
|
+
for (var e = 0, b = 0; b < f2; b++) {
|
|
7455
7459
|
var g2 = a[b];
|
|
7456
7460
|
d[e++] = g2;
|
|
7457
7461
|
d[e++] = g2;
|
|
@@ -7461,8 +7465,8 @@ var require_UTIF = __commonJS({
|
|
|
7461
7465
|
}
|
|
7462
7466
|
if (3 === this.i && this.w()) return this.I(a);
|
|
7463
7467
|
if (4 === this.i) {
|
|
7464
|
-
if (this.w()) return
|
|
7465
|
-
if (
|
|
7468
|
+
if (this.w()) return f2 ? this.K(a) : this.J(a);
|
|
7469
|
+
if (f2) return this.H(a);
|
|
7466
7470
|
}
|
|
7467
7471
|
return a;
|
|
7468
7472
|
} };
|
|
@@ -9648,10 +9652,10 @@ function escapementSinCos(tenthsOfDegree) {
|
|
|
9648
9652
|
const tenths = (tenthsOfDegree % 3600 + 3600) % 3600;
|
|
9649
9653
|
const x = tenths * ESCAPEMENT_TABLE_STEPS / 3600;
|
|
9650
9654
|
const k = Math.floor(x);
|
|
9651
|
-
const
|
|
9655
|
+
const f2 = x - k;
|
|
9652
9656
|
const a = k * 2 * Math.PI / ESCAPEMENT_TABLE_STEPS;
|
|
9653
9657
|
const b = (k + 1) * 2 * Math.PI / ESCAPEMENT_TABLE_STEPS;
|
|
9654
|
-
return
|
|
9658
|
+
return f2 === 0 ? { sin: Math.sin(a), cos: Math.cos(a) } : { sin: (1 - f2) * Math.sin(a) + f2 * Math.sin(b), cos: (1 - f2) * Math.cos(a) + f2 * Math.cos(b) };
|
|
9655
9659
|
}
|
|
9656
9660
|
var ESCAPEMENT_TABLE_STEPS = 128;
|
|
9657
9661
|
function escapementToCanvasRadians(tenthsOfDegree) {
|
|
@@ -10437,6 +10441,197 @@ function nodeTable() {
|
|
|
10437
10441
|
}
|
|
10438
10442
|
return table = values;
|
|
10439
10443
|
}
|
|
10444
|
+
var NODE_DELTA_8BIT = [
|
|
10445
|
+
192,
|
|
10446
|
+
1,
|
|
10447
|
+
91,
|
|
10448
|
+
2,
|
|
10449
|
+
53,
|
|
10450
|
+
1,
|
|
10451
|
+
1440,
|
|
10452
|
+
2,
|
|
10453
|
+
144,
|
|
10454
|
+
1,
|
|
10455
|
+
960,
|
|
10456
|
+
1,
|
|
10457
|
+
5706,
|
|
10458
|
+
-2,
|
|
10459
|
+
1776,
|
|
10460
|
+
2,
|
|
10461
|
+
768,
|
|
10462
|
+
1,
|
|
10463
|
+
1348,
|
|
10464
|
+
-1,
|
|
10465
|
+
48,
|
|
10466
|
+
-1,
|
|
10467
|
+
5,
|
|
10468
|
+
-1,
|
|
10469
|
+
237,
|
|
10470
|
+
1,
|
|
10471
|
+
3930,
|
|
10472
|
+
1,
|
|
10473
|
+
819,
|
|
10474
|
+
-1,
|
|
10475
|
+
2586,
|
|
10476
|
+
-1,
|
|
10477
|
+
3,
|
|
10478
|
+
1,
|
|
10479
|
+
768,
|
|
10480
|
+
2,
|
|
10481
|
+
48,
|
|
10482
|
+
-1,
|
|
10483
|
+
192,
|
|
10484
|
+
-1,
|
|
10485
|
+
6838,
|
|
10486
|
+
-1,
|
|
10487
|
+
765,
|
|
10488
|
+
-1,
|
|
10489
|
+
3,
|
|
10490
|
+
1,
|
|
10491
|
+
1850,
|
|
10492
|
+
1,
|
|
10493
|
+
1872,
|
|
10494
|
+
-1,
|
|
10495
|
+
1773,
|
|
10496
|
+
-1,
|
|
10497
|
+
3,
|
|
10498
|
+
1,
|
|
10499
|
+
720,
|
|
10500
|
+
3,
|
|
10501
|
+
51,
|
|
10502
|
+
-1,
|
|
10503
|
+
3744,
|
|
10504
|
+
-1,
|
|
10505
|
+
337,
|
|
10506
|
+
-1,
|
|
10507
|
+
719,
|
|
10508
|
+
-1,
|
|
10509
|
+
48,
|
|
10510
|
+
-1,
|
|
10511
|
+
48,
|
|
10512
|
+
-1,
|
|
10513
|
+
2973,
|
|
10514
|
+
-1,
|
|
10515
|
+
4035,
|
|
10516
|
+
1,
|
|
10517
|
+
336,
|
|
10518
|
+
-1,
|
|
10519
|
+
3792,
|
|
10520
|
+
1,
|
|
10521
|
+
337,
|
|
10522
|
+
-1,
|
|
10523
|
+
7971,
|
|
10524
|
+
1,
|
|
10525
|
+
48,
|
|
10526
|
+
-1,
|
|
10527
|
+
569,
|
|
10528
|
+
1,
|
|
10529
|
+
3,
|
|
10530
|
+
-1,
|
|
10531
|
+
48,
|
|
10532
|
+
-1,
|
|
10533
|
+
199,
|
|
10534
|
+
1,
|
|
10535
|
+
10649,
|
|
10536
|
+
-1,
|
|
10537
|
+
9822,
|
|
10538
|
+
1,
|
|
10539
|
+
3,
|
|
10540
|
+
-1,
|
|
10541
|
+
2463,
|
|
10542
|
+
1,
|
|
10543
|
+
816,
|
|
10544
|
+
-1,
|
|
10545
|
+
15121,
|
|
10546
|
+
-5,
|
|
10547
|
+
12128,
|
|
10548
|
+
1,
|
|
10549
|
+
48,
|
|
10550
|
+
-1,
|
|
10551
|
+
64,
|
|
10552
|
+
-1,
|
|
10553
|
+
196,
|
|
10554
|
+
-1,
|
|
10555
|
+
3499,
|
|
10556
|
+
-1,
|
|
10557
|
+
768,
|
|
10558
|
+
1,
|
|
10559
|
+
7825,
|
|
10560
|
+
-1,
|
|
10561
|
+
45,
|
|
10562
|
+
1,
|
|
10563
|
+
3,
|
|
10564
|
+
-1,
|
|
10565
|
+
24062,
|
|
10566
|
+
1,
|
|
10567
|
+
12192,
|
|
10568
|
+
-1,
|
|
10569
|
+
3,
|
|
10570
|
+
-1,
|
|
10571
|
+
93,
|
|
10572
|
+
-1,
|
|
10573
|
+
342,
|
|
10574
|
+
1,
|
|
10575
|
+
3,
|
|
10576
|
+
-1,
|
|
10577
|
+
768,
|
|
10578
|
+
1,
|
|
10579
|
+
1467,
|
|
10580
|
+
1,
|
|
10581
|
+
5614,
|
|
10582
|
+
-1,
|
|
10583
|
+
922,
|
|
10584
|
+
-3,
|
|
10585
|
+
48,
|
|
10586
|
+
1,
|
|
10587
|
+
4618,
|
|
10588
|
+
-1,
|
|
10589
|
+
45,
|
|
10590
|
+
-1,
|
|
10591
|
+
393,
|
|
10592
|
+
-1,
|
|
10593
|
+
516,
|
|
10594
|
+
1,
|
|
10595
|
+
138,
|
|
10596
|
+
1,
|
|
10597
|
+
114,
|
|
10598
|
+
1,
|
|
10599
|
+
225,
|
|
10600
|
+
2,
|
|
10601
|
+
429,
|
|
10602
|
+
2,
|
|
10603
|
+
5608,
|
|
10604
|
+
1,
|
|
10605
|
+
5069,
|
|
10606
|
+
-1,
|
|
10607
|
+
48,
|
|
10608
|
+
1,
|
|
10609
|
+
381,
|
|
10610
|
+
-1,
|
|
10611
|
+
3,
|
|
10612
|
+
1,
|
|
10613
|
+
45,
|
|
10614
|
+
-1,
|
|
10615
|
+
852,
|
|
10616
|
+
-1,
|
|
10617
|
+
48,
|
|
10618
|
+
-1,
|
|
10619
|
+
3,
|
|
10620
|
+
-1,
|
|
10621
|
+
231,
|
|
10622
|
+
-1
|
|
10623
|
+
];
|
|
10624
|
+
var table8 = null;
|
|
10625
|
+
function nodeTable8() {
|
|
10626
|
+
if (table8) return table8;
|
|
10627
|
+
const nodes = nodeTable();
|
|
10628
|
+
table8 = nodes.map((v) => Math.min(65535, Math.max(0, v + 1)));
|
|
10629
|
+
for (let i = 0, at = 0; i < NODE_DELTA_8BIT.length; i += 2) {
|
|
10630
|
+
at += NODE_DELTA_8BIT[i];
|
|
10631
|
+
table8[at] += NODE_DELTA_8BIT[i + 1];
|
|
10632
|
+
}
|
|
10633
|
+
return table8;
|
|
10634
|
+
}
|
|
10440
10635
|
var fraction = new Int32Array(4);
|
|
10441
10636
|
var order = new Int32Array(4);
|
|
10442
10637
|
var positionsIn = new Int32Array(4);
|
|
@@ -10475,7 +10670,7 @@ function interpolate(nodes, sums) {
|
|
|
10475
10670
|
}
|
|
10476
10671
|
var clamp8 = (v) => v < 0 ? 0 : v > 255 ? 255 : v;
|
|
10477
10672
|
function cmykPlanesToRgba(planes, width, height, ycck) {
|
|
10478
|
-
const nodes =
|
|
10673
|
+
const nodes = nodeTable8();
|
|
10479
10674
|
const out = new Uint8Array(width * height * 4);
|
|
10480
10675
|
const fix = (x) => Math.floor(x * 65536 + 0.5);
|
|
10481
10676
|
const half = 1 << 15;
|
|
@@ -10505,9 +10700,9 @@ function cmykPlanesToRgba(planes, width, height, ycck) {
|
|
|
10505
10700
|
positionsIn[2] = cmykInputPositions[y];
|
|
10506
10701
|
positionsIn[3] = cmykInputPositions[255 - planes[3][p]];
|
|
10507
10702
|
interpolate(nodes, sums);
|
|
10508
|
-
out[p * 4] =
|
|
10509
|
-
out[p * 4 + 1] =
|
|
10510
|
-
out[p * 4 + 2] =
|
|
10703
|
+
out[p * 4] = sums[0] >> 20;
|
|
10704
|
+
out[p * 4 + 1] = sums[1] >> 20;
|
|
10705
|
+
out[p * 4 + 2] = sums[2] >> 20;
|
|
10511
10706
|
out[p * 4 + 3] = 255;
|
|
10512
10707
|
}
|
|
10513
10708
|
return out;
|
|
@@ -15562,8 +15757,8 @@ function decodeVp8(data) {
|
|
|
15562
15757
|
}
|
|
15563
15758
|
var mulHi = (v, coeff) => v * coeff >> 8;
|
|
15564
15759
|
var clip6 = (v) => (v & -16384) === 0 ? v >> 6 : v < 0 ? 0 : 255;
|
|
15565
|
-
function vp8ToRgba(
|
|
15566
|
-
const { width: w, height: h } =
|
|
15760
|
+
function vp8ToRgba(f2, alpha) {
|
|
15761
|
+
const { width: w, height: h } = f2;
|
|
15567
15762
|
const out = new Uint8ClampedArray(w * h * 4);
|
|
15568
15763
|
const uvW = w + 1 >> 1;
|
|
15569
15764
|
const cu = new Uint8Array(w), cv = new Uint8Array(w);
|
|
@@ -15571,9 +15766,9 @@ function vp8ToRgba(f, alpha) {
|
|
|
15571
15766
|
const near = y >> 1;
|
|
15572
15767
|
let far = y & 1 ? near + 1 : near - 1;
|
|
15573
15768
|
if (far < 0 || far >= h + 1 >> 1) far = near;
|
|
15574
|
-
const nU = near *
|
|
15769
|
+
const nU = near * f2.uvStride, fU = far * f2.uvStride;
|
|
15575
15770
|
for (let c = 0; c < 2; c++) {
|
|
15576
|
-
const plane = c === 0 ?
|
|
15771
|
+
const plane = c === 0 ? f2.u : f2.v, dst = c === 0 ? cu : cv;
|
|
15577
15772
|
dst[0] = 3 * plane[nU] + plane[fU] + 2 >> 2;
|
|
15578
15773
|
for (let k = 1; k <= w - 1 >> 1; k++) {
|
|
15579
15774
|
const tl = plane[nU + k - 1], t = plane[nU + k], l = plane[fU + k - 1], u = plane[fU + k];
|
|
@@ -15585,7 +15780,7 @@ function vp8ToRgba(f, alpha) {
|
|
|
15585
15780
|
if (!(w & 1)) dst[w - 1] = 3 * plane[nU + uvW - 1] + plane[fU + uvW - 1] + 2 >> 2;
|
|
15586
15781
|
}
|
|
15587
15782
|
for (let x = 0; x < w; x++) {
|
|
15588
|
-
const Y = mulHi(
|
|
15783
|
+
const Y = mulHi(f2.y[y * f2.yStride + x], 19077), U = cu[x], V = cv[x];
|
|
15589
15784
|
const o = (y * w + x) * 4;
|
|
15590
15785
|
out[o] = clip6(Y + mulHi(V, 26149) - 14234);
|
|
15591
15786
|
out[o + 1] = clip6(Y - mulHi(U, 6419) - mulHi(V, 13320) + 8708);
|
|
@@ -15794,10 +15989,10 @@ function buildHuffman3(lengths, n) {
|
|
|
15794
15989
|
function readSymbol(br, h) {
|
|
15795
15990
|
if (h.single >= 0) return h.single;
|
|
15796
15991
|
const bits = br.peek();
|
|
15797
|
-
const
|
|
15798
|
-
if (
|
|
15799
|
-
br.skip(
|
|
15800
|
-
return
|
|
15992
|
+
const f2 = h.fast[bits & (1 << FAST_BITS) - 1];
|
|
15993
|
+
if (f2 !== 0) {
|
|
15994
|
+
br.skip(f2 >>> 16);
|
|
15995
|
+
return f2 & 65535;
|
|
15801
15996
|
}
|
|
15802
15997
|
let code = 0, first = 0, index = 0;
|
|
15803
15998
|
for (let len = 1; len <= MAX_CODE_LENGTH; len++) {
|
|
@@ -16228,9 +16423,9 @@ function decodeImageCodecFallback(bytes) {
|
|
|
16228
16423
|
const width = v.getUint16(6, true), height = v.getUint16(8, true);
|
|
16229
16424
|
if (!validSize(width, height)) return null;
|
|
16230
16425
|
const gif = (0, import_gifuct_js.parseGIF)(bytes.slice().buffer);
|
|
16231
|
-
const
|
|
16232
|
-
if (!
|
|
16233
|
-
const frame2 = (0, import_gifuct_js.decompressFrame)(
|
|
16426
|
+
const f2 = gif.frames.find((f3) => "image" in f3);
|
|
16427
|
+
if (!f2 || !validSize(f2.image.descriptor.width, f2.image.descriptor.height)) return null;
|
|
16428
|
+
const frame2 = (0, import_gifuct_js.decompressFrame)(f2, gif.gct, true);
|
|
16234
16429
|
const data = new Uint8ClampedArray(width * height * 4);
|
|
16235
16430
|
const transparent = frame2.transparentIndex !== void 0;
|
|
16236
16431
|
const background = transparent ? frame2.colorTable[frame2.transparentIndex] : gif.gct?.[gif.lsd.backgroundColorIndex];
|
|
@@ -16861,10 +17056,10 @@ function polygonTrig(angle) {
|
|
|
16861
17056
|
}
|
|
16862
17057
|
const x = Math.fround(b / TRIG_STEP);
|
|
16863
17058
|
const i = Math.min(127, Math.floor(x));
|
|
16864
|
-
const
|
|
17059
|
+
const f2 = x - i;
|
|
16865
17060
|
return [
|
|
16866
|
-
POLYGON_NODES.cos[i] * (1 -
|
|
16867
|
-
POLYGON_NODES.sin[i] * (1 -
|
|
17061
|
+
POLYGON_NODES.cos[i] * (1 - f2) + POLYGON_NODES.cos[i + 1] * f2,
|
|
17062
|
+
POLYGON_NODES.sin[i] * (1 - f2) + POLYGON_NODES.sin[i + 1] * f2
|
|
16868
17063
|
];
|
|
16869
17064
|
}
|
|
16870
17065
|
var ATAN_KNOTS = Array.from({ length: 33 }, (_, j) => Math.atan(j / 32));
|
|
@@ -16890,21 +17085,21 @@ function unitPiece(from, to, small, radius = Infinity) {
|
|
|
16890
17085
|
const p0 = trig(from);
|
|
16891
17086
|
const p3 = trig(to);
|
|
16892
17087
|
if (small && 6e-8 * radius / Math.abs(Math.sin(to - from)) > 0.5) {
|
|
16893
|
-
const
|
|
16894
|
-
const q0 = [
|
|
16895
|
-
const q3 = [
|
|
16896
|
-
const det32 =
|
|
17088
|
+
const f2 = Math.fround;
|
|
17089
|
+
const q0 = [f2(p0[0]), f2(p0[1])];
|
|
17090
|
+
const q3 = [f2(p3[0]), f2(p3[1])];
|
|
17091
|
+
const det32 = f2(f2(q0[0] * q3[1]) - f2(q0[1] * q3[0]));
|
|
16897
17092
|
if (det32 !== 0) {
|
|
16898
|
-
const X = [
|
|
16899
|
-
const c =
|
|
16900
|
-
const kappa =
|
|
17093
|
+
const X = [f2(f2(q3[1] - q0[1]) / det32), f2(f2(q0[0] - q3[0]) / det32)];
|
|
17094
|
+
const c = f2(polygonTrig(Math.abs(to - from) / 2)[0]);
|
|
17095
|
+
const kappa = f2(f2(f2(4 / 3) * c) / f2(1 + c));
|
|
16901
17096
|
return {
|
|
16902
17097
|
start: p0,
|
|
16903
17098
|
ctrl: [
|
|
16904
|
-
|
|
16905
|
-
|
|
16906
|
-
|
|
16907
|
-
|
|
17099
|
+
f2(q0[0] + f2(kappa * f2(X[0] - q0[0]))),
|
|
17100
|
+
f2(q0[1] + f2(kappa * f2(X[1] - q0[1]))),
|
|
17101
|
+
f2(q3[0] + f2(kappa * f2(X[0] - q3[0]))),
|
|
17102
|
+
f2(q3[1] + f2(kappa * f2(X[1] - q3[1]))),
|
|
16908
17103
|
p3[0],
|
|
16909
17104
|
p3[1]
|
|
16910
17105
|
]
|
|
@@ -17036,8 +17231,8 @@ var GdiRasterPath = class {
|
|
|
17036
17231
|
* `GetPath`, Wine `gdi32/tests/path.c`, `test_all_functions`).
|
|
17037
17232
|
*/
|
|
17038
17233
|
continueAt(x, y) {
|
|
17039
|
-
const
|
|
17040
|
-
if (
|
|
17234
|
+
const f2 = this.current;
|
|
17235
|
+
if (f2 && f2.pts[f2.pts.length - 2] === x && f2.pts[f2.pts.length - 1] === y) {
|
|
17041
17236
|
return;
|
|
17042
17237
|
}
|
|
17043
17238
|
this.moveTo(x, y);
|
|
@@ -17073,17 +17268,17 @@ var GdiRasterPath = class {
|
|
|
17073
17268
|
}
|
|
17074
17269
|
/** Flattens one Bezier onto the open figure, recording its end tangents. */
|
|
17075
17270
|
flattenInto(x0, y0, c1x, c1y, c2x, c2y, x3, y3) {
|
|
17076
|
-
const
|
|
17077
|
-
const first =
|
|
17078
|
-
flattenBezier(x0, y0, c1x, c1y, c2x, c2y, x3, y3,
|
|
17079
|
-
const last =
|
|
17271
|
+
const f2 = this.current;
|
|
17272
|
+
const first = f2.pts.length / 2 - 1;
|
|
17273
|
+
flattenBezier(x0, y0, c1x, c1y, c2x, c2y, x3, y3, f2.pts);
|
|
17274
|
+
const last = f2.pts.length / 2 - 2;
|
|
17080
17275
|
if (last <= first) {
|
|
17081
17276
|
if (last === first) {
|
|
17082
|
-
const n =
|
|
17083
|
-
|
|
17084
|
-
|
|
17085
|
-
|
|
17086
|
-
|
|
17277
|
+
const n = f2.pts.length;
|
|
17278
|
+
f2.tangents ?? (f2.tangents = /* @__PURE__ */ new Map());
|
|
17279
|
+
f2.tangentRoles ?? (f2.tangentRoles = /* @__PURE__ */ new Map());
|
|
17280
|
+
f2.tangents.set(first, [f2.pts[n - 2] - f2.pts[n - 4], f2.pts[n - 1] - f2.pts[n - 3]]);
|
|
17281
|
+
f2.tangentRoles.set(first, 3);
|
|
17087
17282
|
}
|
|
17088
17283
|
return;
|
|
17089
17284
|
}
|
|
@@ -17095,19 +17290,19 @@ var GdiRasterPath = class {
|
|
|
17095
17290
|
};
|
|
17096
17291
|
const t0 = tangent(x0, y0, c1x, c1y, c2x, c2y, x3, y3);
|
|
17097
17292
|
const t1 = tangent(c2x, c2y, x3, y3, x3, y3, x3, y3) ?? tangent(c1x, c1y, x3, y3, x3, y3, x3, y3) ?? tangent(x0, y0, x3, y3, x3, y3, x3, y3);
|
|
17098
|
-
|
|
17293
|
+
f2.curveSegs ?? (f2.curveSegs = /* @__PURE__ */ new Set());
|
|
17099
17294
|
for (let k = first; k <= last; k++) {
|
|
17100
|
-
|
|
17295
|
+
f2.curveSegs.add(k);
|
|
17101
17296
|
}
|
|
17102
|
-
|
|
17103
|
-
|
|
17297
|
+
f2.tangents ?? (f2.tangents = /* @__PURE__ */ new Map());
|
|
17298
|
+
f2.tangentRoles ?? (f2.tangentRoles = /* @__PURE__ */ new Map());
|
|
17104
17299
|
if (t0) {
|
|
17105
|
-
|
|
17106
|
-
|
|
17300
|
+
f2.tangents.set(first, t0);
|
|
17301
|
+
f2.tangentRoles.set(first, 1);
|
|
17107
17302
|
}
|
|
17108
17303
|
if (t1) {
|
|
17109
|
-
|
|
17110
|
-
|
|
17304
|
+
f2.tangents.set(last, t1);
|
|
17305
|
+
f2.tangentRoles.set(last, 2);
|
|
17111
17306
|
}
|
|
17112
17307
|
}
|
|
17113
17308
|
/**
|
|
@@ -17138,8 +17333,8 @@ var GdiRasterPath = class {
|
|
|
17138
17333
|
}
|
|
17139
17334
|
/** Appends every figure of `other`. */
|
|
17140
17335
|
append(other) {
|
|
17141
|
-
for (const
|
|
17142
|
-
this.figures.push({ pts:
|
|
17336
|
+
for (const f2 of other.figures) {
|
|
17337
|
+
this.figures.push({ pts: f2.pts.slice(), closed: f2.closed, tangents: f2.tangents && new Map(f2.tangents), tangentRoles: f2.tangentRoles && new Map(f2.tangentRoles), curveSegs: f2.curveSegs && new Set(f2.curveSegs), roundWiden: f2.roundWiden });
|
|
17143
17338
|
}
|
|
17144
17339
|
for (let i = 0; i < other.getPath.types.length; i++) {
|
|
17145
17340
|
this.log(other.getPath.pts[2 * i], other.getPath.pts[2 * i + 1], other.getPath.types[i]);
|
|
@@ -17147,16 +17342,16 @@ var GdiRasterPath = class {
|
|
|
17147
17342
|
this.current = null;
|
|
17148
17343
|
}
|
|
17149
17344
|
lastPoint() {
|
|
17150
|
-
const
|
|
17151
|
-
if (!
|
|
17345
|
+
const f2 = this.figures[this.figures.length - 1];
|
|
17346
|
+
if (!f2) {
|
|
17152
17347
|
return null;
|
|
17153
17348
|
}
|
|
17154
|
-
return
|
|
17349
|
+
return f2.closed ? [f2.pts[0], f2.pts[1]] : [f2.pts[f2.pts.length - 2], f2.pts[f2.pts.length - 1]];
|
|
17155
17350
|
}
|
|
17156
17351
|
};
|
|
17157
17352
|
function fillPathSpans(path, winding, out) {
|
|
17158
17353
|
return fillPolygonSpans(
|
|
17159
|
-
path.figures.map((
|
|
17354
|
+
path.figures.map((f2) => f2.pts),
|
|
17160
17355
|
winding,
|
|
17161
17356
|
out
|
|
17162
17357
|
);
|
|
@@ -17226,15 +17421,15 @@ function strokeCosmetic(path, on, off, pattern, style = { pos: 0 }, resetPerFigu
|
|
|
17226
17421
|
p -= pattern[i];
|
|
17227
17422
|
}
|
|
17228
17423
|
};
|
|
17229
|
-
path.figures.forEach((
|
|
17424
|
+
path.figures.forEach((f2, fi) => {
|
|
17230
17425
|
if (fi > 0 && resetPerFigure) {
|
|
17231
17426
|
style.pos = 0;
|
|
17232
17427
|
}
|
|
17233
|
-
const p =
|
|
17428
|
+
const p = f2.pts;
|
|
17234
17429
|
for (let i = 0; i + 3 < p.length; i += 2) {
|
|
17235
17430
|
cosmeticLine(p[i], p[i + 1], p[i + 2], p[i + 3], plot);
|
|
17236
17431
|
}
|
|
17237
|
-
if (
|
|
17432
|
+
if (f2.closed && p.length >= 4) {
|
|
17238
17433
|
const n = p.length;
|
|
17239
17434
|
if (p[n - 2] !== p[0] || p[n - 1] !== p[1]) {
|
|
17240
17435
|
cosmeticLine(p[n - 2], p[n - 1], p[0], p[1], plot);
|
|
@@ -17581,7 +17776,7 @@ function accumulateLine(acc, mark, stride, rows, width, x0, y0, x1, y1) {
|
|
|
17581
17776
|
if (top >= bottom) {
|
|
17582
17777
|
return;
|
|
17583
17778
|
}
|
|
17584
|
-
const
|
|
17779
|
+
const add3 = (row2, cell, v) => {
|
|
17585
17780
|
const i = row2 * stride + cell;
|
|
17586
17781
|
acc[i] += v;
|
|
17587
17782
|
if (!mark[i]) {
|
|
@@ -17607,27 +17802,27 @@ function accumulateLine(acc, mark, stride, rows, width, x0, y0, x1, y1) {
|
|
|
17607
17802
|
const hiCeil = Math.ceil(hi);
|
|
17608
17803
|
if (hiCeil <= loFloor + 1) {
|
|
17609
17804
|
const xmf = 0.5 * (x + xnext) - loFloor;
|
|
17610
|
-
|
|
17611
|
-
|
|
17805
|
+
add3(row2, loFloor, d - d * xmf);
|
|
17806
|
+
add3(row2, loFloor + 1, d * xmf);
|
|
17612
17807
|
} else {
|
|
17613
17808
|
const s = 1 / (hi - lo);
|
|
17614
17809
|
const x0f = lo - loFloor;
|
|
17615
17810
|
const a0 = 0.5 * s * (1 - x0f) * (1 - x0f);
|
|
17616
17811
|
const x1f = hi - hiCeil + 1;
|
|
17617
17812
|
const am = 0.5 * s * x1f * x1f;
|
|
17618
|
-
|
|
17813
|
+
add3(row2, loFloor, d * a0);
|
|
17619
17814
|
if (hiCeil === loFloor + 2) {
|
|
17620
|
-
|
|
17815
|
+
add3(row2, loFloor + 1, d * (1 - a0 - am));
|
|
17621
17816
|
} else {
|
|
17622
17817
|
const a1 = s * (1.5 - x0f);
|
|
17623
|
-
|
|
17818
|
+
add3(row2, loFloor + 1, d * (a1 - a0));
|
|
17624
17819
|
for (let xi = loFloor + 2; xi < hiCeil - 1; xi++) {
|
|
17625
|
-
|
|
17820
|
+
add3(row2, xi, d * s);
|
|
17626
17821
|
}
|
|
17627
17822
|
const a2 = a1 + (hiCeil - loFloor - 3) * s;
|
|
17628
|
-
|
|
17823
|
+
add3(row2, hiCeil - 1, d * (1 - a2 - am));
|
|
17629
17824
|
}
|
|
17630
|
-
|
|
17825
|
+
add3(row2, hiCeil, d * am);
|
|
17631
17826
|
}
|
|
17632
17827
|
x = xnext;
|
|
17633
17828
|
}
|
|
@@ -17935,11 +18130,11 @@ function gradientColor(stops, t, out) {
|
|
|
17935
18130
|
const a = stops[lo];
|
|
17936
18131
|
const b = stops[hi];
|
|
17937
18132
|
const span = b.offset - a.offset;
|
|
17938
|
-
const
|
|
17939
|
-
const alpha = a.color[3] + (b.color[3] - a.color[3]) *
|
|
17940
|
-
out[0] = (a.color[0] + (b.color[0] - a.color[0]) *
|
|
17941
|
-
out[1] = (a.color[1] + (b.color[1] - a.color[1]) *
|
|
17942
|
-
out[2] = (a.color[2] + (b.color[2] - a.color[2]) *
|
|
18133
|
+
const f2 = span > 0 ? (t - a.offset) / span : 1;
|
|
18134
|
+
const alpha = a.color[3] + (b.color[3] - a.color[3]) * f2;
|
|
18135
|
+
out[0] = (a.color[0] + (b.color[0] - a.color[0]) * f2) * alpha;
|
|
18136
|
+
out[1] = (a.color[1] + (b.color[1] - a.color[1]) * f2) * alpha;
|
|
18137
|
+
out[2] = (a.color[2] + (b.color[2] - a.color[2]) * f2) * alpha;
|
|
17943
18138
|
out[3] = alpha * 255;
|
|
17944
18139
|
return;
|
|
17945
18140
|
}
|
|
@@ -18866,13 +19061,13 @@ function unpremultiplyTable() {
|
|
|
18866
19061
|
if (unpremultiplied) {
|
|
18867
19062
|
return unpremultiplied;
|
|
18868
19063
|
}
|
|
18869
|
-
const
|
|
18870
|
-
const inv255 =
|
|
19064
|
+
const f2 = Math.fround;
|
|
19065
|
+
const inv255 = f2(1 / 255);
|
|
18871
19066
|
const table2 = new Uint8Array(256 * 256);
|
|
18872
19067
|
for (let a = 1; a < 256; a++) {
|
|
18873
|
-
const recip =
|
|
19068
|
+
const recip = f2(1 / f2(a * inv255));
|
|
18874
19069
|
for (let p = 0; p < 256; p++) {
|
|
18875
|
-
const x =
|
|
19070
|
+
const x = f2(f2(f2(p * inv255) * recip) * 255);
|
|
18876
19071
|
const clamped = Math.min(Math.max(x, 0), 255);
|
|
18877
19072
|
const lo = Math.floor(clamped);
|
|
18878
19073
|
const frac = clamped - lo;
|
|
@@ -19223,11 +19418,11 @@ var SoftwareRasterContext = class {
|
|
|
19223
19418
|
}
|
|
19224
19419
|
}
|
|
19225
19420
|
getTransform() {
|
|
19226
|
-
const [a, b, c, d, e,
|
|
19227
|
-
return { a, b, c, d, e, f };
|
|
19421
|
+
const [a, b, c, d, e, f2] = this.state.transform;
|
|
19422
|
+
return { a, b, c, d, e, f: f2 };
|
|
19228
19423
|
}
|
|
19229
|
-
setTransform(a, b, c, d, e,
|
|
19230
|
-
const m = typeof a === "object" ? [a.a ?? 1, a.b ?? 0, a.c ?? 0, a.d ?? 1, a.e ?? 0, a.f ?? 0] : [a, b, c, d, e,
|
|
19424
|
+
setTransform(a, b, c, d, e, f2) {
|
|
19425
|
+
const m = typeof a === "object" ? [a.a ?? 1, a.b ?? 0, a.c ?? 0, a.d ?? 1, a.e ?? 0, a.f ?? 0] : [a, b, c, d, e, f2];
|
|
19231
19426
|
if (m.every(Number.isFinite)) {
|
|
19232
19427
|
this.state.transform = m;
|
|
19233
19428
|
}
|
|
@@ -19235,9 +19430,9 @@ var SoftwareRasterContext = class {
|
|
|
19235
19430
|
resetTransform() {
|
|
19236
19431
|
this.state.transform = [...IDENTITY_MATRIX];
|
|
19237
19432
|
}
|
|
19238
|
-
transform(a, b, c, d, e,
|
|
19239
|
-
if ([a, b, c, d, e,
|
|
19240
|
-
this.state.transform = multiplyMatrix(this.state.transform, [a, b, c, d, e,
|
|
19433
|
+
transform(a, b, c, d, e, f2) {
|
|
19434
|
+
if ([a, b, c, d, e, f2].every(Number.isFinite)) {
|
|
19435
|
+
this.state.transform = multiplyMatrix(this.state.transform, [a, b, c, d, e, f2]);
|
|
19241
19436
|
}
|
|
19242
19437
|
}
|
|
19243
19438
|
translate(x, y) {
|
|
@@ -20656,15 +20851,15 @@ var FanTriangle = class {
|
|
|
20656
20851
|
let b = bL;
|
|
20657
20852
|
const cutLeft = sub(start, xl);
|
|
20658
20853
|
if (Math.abs(cutLeft) > ALPHA_EPSILON) {
|
|
20659
|
-
const
|
|
20660
|
-
a = add(mul(sub(aR, aL),
|
|
20661
|
-
b = add(mul(sub(bR, bL),
|
|
20854
|
+
const f2 = div(cutLeft, n);
|
|
20855
|
+
a = add(mul(sub(aR, aL), f2), aL);
|
|
20856
|
+
b = add(mul(sub(bR, bL), f2), bL);
|
|
20662
20857
|
}
|
|
20663
20858
|
const cutRight = sub(xr, end);
|
|
20664
20859
|
if (Math.abs(cutRight) > ALPHA_EPSILON) {
|
|
20665
|
-
const
|
|
20666
|
-
aR = sub(aR, mul(sub(aR, aL),
|
|
20667
|
-
bR = sub(bR, mul(sub(bR, bL),
|
|
20860
|
+
const f2 = div(cutRight, n);
|
|
20861
|
+
aR = sub(aR, mul(sub(aR, aL), f2));
|
|
20862
|
+
bR = sub(bR, mul(sub(bR, bL), f2));
|
|
20668
20863
|
}
|
|
20669
20864
|
const count = end - start;
|
|
20670
20865
|
const da = div(sub(aR, a), count);
|
|
@@ -20683,9 +20878,9 @@ var FanTriangle = class {
|
|
|
20683
20878
|
const centre = adjust(sub(sub(1, a), b));
|
|
20684
20879
|
const sum = add(b, a);
|
|
20685
20880
|
if (sum !== 0) {
|
|
20686
|
-
const
|
|
20687
|
-
wa = mul(a,
|
|
20688
|
-
wb = mul(b,
|
|
20881
|
+
const f2 = div(sub(1, centre), sum);
|
|
20882
|
+
wa = mul(a, f2);
|
|
20883
|
+
wb = mul(b, f2);
|
|
20689
20884
|
}
|
|
20690
20885
|
}
|
|
20691
20886
|
for (let q = 0; q < 4; q++) {
|
|
@@ -20889,7 +21084,7 @@ var BilinearQuad = class {
|
|
|
20889
21084
|
}
|
|
20890
21085
|
/** The pixel spans `[start, end)` of scanline `y` inside `[x0, x1)` (`GetXSpans`). */
|
|
20891
21086
|
spans(y, x0, x1) {
|
|
20892
|
-
if (this.constant < 0 && this.flags.every((
|
|
21087
|
+
if (this.constant < 0 && this.flags.every((f2) => f2 === 0)) return [];
|
|
20893
21088
|
const yf = y;
|
|
20894
21089
|
if (ja(this.minY, yf)) return [];
|
|
20895
21090
|
if (jae(yf, add(this.minY, this.height))) return [];
|
|
@@ -21204,8 +21399,8 @@ function piecewise(xs, ys, x) {
|
|
|
21204
21399
|
for (let i = 1; i < n; i++) {
|
|
21205
21400
|
if (x <= xs[i]) {
|
|
21206
21401
|
const span = xs[i] - xs[i - 1];
|
|
21207
|
-
const
|
|
21208
|
-
return ys[i - 1] + (ys[i] - ys[i - 1]) *
|
|
21402
|
+
const f2 = span > 0 ? (x - xs[i - 1]) / span : 1;
|
|
21403
|
+
return ys[i - 1] + (ys[i] - ys[i - 1]) * f2;
|
|
21209
21404
|
}
|
|
21210
21405
|
}
|
|
21211
21406
|
return ys[n - 1];
|
|
@@ -21219,12 +21414,12 @@ function premultiplied(argb, gamma) {
|
|
|
21219
21414
|
};
|
|
21220
21415
|
return [ch(16), ch(8), ch(0), a];
|
|
21221
21416
|
}
|
|
21222
|
-
function mix(c0, c1,
|
|
21417
|
+
function mix(c0, c1, f2) {
|
|
21223
21418
|
return [
|
|
21224
|
-
c0[0] + (c1[0] - c0[0]) *
|
|
21225
|
-
c0[1] + (c1[1] - c0[1]) *
|
|
21226
|
-
c0[2] + (c1[2] - c0[2]) *
|
|
21227
|
-
c0[3] + (c1[3] - c0[3]) *
|
|
21419
|
+
c0[0] + (c1[0] - c0[0]) * f2,
|
|
21420
|
+
c0[1] + (c1[1] - c0[1]) * f2,
|
|
21421
|
+
c0[2] + (c1[2] - c0[2]) * f2,
|
|
21422
|
+
c0[3] + (c1[3] - c0[3]) * f2
|
|
21228
21423
|
];
|
|
21229
21424
|
}
|
|
21230
21425
|
var f32Buffer = new Float32Array(1);
|
|
@@ -21255,9 +21450,9 @@ function blendFactor(positions, factors, t) {
|
|
|
21255
21450
|
}
|
|
21256
21451
|
return factors[n - 1];
|
|
21257
21452
|
}
|
|
21258
|
-
function mixBlend(c0, c1,
|
|
21259
|
-
const g = truncF32(1 -
|
|
21260
|
-
const ch = (a, b) => truncF32(truncF32(a * g) + truncF32(b *
|
|
21453
|
+
function mixBlend(c0, c1, f2) {
|
|
21454
|
+
const g = truncF32(1 - f2);
|
|
21455
|
+
const ch = (a, b) => truncF32(truncF32(a * g) + truncF32(b * f2));
|
|
21261
21456
|
return [ch(c0[0], c1[0]), ch(c0[1], c1[1]), ch(c0[2], c1[2]), ch(c0[3], c1[3])];
|
|
21262
21457
|
}
|
|
21263
21458
|
function rampColorAt(ramp, t) {
|
|
@@ -21271,8 +21466,8 @@ function rampColorAt(ramp, t) {
|
|
|
21271
21466
|
for (let i = 1; i < n; i++) {
|
|
21272
21467
|
if (t <= positions[i]) {
|
|
21273
21468
|
const span = positions[i] - positions[i - 1];
|
|
21274
|
-
const
|
|
21275
|
-
return mix(premultiplied(argb[i - 1], gamma), premultiplied(argb[i], gamma),
|
|
21469
|
+
const f2 = span > 0 ? (t - positions[i - 1]) / span : 1;
|
|
21470
|
+
return mix(premultiplied(argb[i - 1], gamma), premultiplied(argb[i], gamma), f2);
|
|
21276
21471
|
}
|
|
21277
21472
|
}
|
|
21278
21473
|
return premultiplied(argb[n - 1], gamma);
|
|
@@ -21349,18 +21544,18 @@ function unpremultiply(p, a) {
|
|
|
21349
21544
|
function writeRampColor(table2, u, out, o, truncate = false) {
|
|
21350
21545
|
const n = table2.intervals;
|
|
21351
21546
|
const k = Math.floor(u / FIX_ONE);
|
|
21352
|
-
const
|
|
21547
|
+
const f2 = Math.floor(u / 256) & 255;
|
|
21353
21548
|
const j0 = k <= n ? k : 2 * n - k;
|
|
21354
21549
|
const j1 = k + 1 <= n ? k + 1 : Math.max(0, 2 * n - k - 1);
|
|
21355
21550
|
const kn = table2.knots;
|
|
21356
21551
|
const i0 = Math.min(n, j0) * 4;
|
|
21357
21552
|
const i1 = Math.min(n, j1) * 4;
|
|
21358
|
-
const a = kn[i0 + 3] * (256 -
|
|
21553
|
+
const a = kn[i0 + 3] * (256 - f2) + kn[i1 + 3] * f2 + 128 >> 8;
|
|
21359
21554
|
if (a === 0) {
|
|
21360
21555
|
return;
|
|
21361
21556
|
}
|
|
21362
21557
|
for (let ch = 0; ch < 3; ch++) {
|
|
21363
|
-
const p = kn[i0 + ch] * (256 -
|
|
21558
|
+
const p = kn[i0 + ch] * (256 - f2) + kn[i1 + ch] * f2 + 128 >> 8;
|
|
21364
21559
|
out[o + ch] = a === 255 ? p : truncate ? unpremultiply(p, a) : Math.round(p * 255 / a);
|
|
21365
21560
|
}
|
|
21366
21561
|
out[o + 3] = a;
|
|
@@ -21368,14 +21563,14 @@ function writeRampColor(table2, u, out, o, truncate = false) {
|
|
|
21368
21563
|
function writeRampPremultiplied(table2, u, out, o) {
|
|
21369
21564
|
const n = table2.intervals;
|
|
21370
21565
|
const k = Math.floor(u / FIX_ONE);
|
|
21371
|
-
const
|
|
21566
|
+
const f2 = Math.floor(u / 256) & 255;
|
|
21372
21567
|
const j0 = k <= n ? k : 2 * n - k;
|
|
21373
21568
|
const j1 = k + 1 <= n ? k + 1 : Math.max(0, 2 * n - k - 1);
|
|
21374
21569
|
const kn = table2.knots;
|
|
21375
21570
|
const i0 = Math.min(n, j0) * 4;
|
|
21376
21571
|
const i1 = Math.min(n, j1) * 4;
|
|
21377
21572
|
for (let ch = 0; ch < 4; ch++) {
|
|
21378
|
-
out[o + ch] = kn[i0 + ch] * (256 -
|
|
21573
|
+
out[o + ch] = kn[i0 + ch] * (256 - f2) + kn[i1 + ch] * f2 + 128 >> 8;
|
|
21379
21574
|
}
|
|
21380
21575
|
}
|
|
21381
21576
|
function mulF32(a, b) {
|
|
@@ -21534,8 +21729,8 @@ function piecewise2(xs, ys, x) {
|
|
|
21534
21729
|
for (let i = 1; i < n; i++) {
|
|
21535
21730
|
if (x <= xs[i]) {
|
|
21536
21731
|
const span = xs[i] - xs[i - 1];
|
|
21537
|
-
const
|
|
21538
|
-
return ys[i - 1] + (ys[i] - ys[i - 1]) *
|
|
21732
|
+
const f2 = span > 0 ? (x - xs[i - 1]) / span : 1;
|
|
21733
|
+
return ys[i - 1] + (ys[i] - ys[i - 1]) * f2;
|
|
21539
21734
|
}
|
|
21540
21735
|
}
|
|
21541
21736
|
return ys[n - 1];
|
|
@@ -22007,7 +22202,7 @@ function parseSerializableObject(view, dataOff, dataSize) {
|
|
|
22007
22202
|
return null;
|
|
22008
22203
|
}
|
|
22009
22204
|
const p = dataOff + 20;
|
|
22010
|
-
const
|
|
22205
|
+
const i322 = (k, lo, hi) => clamp(view.getInt32(p + 4 * k, true), lo, hi);
|
|
22011
22206
|
const f326 = (k, lo, hi) => {
|
|
22012
22207
|
const v = view.getFloat32(p + 4 * k, true);
|
|
22013
22208
|
return Number.isFinite(v) ? clamp(v, lo, hi) : 0;
|
|
@@ -22017,9 +22212,9 @@ function parseSerializableObject(view, dataOff, dataSize) {
|
|
|
22017
22212
|
case "blur":
|
|
22018
22213
|
return need(8) ? { kind, radius: f326(0, 0, 255), expandEdge: view.getUint32(p + 4, true) !== 0 } : null;
|
|
22019
22214
|
case "brightnessContrast":
|
|
22020
|
-
return need(8) ? { kind, brightness:
|
|
22215
|
+
return need(8) ? { kind, brightness: i322(0, -255, 255), contrast: i322(1, -100, 100) } : null;
|
|
22021
22216
|
case "colorBalance":
|
|
22022
|
-
return need(12) ? { kind, cyanRed:
|
|
22217
|
+
return need(12) ? { kind, cyanRed: i322(0, -100, 100), magentaGreen: i322(1, -100, 100), yellowBlue: i322(2, -100, 100) } : null;
|
|
22023
22218
|
case "colorCurve": {
|
|
22024
22219
|
if (!need(COLOR_CURVE_PARAMS_SIZE)) return null;
|
|
22025
22220
|
const adjustment = view.getInt32(p, true), channel = view.getInt32(p + 4, true), intensity = view.getInt32(p + 8, true);
|
|
@@ -22047,9 +22242,9 @@ function parseSerializableObject(view, dataOff, dataSize) {
|
|
|
22047
22242
|
return { kind, matrix };
|
|
22048
22243
|
}
|
|
22049
22244
|
case "hueSaturationLightness":
|
|
22050
|
-
return need(12) ? { kind, hue:
|
|
22245
|
+
return need(12) ? { kind, hue: i322(0, -180, 180), saturation: i322(1, -100, 100), lightness: i322(2, -100, 100) } : null;
|
|
22051
22246
|
case "levels":
|
|
22052
|
-
return need(12) ? { kind, highlight:
|
|
22247
|
+
return need(12) ? { kind, highlight: i322(0, 0, 100), midtone: i322(1, -100, 100), shadow: i322(2, 0, 100) } : null;
|
|
22053
22248
|
case "redEyeCorrection": {
|
|
22054
22249
|
if (!need(4)) {
|
|
22055
22250
|
return null;
|
|
@@ -22073,14 +22268,14 @@ function parseSerializableObject(view, dataOff, dataSize) {
|
|
|
22073
22268
|
case "sharpen":
|
|
22074
22269
|
return need(8) ? { kind, radius: f326(0, 0, 255), amount: f326(1, 0, 100) } : null;
|
|
22075
22270
|
case "tint":
|
|
22076
|
-
return need(8) ? { kind, hue:
|
|
22271
|
+
return need(8) ? { kind, hue: i322(0, -180, 180), amount: i322(1, -100, 100) } : null;
|
|
22077
22272
|
}
|
|
22078
22273
|
}
|
|
22079
22274
|
var roundHalfDown = (v) => Math.ceil(v - 0.5);
|
|
22080
|
-
function buildLut(
|
|
22275
|
+
function buildLut(f2, round = Math.round) {
|
|
22081
22276
|
const lut = new Uint8Array(256);
|
|
22082
22277
|
for (let v = 0; v < 256; v++) {
|
|
22083
|
-
lut[v] = clamp(round(
|
|
22278
|
+
lut[v] = clamp(round(f2(v)), 0, 255);
|
|
22084
22279
|
}
|
|
22085
22280
|
return lut;
|
|
22086
22281
|
}
|
|
@@ -22165,17 +22360,17 @@ var HUE_CIRCLE = 255;
|
|
|
22165
22360
|
function gdipHue(r, g, b) {
|
|
22166
22361
|
const max = Math.max(r, g, b);
|
|
22167
22362
|
const d = max - Math.min(r, g, b);
|
|
22168
|
-
const
|
|
22363
|
+
const f2 = (x) => Math.floor(x * HUE_SEXTANT / d);
|
|
22169
22364
|
if (max === r && g >= b) {
|
|
22170
|
-
return
|
|
22365
|
+
return f2(g - b);
|
|
22171
22366
|
}
|
|
22172
22367
|
if (max === b && b !== r) {
|
|
22173
|
-
return r >= g ? 170 +
|
|
22368
|
+
return r >= g ? 170 + f2(r - g) : 127 + f2(b - g);
|
|
22174
22369
|
}
|
|
22175
22370
|
if (max === g) {
|
|
22176
|
-
return b >= r ? 86 +
|
|
22371
|
+
return b >= r ? 86 + f2(b - r) : 43 + f2(g - r);
|
|
22177
22372
|
}
|
|
22178
|
-
const t =
|
|
22373
|
+
const t = f2(b - g);
|
|
22179
22374
|
const q = (256 - t - (t >= 40 ? 1 : 0)) % 256;
|
|
22180
22375
|
return q - Math.floor((q + 42) / 86);
|
|
22181
22376
|
}
|
|
@@ -23203,7 +23398,7 @@ function deriveClipDomain(...regions) {
|
|
|
23203
23398
|
let minY = Infinity;
|
|
23204
23399
|
let maxX = -Infinity;
|
|
23205
23400
|
let maxY = -Infinity;
|
|
23206
|
-
const
|
|
23401
|
+
const add3 = (x2, y2) => {
|
|
23207
23402
|
if (Math.abs(x2) < FINITE_LIMIT && Math.abs(y2) < FINITE_LIMIT) {
|
|
23208
23403
|
minX = Math.min(minX, x2);
|
|
23209
23404
|
minY = Math.min(minY, y2);
|
|
@@ -23215,7 +23410,7 @@ function deriveClipDomain(...regions) {
|
|
|
23215
23410
|
for (const shape of region ?? []) {
|
|
23216
23411
|
for (const poly of flattenClipCmds(shape.cmds)) {
|
|
23217
23412
|
for (let i = 0; i < poly.length; i += 2) {
|
|
23218
|
-
|
|
23413
|
+
add3(poly[i], poly[i + 1]);
|
|
23219
23414
|
}
|
|
23220
23415
|
}
|
|
23221
23416
|
}
|
|
@@ -23833,6 +24028,7 @@ function parsePathGradient(view, b, end) {
|
|
|
23833
24028
|
}
|
|
23834
24029
|
let boundaryPts = [];
|
|
23835
24030
|
let boundaryArgb = [];
|
|
24031
|
+
let source;
|
|
23836
24032
|
const surroundAt = (k) => surround.length > 0 ? surround[Math.min(k, surround.length - 1)] : centerArgb;
|
|
23837
24033
|
if (flags & BRUSH_DATA_PATH) {
|
|
23838
24034
|
if (o + 4 <= end) {
|
|
@@ -23844,6 +24040,20 @@ function parsePathGradient(view, b, end) {
|
|
|
23844
24040
|
const flat = flattenFirstFigure(path.points, path.types, surroundAt);
|
|
23845
24041
|
boundaryPts = flat.points;
|
|
23846
24042
|
boundaryArgb = flat.argb;
|
|
24043
|
+
let figure = path.points.length;
|
|
24044
|
+
for (let k = 0; k < path.points.length; k++) {
|
|
24045
|
+
if (k > 0 && (path.types[k] & 7) === 0) {
|
|
24046
|
+
figure = k;
|
|
24047
|
+
break;
|
|
24048
|
+
}
|
|
24049
|
+
if (path.types[k] & 128) {
|
|
24050
|
+
figure = k + 1;
|
|
24051
|
+
break;
|
|
24052
|
+
}
|
|
24053
|
+
}
|
|
24054
|
+
if (path.types.slice(0, figure).some((t) => (t & 7) === 3)) {
|
|
24055
|
+
source = { points: path.points.slice(0, figure), types: path.types.slice(0, figure) };
|
|
24056
|
+
}
|
|
23847
24057
|
}
|
|
23848
24058
|
o += pathSize;
|
|
23849
24059
|
}
|
|
@@ -23936,6 +24146,7 @@ function parsePathGradient(view, b, end) {
|
|
|
23936
24146
|
center,
|
|
23937
24147
|
centerArgb,
|
|
23938
24148
|
boundary: boundaryPts,
|
|
24149
|
+
source,
|
|
23939
24150
|
boundaryArgb,
|
|
23940
24151
|
blend,
|
|
23941
24152
|
preset,
|
|
@@ -24240,12 +24451,12 @@ function recordNominalFigures(buildPath, device, cull) {
|
|
|
24240
24451
|
if (!fig) {
|
|
24241
24452
|
moveTo(c1x, c1y);
|
|
24242
24453
|
}
|
|
24243
|
-
const
|
|
24244
|
-
|
|
24245
|
-
const n =
|
|
24454
|
+
const f2 = fig;
|
|
24455
|
+
f2.curved = true;
|
|
24456
|
+
const n = f2.pts.length;
|
|
24246
24457
|
flattenBezierGdiplus(
|
|
24247
|
-
[
|
|
24248
|
-
|
|
24458
|
+
[f2.pts[n - 2], f2.pts[n - 1], fx(c1x, c1y), fy(c1x, c1y), fx(c2x, c2y), fy(c2x, c2y), fx(x, y), fy(x, y)],
|
|
24459
|
+
f2.pts);
|
|
24249
24460
|
},
|
|
24250
24461
|
ellipse(cx, cy, rx, ry, rotation, a0, a1, ccw) {
|
|
24251
24462
|
let sweep = a1 - a0;
|
|
@@ -24290,11 +24501,11 @@ function recordNominalFigures(buildPath, device, cull) {
|
|
|
24290
24501
|
}
|
|
24291
24502
|
};
|
|
24292
24503
|
buildPath(recorder);
|
|
24293
|
-
return figures.filter((
|
|
24504
|
+
return figures.filter((f2) => f2.pts.length >= 4);
|
|
24294
24505
|
}
|
|
24295
|
-
function strokePoints(
|
|
24296
|
-
const p =
|
|
24297
|
-
if (!
|
|
24506
|
+
function strokePoints(f2) {
|
|
24507
|
+
const p = f2.pts;
|
|
24508
|
+
if (!f2.closed || p.length < 4) {
|
|
24298
24509
|
return p;
|
|
24299
24510
|
}
|
|
24300
24511
|
return [...p, p[0], p[1]];
|
|
@@ -24549,7 +24760,7 @@ function nominalOutline(pts) {
|
|
|
24549
24760
|
return poly;
|
|
24550
24761
|
}
|
|
24551
24762
|
function nominalLineCoverage(figures, mode, box) {
|
|
24552
|
-
if (!mode.antialias && mode.opaqueSolid && !figures.some((
|
|
24763
|
+
if (!mode.antialias && mode.opaqueSolid && !figures.some((f2) => f2.curved)) {
|
|
24553
24764
|
const shift = mode.half ? 8 : 0;
|
|
24554
24765
|
const out = new Uint8ClampedArray(box.w * box.h);
|
|
24555
24766
|
const plot = (x, y) => {
|
|
@@ -24560,8 +24771,8 @@ function nominalLineCoverage(figures, mode, box) {
|
|
|
24560
24771
|
}
|
|
24561
24772
|
};
|
|
24562
24773
|
const clip = mode.clip && !pathInside(figures, mode.clip, shift) ? mode.clip : void 0;
|
|
24563
|
-
for (const
|
|
24564
|
-
const p = strokePoints(
|
|
24774
|
+
for (const f2 of figures) {
|
|
24775
|
+
const p = strokePoints(f2);
|
|
24565
24776
|
for (let i = 0; i + 3 < p.length; i += 2) {
|
|
24566
24777
|
ddaSegment(p[i] - shift, p[i + 1] - shift, p[i + 2] - shift, p[i + 3] - shift, true, plot, clip);
|
|
24567
24778
|
}
|
|
@@ -24569,8 +24780,8 @@ function nominalLineCoverage(figures, mode, box) {
|
|
|
24569
24780
|
return out;
|
|
24570
24781
|
}
|
|
24571
24782
|
const polys = [];
|
|
24572
|
-
for (const
|
|
24573
|
-
for (const batch of enumeratorBatches(strokePoints(
|
|
24783
|
+
for (const f2 of figures) {
|
|
24784
|
+
for (const batch of enumeratorBatches(strokePoints(f2))) {
|
|
24574
24785
|
const outline = nominalOutline(batch);
|
|
24575
24786
|
if (outline.length >= 6) {
|
|
24576
24787
|
polys.push(outline);
|
|
@@ -24584,10 +24795,10 @@ function pathInside(figures, clip, shift) {
|
|
|
24584
24795
|
let y0 = Infinity;
|
|
24585
24796
|
let x1 = -Infinity;
|
|
24586
24797
|
let y1 = -Infinity;
|
|
24587
|
-
for (const
|
|
24588
|
-
for (let i = 0; i + 1 <
|
|
24589
|
-
const x = (
|
|
24590
|
-
const y = (
|
|
24798
|
+
for (const f2 of figures) {
|
|
24799
|
+
for (let i = 0; i + 1 < f2.pts.length; i += 2) {
|
|
24800
|
+
const x = (f2.pts[i] - shift) / 16;
|
|
24801
|
+
const y = (f2.pts[i + 1] - shift) / 16;
|
|
24591
24802
|
x0 = Math.min(x0, x);
|
|
24592
24803
|
x1 = Math.max(x1, x);
|
|
24593
24804
|
y0 = Math.min(y0, y);
|
|
@@ -24637,24 +24848,24 @@ function recordDeviceFigures(buildPath, device) {
|
|
|
24637
24848
|
if (!fig) {
|
|
24638
24849
|
moveTo(c1x, c1y);
|
|
24639
24850
|
}
|
|
24640
|
-
const
|
|
24641
|
-
|
|
24642
|
-
const n =
|
|
24643
|
-
const near = (qx, qy) => Math.abs(qx -
|
|
24851
|
+
const f2 = fig;
|
|
24852
|
+
f2.curved = true;
|
|
24853
|
+
const n = f2.pts.length;
|
|
24854
|
+
const near = (qx, qy) => Math.abs(qx - f2.pts[n - 2]) < 1e-3 && Math.abs(qy - f2.pts[n - 1]) < 1e-3;
|
|
24644
24855
|
const degenerate = near(dx(c1x, c1y), dy(c1x, c1y)) && near(dx(c2x, c2y), dy(c2x, c2y)) && near(dx(x, y), dy(x, y));
|
|
24645
24856
|
const fix = (v) => toPlusFix(v);
|
|
24646
|
-
const p0x = fix(
|
|
24647
|
-
const p0y = fix(
|
|
24648
|
-
|
|
24649
|
-
|
|
24857
|
+
const p0x = fix(f2.pts[n - 2]);
|
|
24858
|
+
const p0y = fix(f2.pts[n - 1]);
|
|
24859
|
+
f2.pts[n - 2] = p0x / 16;
|
|
24860
|
+
f2.pts[n - 1] = p0y / 16;
|
|
24650
24861
|
if (degenerate) {
|
|
24651
|
-
(
|
|
24862
|
+
(f2.splits ?? (f2.splits = [])).push({ x: p0x / 16, y: p0y / 16 });
|
|
24652
24863
|
}
|
|
24653
24864
|
const out = [];
|
|
24654
24865
|
const ctrl = [p0x, p0y, fix(dx(c1x, c1y)), fix(dy(c1x, c1y)), fix(dx(c2x, c2y)), fix(dy(c2x, c2y)), fix(dx(x, y)), fix(dy(x, y))];
|
|
24655
24866
|
flattenBezierGdiplus(ctrl, out);
|
|
24656
24867
|
for (const v of out) {
|
|
24657
|
-
|
|
24868
|
+
f2.pts.push(v / 16);
|
|
24658
24869
|
}
|
|
24659
24870
|
};
|
|
24660
24871
|
const closePath = () => {
|
|
@@ -24709,10 +24920,10 @@ function recordDeviceFigures(buildPath, device) {
|
|
|
24709
24920
|
}
|
|
24710
24921
|
};
|
|
24711
24922
|
buildPath(recorder);
|
|
24712
|
-
return figures.filter((
|
|
24923
|
+
return figures.filter((f2) => f2.pts.length >= 4);
|
|
24713
24924
|
}
|
|
24714
24925
|
function recordPlusFigures(buildPath, device, aliased = false) {
|
|
24715
|
-
return recordDeviceFigures(buildPath, device).map((
|
|
24926
|
+
return recordDeviceFigures(buildPath, device).map((f2) => (aliased && !f2.curved ? aliasedRectFix(f2.pts) : null) ?? f2.pts.map(toPlusFix)).filter((f2) => f2.length >= 6);
|
|
24716
24927
|
}
|
|
24717
24928
|
function ceilDiv2(a, b) {
|
|
24718
24929
|
let q = Math.floor(a / b);
|
|
@@ -24729,12 +24940,12 @@ function figuresBox(figures, size) {
|
|
|
24729
24940
|
let y0 = Infinity;
|
|
24730
24941
|
let x1 = -Infinity;
|
|
24731
24942
|
let y1 = -Infinity;
|
|
24732
|
-
for (const
|
|
24733
|
-
for (let i = 0; i <
|
|
24734
|
-
x0 = Math.min(x0,
|
|
24735
|
-
x1 = Math.max(x1,
|
|
24736
|
-
y0 = Math.min(y0,
|
|
24737
|
-
y1 = Math.max(y1,
|
|
24943
|
+
for (const f2 of figures) {
|
|
24944
|
+
for (let i = 0; i < f2.length; i += 2) {
|
|
24945
|
+
x0 = Math.min(x0, f2[i]);
|
|
24946
|
+
x1 = Math.max(x1, f2[i]);
|
|
24947
|
+
y0 = Math.min(y0, f2[i + 1]);
|
|
24948
|
+
y1 = Math.max(y1, f2[i + 1]);
|
|
24738
24949
|
}
|
|
24739
24950
|
}
|
|
24740
24951
|
if (!Number.isFinite(x0)) {
|
|
@@ -24756,14 +24967,14 @@ function rasterizePlusFill(figures, evenOdd, antialias, half, box) {
|
|
|
24756
24967
|
const y0 = 16 * box.y + o - (antialias ? 8 : 0);
|
|
24757
24968
|
const cols = box.w * sx;
|
|
24758
24969
|
const edges = [];
|
|
24759
|
-
for (const
|
|
24760
|
-
const n =
|
|
24970
|
+
for (const f2 of figures) {
|
|
24971
|
+
const n = f2.length / 2;
|
|
24761
24972
|
for (let i = 0; i < n; i++) {
|
|
24762
24973
|
const j = (i + 1) % n;
|
|
24763
|
-
const ax =
|
|
24764
|
-
const ay =
|
|
24765
|
-
const bx =
|
|
24766
|
-
const by =
|
|
24974
|
+
const ax = f2[2 * i];
|
|
24975
|
+
const ay = f2[2 * i + 1];
|
|
24976
|
+
const bx = f2[2 * j];
|
|
24977
|
+
const by = f2[2 * j + 1];
|
|
24767
24978
|
if (ay === by) {
|
|
24768
24979
|
continue;
|
|
24769
24980
|
}
|
|
@@ -24828,7 +25039,7 @@ function clipPixelRects(shapes, box, half) {
|
|
|
24828
25039
|
for (const shape of shapes) {
|
|
24829
25040
|
let figs;
|
|
24830
25041
|
try {
|
|
24831
|
-
figs = recordDeviceFigures(shape.build, identity).map((
|
|
25042
|
+
figs = recordDeviceFigures(shape.build, identity).map((f2) => f2.pts.map(nearestFix));
|
|
24832
25043
|
} catch {
|
|
24833
25044
|
return null;
|
|
24834
25045
|
}
|
|
@@ -24875,6 +25086,156 @@ function clipPixelRects(shapes, box, half) {
|
|
|
24875
25086
|
return rects;
|
|
24876
25087
|
}
|
|
24877
25088
|
|
|
25089
|
+
// src/emf-plus-widen-f32.ts
|
|
25090
|
+
var f = Math.fround;
|
|
25091
|
+
var add2 = (a, b) => down32(a + b);
|
|
25092
|
+
var sub2 = (a, b) => down32(a - b);
|
|
25093
|
+
var mul3 = (a, b) => down32(a * b);
|
|
25094
|
+
var div2 = (a, b) => down32(a / b);
|
|
25095
|
+
var EPSILON2 = 11920928955078125e-23;
|
|
25096
|
+
function gradientF32(a, b) {
|
|
25097
|
+
let gx = sub2(f(b.x), f(a.x));
|
|
25098
|
+
let gy = sub2(f(b.y), f(a.y));
|
|
25099
|
+
const sum = add2(mul3(gy, gy), mul3(gx, gx));
|
|
25100
|
+
let len = 0;
|
|
25101
|
+
if (sum > 0) {
|
|
25102
|
+
len = down32(Math.sqrt(sum));
|
|
25103
|
+
gx = div2(gx, len);
|
|
25104
|
+
gy = div2(gy, len);
|
|
25105
|
+
}
|
|
25106
|
+
return { gx, gy, len };
|
|
25107
|
+
}
|
|
25108
|
+
function normF32(dx, dy) {
|
|
25109
|
+
const len = Math.sqrt(dx * dx + dy * dy);
|
|
25110
|
+
return len < EPSILON2 ? 0 : down32(len);
|
|
25111
|
+
}
|
|
25112
|
+
var KAPPA2 = f(0.552284777);
|
|
25113
|
+
var SEMICIRCLE = [
|
|
25114
|
+
[1, 0],
|
|
25115
|
+
[1, KAPPA2],
|
|
25116
|
+
[KAPPA2, 1],
|
|
25117
|
+
[0, 1],
|
|
25118
|
+
[-KAPPA2, 1],
|
|
25119
|
+
[-1, KAPPA2],
|
|
25120
|
+
[-1, 0]
|
|
25121
|
+
];
|
|
25122
|
+
function capTransform(p, g, a, b, start) {
|
|
25123
|
+
const gx = start ? -g.gx : g.gx;
|
|
25124
|
+
const gy = start ? -g.gy : g.gy;
|
|
25125
|
+
const sum = add2(a, b);
|
|
25126
|
+
const half = mul3(sub2(a, b), 0.5);
|
|
25127
|
+
const cx = add2(mul3(mul3(sum, g.gy), 0.5), p.x);
|
|
25128
|
+
const cy = sub2(p.y, mul3(mul3(sum, g.gx), 0.5));
|
|
25129
|
+
const hy = mul3(half, gy);
|
|
25130
|
+
const nhx = mul3(-half, gx);
|
|
25131
|
+
return (x, y) => ({ x: add2(sub2(mul3(x, hy), mul3(y, nhx)), cx), y: add2(add2(mul3(y, hy), mul3(x, nhx)), cy) });
|
|
25132
|
+
}
|
|
25133
|
+
function doubleRoundCapF32(p, g, a, b, start) {
|
|
25134
|
+
const at = capTransform(p, g, a, b, start);
|
|
25135
|
+
const out = [];
|
|
25136
|
+
for (const shift of [0.5, -0.5]) {
|
|
25137
|
+
for (const [ux, uy] of SEMICIRCLE) {
|
|
25138
|
+
out.push(at(add2(mul3(ux, 0.5), shift), mul3(uy, 0.5)));
|
|
25139
|
+
}
|
|
25140
|
+
}
|
|
25141
|
+
return out;
|
|
25142
|
+
}
|
|
25143
|
+
function offsetPointF32(p, g, o) {
|
|
25144
|
+
if (o < 0) {
|
|
25145
|
+
return { x: add2(p.x, mul3(-o, g.gy)), y: add2(p.y, mul3(-o, -g.gx)) };
|
|
25146
|
+
}
|
|
25147
|
+
return { x: sub2(p.x, mul3(o, g.gy)), y: sub2(p.y, mul3(o, -g.gx)) };
|
|
25148
|
+
}
|
|
25149
|
+
function dashF32(pts, closed, dash, offset) {
|
|
25150
|
+
const n = pts.length;
|
|
25151
|
+
if (n < 2 || dash.length === 0) {
|
|
25152
|
+
return [];
|
|
25153
|
+
}
|
|
25154
|
+
let total = 0;
|
|
25155
|
+
for (const d of dash) {
|
|
25156
|
+
total = add2(total, d);
|
|
25157
|
+
}
|
|
25158
|
+
if (!(total > 0)) {
|
|
25159
|
+
return [];
|
|
25160
|
+
}
|
|
25161
|
+
let rem = f(offset % total);
|
|
25162
|
+
if (rem < 0) {
|
|
25163
|
+
rem = add2(rem, total);
|
|
25164
|
+
}
|
|
25165
|
+
let idx = 0;
|
|
25166
|
+
for (let guard = 0; guard < 1e6; guard++) {
|
|
25167
|
+
const d = dash[idx % dash.length];
|
|
25168
|
+
if (d > rem) {
|
|
25169
|
+
rem = sub2(d, rem);
|
|
25170
|
+
break;
|
|
25171
|
+
}
|
|
25172
|
+
rem = sub2(rem, d);
|
|
25173
|
+
idx++;
|
|
25174
|
+
}
|
|
25175
|
+
let on = idx % 2 === 0;
|
|
25176
|
+
let nextIdx = idx + 1;
|
|
25177
|
+
const lengths = [0];
|
|
25178
|
+
for (let i = 1; i < n; i++) {
|
|
25179
|
+
lengths.push(gradientF32(pts[i - 1], pts[i]).len);
|
|
25180
|
+
}
|
|
25181
|
+
let cur;
|
|
25182
|
+
let k;
|
|
25183
|
+
let segRem;
|
|
25184
|
+
{
|
|
25185
|
+
cur = pts[n - 1];
|
|
25186
|
+
k = 0;
|
|
25187
|
+
segRem = normF32(sub2(pts[0].x, cur.x), sub2(pts[0].y, cur.y));
|
|
25188
|
+
}
|
|
25189
|
+
let dashRem = rem;
|
|
25190
|
+
const out = [];
|
|
25191
|
+
let run = null;
|
|
25192
|
+
const tiny = (a, b) => Math.abs(sub2(a.x, b.x)) < EPSILON2 && Math.abs(sub2(a.y, b.y)) < EPSILON2;
|
|
25193
|
+
for (let guard = 0; k < n && guard < 1e7; guard++) {
|
|
25194
|
+
const next = pts[k];
|
|
25195
|
+
if (dashRem > segRem) {
|
|
25196
|
+
dashRem = sub2(dashRem, segRem);
|
|
25197
|
+
if (on) {
|
|
25198
|
+
if (tiny(cur, next)) {
|
|
25199
|
+
if (run && run.length > 1) {
|
|
25200
|
+
out.push(run);
|
|
25201
|
+
}
|
|
25202
|
+
run = null;
|
|
25203
|
+
} else {
|
|
25204
|
+
run ?? (run = [cur]);
|
|
25205
|
+
run.push(next);
|
|
25206
|
+
}
|
|
25207
|
+
}
|
|
25208
|
+
cur = next;
|
|
25209
|
+
k++;
|
|
25210
|
+
if (k < n) {
|
|
25211
|
+
segRem = lengths[k];
|
|
25212
|
+
}
|
|
25213
|
+
} else {
|
|
25214
|
+
const t = div2(dashRem, segRem);
|
|
25215
|
+
const q = { x: add2(mul3(sub2(next.x, cur.x), t), cur.x), y: add2(mul3(sub2(next.y, cur.y), t), cur.y) };
|
|
25216
|
+
segRem = sub2(segRem, dashRem);
|
|
25217
|
+
if (on) {
|
|
25218
|
+
if (!tiny(cur, q)) {
|
|
25219
|
+
run ?? (run = [cur]);
|
|
25220
|
+
run.push(q);
|
|
25221
|
+
out.push(run);
|
|
25222
|
+
} else if (run && run.length > 1) {
|
|
25223
|
+
out.push(run);
|
|
25224
|
+
}
|
|
25225
|
+
run = null;
|
|
25226
|
+
}
|
|
25227
|
+
cur = q;
|
|
25228
|
+
dashRem = dash[nextIdx % dash.length];
|
|
25229
|
+
nextIdx++;
|
|
25230
|
+
on = !on;
|
|
25231
|
+
}
|
|
25232
|
+
}
|
|
25233
|
+
if (on && run && run.length > 1) {
|
|
25234
|
+
out.push(run);
|
|
25235
|
+
}
|
|
25236
|
+
return out;
|
|
25237
|
+
}
|
|
25238
|
+
|
|
24878
25239
|
// src/emf-plus-widen.ts
|
|
24879
25240
|
function arcPoints2(c, r, a0, sweep) {
|
|
24880
25241
|
const out = [];
|
|
@@ -24982,8 +25343,8 @@ function joinPoints(p, f1, f2, o, pen, meetInside = false) {
|
|
|
24982
25343
|
}
|
|
24983
25344
|
return [a, b];
|
|
24984
25345
|
}
|
|
24985
|
-
function capPoints(p,
|
|
24986
|
-
const at = (o, ext) => ({ x: p.x +
|
|
25346
|
+
function capPoints(p, f2, o1, o2, cap, half, double = false) {
|
|
25347
|
+
const at = (o, ext) => ({ x: p.x + f2.nx * o + f2.ux * ext, y: p.y + f2.ny * o + f2.uy * ext });
|
|
24987
25348
|
const base = cap & 15;
|
|
24988
25349
|
const kind = cap === 17 ? 1 : cap === 18 ? 2 : cap === 19 || cap === 20 ? 3 : cap >= 16 ? 0 : base;
|
|
24989
25350
|
switch (kind) {
|
|
@@ -24992,7 +25353,7 @@ function capPoints(p, f, o1, o2, cap, half, double = false) {
|
|
|
24992
25353
|
case 2: {
|
|
24993
25354
|
if (double) {
|
|
24994
25355
|
const r2 = Math.abs(o2 - o1) / 4;
|
|
24995
|
-
const a02 = Math.atan2(
|
|
25356
|
+
const a02 = Math.atan2(f2.ny, f2.nx);
|
|
24996
25357
|
const mid = (o1 + o2) / 2;
|
|
24997
25358
|
const c2 = (o2 + mid) / 2;
|
|
24998
25359
|
const c1 = (o1 + mid) / 2;
|
|
@@ -25001,7 +25362,7 @@ function capPoints(p, f, o1, o2, cap, half, double = false) {
|
|
|
25001
25362
|
const c = (o1 + o2) / 2;
|
|
25002
25363
|
const r = Math.abs(o2 - o1) / 2;
|
|
25003
25364
|
const centre = Math.abs(c) > 1e-9 ? at(c, 0) : p;
|
|
25004
|
-
const a0 = Math.atan2(
|
|
25365
|
+
const a0 = Math.atan2(f2.ny, f2.nx) + (o2 < c ? Math.PI : 0);
|
|
25005
25366
|
const sweep = o2 > c ? -Math.PI : Math.PI;
|
|
25006
25367
|
return [at(o2, 0), ...arcPoints2(centre, r, a0, sweep), at(o1, 0)];
|
|
25007
25368
|
}
|
|
@@ -25028,8 +25389,8 @@ function sidePoints(pts, closed, o, pen) {
|
|
|
25028
25389
|
if (inIdx >= 0 && outIdx >= 0) {
|
|
25029
25390
|
out.push(...joinPoints(pts[i], frames[inIdx], frames[outIdx], o, pen, closed && !!pen.compound));
|
|
25030
25391
|
} else {
|
|
25031
|
-
const
|
|
25032
|
-
out.push({ x: pts[i].x +
|
|
25392
|
+
const f2 = frames[outIdx >= 0 ? outIdx : inIdx];
|
|
25393
|
+
out.push({ x: pts[i].x + f2.nx * o, y: pts[i].y + f2.ny * o });
|
|
25033
25394
|
}
|
|
25034
25395
|
}
|
|
25035
25396
|
return out;
|
|
@@ -25102,13 +25463,50 @@ function dashFigure(pts, closed, pen, splits) {
|
|
|
25102
25463
|
}
|
|
25103
25464
|
return out.filter((d) => d.pts.length > 1);
|
|
25104
25465
|
}
|
|
25466
|
+
function dashPiecesSingle(raw, pen) {
|
|
25467
|
+
const width = down32(pen.dashCapWidth ?? 2 * pen.half);
|
|
25468
|
+
const least = down32(Math.fround(1e-3) * width);
|
|
25469
|
+
const dash = pen.dash.map((v, i) => {
|
|
25470
|
+
const d = down32(v);
|
|
25471
|
+
if (i % 2 === 1) {
|
|
25472
|
+
return down32(d + width);
|
|
25473
|
+
}
|
|
25474
|
+
const shortened = down32(d - width);
|
|
25475
|
+
return least > shortened ? least : shortened;
|
|
25476
|
+
});
|
|
25477
|
+
const pts = [];
|
|
25478
|
+
for (let i = 0; i + 1 < raw.length; i += 2) {
|
|
25479
|
+
pts.push({ x: Math.fround(raw[i]), y: Math.fround(raw[i + 1]) });
|
|
25480
|
+
}
|
|
25481
|
+
if (pts.length > 1 && pts[0].x === pts[pts.length - 1].x && pts[0].y === pts[pts.length - 1].y) {
|
|
25482
|
+
pts.pop();
|
|
25483
|
+
}
|
|
25484
|
+
return dashF32(pts, true, dash, down32(down32(pen.dashOffset) - width)).map((d) => ({ pts: d, first: false, last: false }));
|
|
25485
|
+
}
|
|
25486
|
+
function singleCap(p, g, o1, o2, start) {
|
|
25487
|
+
const c = doubleRoundCapF32({ x: Math.fround(p.x), y: Math.fround(p.y) }, g, o2, o1, start);
|
|
25488
|
+
const out = [c[0]];
|
|
25489
|
+
for (const [i0, i1, i2, i3] of [
|
|
25490
|
+
[0, 1, 2, 3],
|
|
25491
|
+
[3, 4, 5, 6],
|
|
25492
|
+
[7, 8, 9, 10],
|
|
25493
|
+
[10, 11, 12, 13]
|
|
25494
|
+
]) {
|
|
25495
|
+
const flat = [];
|
|
25496
|
+
flattenBezierGdiplus([i0, i1, i2, i3].flatMap((i) => [toPlusFix(c[i].x), toPlusFix(c[i].y)]), flat);
|
|
25497
|
+
for (let k = 0; k + 1 < flat.length; k += 2) {
|
|
25498
|
+
out.push({ x: flat[k] / 16, y: flat[k + 1] / 16 });
|
|
25499
|
+
}
|
|
25500
|
+
}
|
|
25501
|
+
return out.reverse();
|
|
25502
|
+
}
|
|
25105
25503
|
var ARROW_ANCHOR = 20;
|
|
25106
25504
|
function centeredAnchor(pp, atEnd, half, cap) {
|
|
25107
25505
|
const p = atEnd ? pp[pp.length - 1] : pp[0];
|
|
25108
25506
|
const q = atEnd ? pp[pp.length - 2] : pp[1];
|
|
25109
|
-
const
|
|
25110
|
-
const at = (u, n) => ({ x: p.x +
|
|
25111
|
-
if (cap === 18) return arcPoints2(p, 2 * half, Math.atan2(
|
|
25507
|
+
const f2 = frame(q, p);
|
|
25508
|
+
const at = (u, n) => ({ x: p.x + f2.ux * u + f2.nx * n, y: p.y + f2.uy * u + f2.ny * n });
|
|
25509
|
+
if (cap === 18) return arcPoints2(p, 2 * half, Math.atan2(f2.uy, f2.ux), 2 * Math.PI);
|
|
25112
25510
|
if (cap === 19) return [at(-2 * half, 0), at(0, -2 * half), at(2 * half, 0), at(0, 2 * half)];
|
|
25113
25511
|
const h = Math.SQRT2 * half;
|
|
25114
25512
|
return [at(-h, -h), at(h, -h), at(h, h), at(-h, h)];
|
|
@@ -25223,7 +25621,8 @@ function widenFigures(figures, pen) {
|
|
|
25223
25621
|
bands.push([lo, hi]);
|
|
25224
25622
|
}
|
|
25225
25623
|
const dashPen = pen.inset && closed ? { ...pen, dashOffset: pen.dashOffset * 2 } : pen;
|
|
25226
|
-
const
|
|
25624
|
+
const single = !!pen.dash && !!pen.doubleRoundCap && pen.dashCap === 2 && closed;
|
|
25625
|
+
const pieces = single ? dashPiecesSingle(fig.pts, pen) : pen.dash ? dashFigure(pts, closed, dashPen, fig.splits) : [{ pts, first: true, last: true }];
|
|
25227
25626
|
const pieceClosed = !pen.dash && closed;
|
|
25228
25627
|
for (const piece of pieces) {
|
|
25229
25628
|
const pp = cleanPoints(
|
|
@@ -25266,8 +25665,13 @@ function widenFigures(figures, pen) {
|
|
|
25266
25665
|
const f0 = frame(pp[1], pp[0]);
|
|
25267
25666
|
const endCap = endCapOverride ?? (piece.last && !(pen.dash && closed) ? pen.endCap : pen.dashCap);
|
|
25268
25667
|
const startCap = startCapOverride ?? (piece.first && !(pen.dash && closed) ? pen.startCap : pen.dashCap);
|
|
25269
|
-
const
|
|
25270
|
-
const
|
|
25668
|
+
const gEnd = single ? gradientF32(pp[pp.length - 2], pp[pp.length - 1]) : null;
|
|
25669
|
+
const gStart = single ? gradientF32(pp[0], pp[1]) : null;
|
|
25670
|
+
const capEnd = gEnd ? singleCap(pp[pp.length - 1], gEnd, o1, o2, false) : capPoints(pp[pp.length - 1], fEnd, o1, o2, endCap, h, pen.doubleRoundCap);
|
|
25671
|
+
const capStart = gStart ? singleCap(pp[0], gStart, o1, o2, true) : capPoints(pp[0], f0, -o2, -o1, startCap, h, pen.doubleRoundCap);
|
|
25672
|
+
if (gStart) {
|
|
25673
|
+
left[0] = offsetPointF32(pp[0], gStart, o2);
|
|
25674
|
+
}
|
|
25271
25675
|
if (endCap === 0 && capEnd.length === 2 && left.length > 2 && right.length > 2) {
|
|
25272
25676
|
const behind = (c2, q) => (c2.x - q.x) * fEnd.ux + (c2.y - q.y) * fEnd.uy < -1e-9;
|
|
25273
25677
|
const lq = left[left.length - 2];
|
|
@@ -25344,15 +25748,15 @@ function parseCustomLineCap(view, off, size) {
|
|
|
25344
25748
|
}
|
|
25345
25749
|
const type = view.getInt32(off + 4, true);
|
|
25346
25750
|
const d = off + 8;
|
|
25347
|
-
const
|
|
25751
|
+
const f2 = (k) => view.getFloat32(d + k, true);
|
|
25348
25752
|
const u = (k) => view.getUint32(d + k, true);
|
|
25349
25753
|
if (type === 1) {
|
|
25350
25754
|
if (d + 52 > end) {
|
|
25351
25755
|
return null;
|
|
25352
25756
|
}
|
|
25353
|
-
const width =
|
|
25354
|
-
const height =
|
|
25355
|
-
const middleInset =
|
|
25757
|
+
const width = f2(0);
|
|
25758
|
+
const height = f2(4);
|
|
25759
|
+
const middleInset = f2(8);
|
|
25356
25760
|
const filled = u(12) !== 0;
|
|
25357
25761
|
const path = arrowCapPath(width, height, middleInset, filled);
|
|
25358
25762
|
const length = capPathLength(path.points, path.types);
|
|
@@ -25364,8 +25768,8 @@ function parseCustomLineCap(view, off, size) {
|
|
|
25364
25768
|
strokeStartCap: u(16),
|
|
25365
25769
|
strokeEndCap: u(20),
|
|
25366
25770
|
strokeJoin: u(24),
|
|
25367
|
-
strokeMiterLimit:
|
|
25368
|
-
widthScale:
|
|
25771
|
+
strokeMiterLimit: f2(28),
|
|
25772
|
+
widthScale: f2(32),
|
|
25369
25773
|
fillPath: filled ? path : null,
|
|
25370
25774
|
linePath: filled ? null : path,
|
|
25371
25775
|
fillLength: filled ? length : 0,
|
|
@@ -25397,12 +25801,12 @@ function parseCustomLineCap(view, off, size) {
|
|
|
25397
25801
|
kind: "plus-customlinecap",
|
|
25398
25802
|
capType: 0,
|
|
25399
25803
|
baseCap: u(4),
|
|
25400
|
-
baseInset:
|
|
25804
|
+
baseInset: f2(8),
|
|
25401
25805
|
strokeStartCap: u(12),
|
|
25402
25806
|
strokeEndCap: u(16),
|
|
25403
25807
|
strokeJoin: u(20),
|
|
25404
|
-
strokeMiterLimit:
|
|
25405
|
-
widthScale:
|
|
25808
|
+
strokeMiterLimit: f2(24),
|
|
25809
|
+
widthScale: f2(28),
|
|
25406
25810
|
fillPath,
|
|
25407
25811
|
linePath,
|
|
25408
25812
|
fillLength: fillPath ? capPathLength(fillPath.points, fillPath.types) : 0,
|
|
@@ -25531,7 +25935,7 @@ function capFigures(path, closeAll) {
|
|
|
25531
25935
|
}
|
|
25532
25936
|
}
|
|
25533
25937
|
}, [1, 0, 0, 1, 0, 0]);
|
|
25534
|
-
return closeAll ? figures.map((
|
|
25938
|
+
return closeAll ? figures.map((f2) => ({ ...f2, closed: true })) : figures;
|
|
25535
25939
|
}
|
|
25536
25940
|
function customCapGeometry(figures, width, start, end, options2 = {}) {
|
|
25537
25941
|
const out = [];
|
|
@@ -25578,10 +25982,10 @@ function customCapGeometry(figures, width, start, end, options2 = {}) {
|
|
|
25578
25982
|
const origin = atEnd ? last : first;
|
|
25579
25983
|
if (fill2) {
|
|
25580
25984
|
const placed = placeCapPath(path, origin, dir, Math.max(scale, minFill));
|
|
25581
|
-
for (const
|
|
25985
|
+
for (const f2 of capFigures(placed, true)) {
|
|
25582
25986
|
const poly = [];
|
|
25583
|
-
for (let i = 0; i + 1 <
|
|
25584
|
-
poly.push({ x:
|
|
25987
|
+
for (let i = 0; i + 1 < f2.pts.length; i += 2) {
|
|
25988
|
+
poly.push({ x: f2.pts[i], y: f2.pts[i + 1] });
|
|
25585
25989
|
}
|
|
25586
25990
|
polygons.push(poly);
|
|
25587
25991
|
}
|
|
@@ -26180,9 +26584,9 @@ function writeTextureColorAt(cu, cv, width, height, rgba, wrap, out, o) {
|
|
|
26180
26584
|
out[o + 3] = a;
|
|
26181
26585
|
}
|
|
26182
26586
|
function invertTextureMatrix(m, halfPixel2 = false) {
|
|
26183
|
-
const [a, b, c, d, e,
|
|
26587
|
+
const [a, b, c, d, e, f2] = [m[0], m[1], m[2], m[3], m[4], m[5]].map(Math.fround);
|
|
26184
26588
|
const ex = halfPixel2 ? down32(down32(down32(down32(0.5 * a) + down32(0.5 * c)) + e) - 0.5) : e;
|
|
26185
|
-
const fy = halfPixel2 ? down32(down32(down32(down32(0.5 * b) + down32(0.5 * d)) +
|
|
26589
|
+
const fy = halfPixel2 ? down32(down32(down32(down32(0.5 * b) + down32(0.5 * d)) + f2) - 0.5) : f2;
|
|
26186
26590
|
const det = down32(down32(a * d) - down32(b * c));
|
|
26187
26591
|
if (!Number.isFinite(det) || det === 0) {
|
|
26188
26592
|
return null;
|
|
@@ -26231,10 +26635,10 @@ function textureRowPositions(inv3, x0, y, us, vs, count = us.length) {
|
|
|
26231
26635
|
if (count <= 0) {
|
|
26232
26636
|
return;
|
|
26233
26637
|
}
|
|
26234
|
-
const [a, b, c, d, e,
|
|
26638
|
+
const [a, b, c, d, e, f2] = inv3;
|
|
26235
26639
|
const at = (x) => [
|
|
26236
26640
|
down32(down32(down32(a * x) + down32(c * y)) + e),
|
|
26237
|
-
down32(down32(down32(b * x) + down32(d * y)) +
|
|
26641
|
+
down32(down32(down32(b * x) + down32(d * y)) + f2)
|
|
26238
26642
|
];
|
|
26239
26643
|
const [us0, vs0] = at(x0);
|
|
26240
26644
|
const [us1, vs1] = at(x0 + count);
|
|
@@ -26301,16 +26705,16 @@ function addDown(a, b) {
|
|
|
26301
26705
|
const r = down32(s);
|
|
26302
26706
|
return Math.fround(s) === s && err < 0 ? prevF322(s) : r;
|
|
26303
26707
|
}
|
|
26304
|
-
var
|
|
26305
|
-
var
|
|
26306
|
-
function
|
|
26708
|
+
var sub3 = (a, b) => addDown(a, -b);
|
|
26709
|
+
var mul4 = (a, b) => down32(a * b);
|
|
26710
|
+
function div3(a, b) {
|
|
26307
26711
|
let c = down32(a / b);
|
|
26308
26712
|
if (b > 0 ? c * b > a : c * b < a) c = prevF322(c);
|
|
26309
26713
|
return c;
|
|
26310
26714
|
}
|
|
26311
26715
|
var COMPLEXITY_TOLERANCE = 596046448e-12;
|
|
26312
26716
|
function matrixComplexity(m) {
|
|
26313
|
-
const [a, b, c, d, e,
|
|
26717
|
+
const [a, b, c, d, e, f2] = m;
|
|
26314
26718
|
const absA = Math.abs(a);
|
|
26315
26719
|
const absD = Math.abs(d);
|
|
26316
26720
|
const absB = Math.abs(b);
|
|
@@ -26324,11 +26728,11 @@ function matrixComplexity(m) {
|
|
|
26324
26728
|
let flags = 15;
|
|
26325
26729
|
if (tolerance > absB && tolerance > absC) {
|
|
26326
26730
|
flags = 3;
|
|
26327
|
-
if (COMPLEXITY_TOLERANCE > Math.abs(
|
|
26328
|
-
} else if (tolerance > Math.abs(
|
|
26329
|
-
flags = COMPLEXITY_TOLERANCE > Math.abs(
|
|
26731
|
+
if (COMPLEXITY_TOLERANCE > Math.abs(sub3(a, 1)) && COMPLEXITY_TOLERANCE > Math.abs(sub3(d, 1))) flags = 1;
|
|
26732
|
+
} else if (tolerance > Math.abs(sub3(a, d)) && tolerance > Math.abs(addDown(c, b))) {
|
|
26733
|
+
flags = COMPLEXITY_TOLERANCE > Math.abs(sub3(addDown(mul4(b, b), mul4(a, a)), 1)) ? 5 : 7;
|
|
26330
26734
|
}
|
|
26331
|
-
if (e === 0 &&
|
|
26735
|
+
if (e === 0 && f2 === 0) flags &= -2;
|
|
26332
26736
|
return flags;
|
|
26333
26737
|
}
|
|
26334
26738
|
function inferPointsMatrix(points, src) {
|
|
@@ -26336,32 +26740,32 @@ function inferPointsMatrix(points, src) {
|
|
|
26336
26740
|
const [x, y, w, h] = src;
|
|
26337
26741
|
const nh = -h;
|
|
26338
26742
|
const nw = -w;
|
|
26339
|
-
const product =
|
|
26340
|
-
const det = addDown(product,
|
|
26743
|
+
const product = sub3(mul4(addDown(w, x), addDown(y, h)), mul4(y, x));
|
|
26744
|
+
const det = addDown(product, sub3(mul4(nh, x), mul4(y, w)));
|
|
26341
26745
|
if (!(Math.abs(det) >= 11920929e-14)) return null;
|
|
26342
|
-
const r =
|
|
26343
|
-
const a =
|
|
26344
|
-
const b =
|
|
26345
|
-
const c =
|
|
26346
|
-
const d =
|
|
26347
|
-
const nxh =
|
|
26348
|
-
const nyw =
|
|
26349
|
-
const p =
|
|
26350
|
-
const e =
|
|
26351
|
-
const
|
|
26352
|
-
return [a, b, c, d, e,
|
|
26746
|
+
const r = div3(1, det);
|
|
26747
|
+
const a = mul4(addDown(mul4(h, x1), mul4(nh, x0)), r);
|
|
26748
|
+
const b = mul4(addDown(mul4(h, y1), mul4(nh, y0)), r);
|
|
26749
|
+
const c = mul4(addDown(mul4(w, x2), mul4(nw, x0)), r);
|
|
26750
|
+
const d = mul4(addDown(mul4(w, y2), mul4(nw, y0)), r);
|
|
26751
|
+
const nxh = mul4(-x, h);
|
|
26752
|
+
const nyw = mul4(-y, w);
|
|
26753
|
+
const p = sub3(mul4(addDown(x, w), addDown(y, h)), mul4(x, y));
|
|
26754
|
+
const e = mul4(addDown(addDown(mul4(nxh, x1), mul4(p, x0)), mul4(nyw, x2)), r);
|
|
26755
|
+
const f2 = mul4(addDown(addDown(mul4(nxh, y1), mul4(p, y0)), mul4(nyw, y2)), r);
|
|
26756
|
+
return [a, b, c, d, e, f2];
|
|
26353
26757
|
}
|
|
26354
26758
|
function transformPoints(m, pts) {
|
|
26355
26759
|
const complexity = matrixComplexity(m);
|
|
26356
|
-
const [a, b, c, d, e,
|
|
26760
|
+
const [a, b, c, d, e, f2] = m;
|
|
26357
26761
|
const out = [];
|
|
26358
26762
|
for (let i = 0; i < pts.length; i += 2) {
|
|
26359
26763
|
const x = pts[i];
|
|
26360
26764
|
const y = pts[i + 1];
|
|
26361
26765
|
if (complexity === 0) out.push(x, y);
|
|
26362
|
-
else if ((complexity & -2) === 0) out.push(addDown(e, x), addDown(
|
|
26363
|
-
else if ((complexity & -4) === 0) out.push(addDown(
|
|
26364
|
-
else out.push(addDown(addDown(
|
|
26766
|
+
else if ((complexity & -2) === 0) out.push(addDown(e, x), addDown(f2, y));
|
|
26767
|
+
else if ((complexity & -4) === 0) out.push(addDown(mul4(a, x), e), addDown(mul4(d, y), f2));
|
|
26768
|
+
else out.push(addDown(addDown(mul4(x, a), mul4(y, c)), e), addDown(addDown(mul4(x, b), mul4(y, d)), f2));
|
|
26365
26769
|
}
|
|
26366
26770
|
return out;
|
|
26367
26771
|
}
|
|
@@ -26372,15 +26776,15 @@ function driverPoints(points, src) {
|
|
|
26372
26776
|
return transformPoints(m, [x, y, addDown(x, w), y, x, addDown(y, h)]);
|
|
26373
26777
|
}
|
|
26374
26778
|
function multiplyDown(n, w) {
|
|
26375
|
-
const [a, b, c, d, e,
|
|
26779
|
+
const [a, b, c, d, e, f2] = n;
|
|
26376
26780
|
const [wa, wb, wc, wd, we, wf] = w;
|
|
26377
26781
|
return [
|
|
26378
|
-
addDown(
|
|
26379
|
-
addDown(
|
|
26380
|
-
addDown(
|
|
26381
|
-
addDown(
|
|
26382
|
-
addDown(addDown(
|
|
26383
|
-
addDown(addDown(
|
|
26782
|
+
addDown(mul4(a, wa), mul4(b, wc)),
|
|
26783
|
+
addDown(mul4(a, wb), mul4(b, wd)),
|
|
26784
|
+
addDown(mul4(c, wa), mul4(d, wc)),
|
|
26785
|
+
addDown(mul4(c, wb), mul4(d, wd)),
|
|
26786
|
+
addDown(addDown(mul4(e, wa), mul4(f2, wc)), we),
|
|
26787
|
+
addDown(addDown(mul4(e, wb), mul4(f2, wd)), wf)
|
|
26384
26788
|
];
|
|
26385
26789
|
}
|
|
26386
26790
|
function drawImagePointsDeviceMatrix(points, src, world) {
|
|
@@ -26390,32 +26794,32 @@ function drawImagePointsDeviceMatrix(points, src, world) {
|
|
|
26390
26794
|
return n ? multiplyDown(n, world) : null;
|
|
26391
26795
|
}
|
|
26392
26796
|
function invertDown(m) {
|
|
26393
|
-
const [a, b, c, d, e,
|
|
26394
|
-
const det =
|
|
26797
|
+
const [a, b, c, d, e, f2] = m;
|
|
26798
|
+
const det = sub3(mul4(a, d), mul4(b, c));
|
|
26395
26799
|
if (!Number.isFinite(det) || det === 0) return null;
|
|
26396
|
-
const r =
|
|
26800
|
+
const r = div3(1, det);
|
|
26397
26801
|
return [
|
|
26398
|
-
|
|
26399
|
-
|
|
26400
|
-
|
|
26401
|
-
|
|
26402
|
-
|
|
26403
|
-
|
|
26802
|
+
mul4(d, r),
|
|
26803
|
+
mul4(-b, r),
|
|
26804
|
+
mul4(-c, r),
|
|
26805
|
+
mul4(a, r),
|
|
26806
|
+
mul4(sub3(mul4(c, f2), mul4(d, e)), r),
|
|
26807
|
+
mul4(sub3(mul4(b, e), mul4(a, f2)), r)
|
|
26404
26808
|
];
|
|
26405
26809
|
}
|
|
26406
26810
|
function spanPositions(inv3, x0, y, n, us, vs) {
|
|
26407
|
-
const [a, b, c, d, e,
|
|
26811
|
+
const [a, b, c, d, e, f2] = inv3;
|
|
26408
26812
|
const complexity = matrixComplexity(inv3);
|
|
26409
26813
|
const at = (x) => {
|
|
26410
26814
|
if (complexity === 0) return [x, y];
|
|
26411
|
-
if ((complexity & -2) === 0) return [addDown(x, e), addDown(y,
|
|
26412
|
-
if ((complexity & -4) === 0) return [addDown(
|
|
26413
|
-
return [addDown(addDown(
|
|
26815
|
+
if ((complexity & -2) === 0) return [addDown(x, e), addDown(y, f2)];
|
|
26816
|
+
if ((complexity & -4) === 0) return [addDown(mul4(x, a), e), addDown(mul4(y, d), f2)];
|
|
26817
|
+
return [addDown(addDown(mul4(a, x), mul4(c, y)), e), addDown(addDown(mul4(b, x), mul4(d, y)), f2)];
|
|
26414
26818
|
};
|
|
26415
26819
|
const [u0, v0] = at(x0);
|
|
26416
26820
|
const [u1, v1] = at(x0 + n);
|
|
26417
|
-
const su =
|
|
26418
|
-
const sv =
|
|
26821
|
+
const su = div3(sub3(u1, u0), n);
|
|
26822
|
+
const sv = div3(sub3(v1, v0), n);
|
|
26419
26823
|
let u = u0;
|
|
26420
26824
|
let v = v0;
|
|
26421
26825
|
for (let i = 0; i < n; i++) {
|
|
@@ -26425,6 +26829,62 @@ function spanPositions(inv3, x0, y, n, us, vs) {
|
|
|
26425
26829
|
v = addDown(v, sv);
|
|
26426
26830
|
}
|
|
26427
26831
|
}
|
|
26832
|
+
function bicubicSpanPositions(inv3, x0, y, n, us, vs) {
|
|
26833
|
+
const [a, b, c, d, e, f2] = inv3;
|
|
26834
|
+
const complexity = matrixComplexity(inv3);
|
|
26835
|
+
const at = (x) => {
|
|
26836
|
+
if (complexity === 0) return [x, y];
|
|
26837
|
+
if ((complexity & -2) === 0) return [addDown(x, e), addDown(y, f2)];
|
|
26838
|
+
if ((complexity & -4) === 0) return [addDown(mul4(x, a), e), addDown(mul4(y, d), f2)];
|
|
26839
|
+
return [addDown(addDown(mul4(a, x), mul4(c, y)), e), addDown(addDown(mul4(b, x), mul4(d, y)), f2)];
|
|
26840
|
+
};
|
|
26841
|
+
const [u0, v0] = at(x0);
|
|
26842
|
+
const [u1, v1] = at(x0 + n);
|
|
26843
|
+
const fix = (p) => {
|
|
26844
|
+
const r = Math.floor(addDown(mul4(p, 65536), 0.5));
|
|
26845
|
+
return r >= -2147483648 && r <= 2147483647 ? r : -2147483648;
|
|
26846
|
+
};
|
|
26847
|
+
const stepOf = (p0, p1) => fix2(div3(mul4(sub3(p1, p0), 65536), n));
|
|
26848
|
+
const fix2 = (q) => {
|
|
26849
|
+
const r = Math.floor(addDown(q, 0.5));
|
|
26850
|
+
return r >= -2147483648 && r <= 2147483647 ? r : -2147483648;
|
|
26851
|
+
};
|
|
26852
|
+
let u = fix(u0);
|
|
26853
|
+
let v = fix(v0);
|
|
26854
|
+
const su = stepOf(u0, u1);
|
|
26855
|
+
const sv = stepOf(v0, v1);
|
|
26856
|
+
for (let i = 0; i < n; i++) {
|
|
26857
|
+
us[i] = u;
|
|
26858
|
+
vs[i] = v;
|
|
26859
|
+
u = u + su | 0;
|
|
26860
|
+
v = v + sv | 0;
|
|
26861
|
+
}
|
|
26862
|
+
}
|
|
26863
|
+
function rectFormPoints(src, dest) {
|
|
26864
|
+
const [sx, sy, sw, sh] = src.map(Math.fround);
|
|
26865
|
+
const [dx, dy, dw, dh] = dest.map(Math.fround);
|
|
26866
|
+
const sxr = addDown(sx, sw);
|
|
26867
|
+
const syb = addDown(sy, sh);
|
|
26868
|
+
const dxr = addDown(dx, dw);
|
|
26869
|
+
const dyb = addDown(dy, dh);
|
|
26870
|
+
if (sx === sxr || sy === syb) return null;
|
|
26871
|
+
const m11 = div3(sub3(dxr, dx), sub3(sxr, sx));
|
|
26872
|
+
const m22 = div3(sub3(dyb, dy), sub3(syb, sy));
|
|
26873
|
+
const e = sub3(dxr, mul4(m11, sxr));
|
|
26874
|
+
const f2 = sub3(dyb, mul4(m22, syb));
|
|
26875
|
+
return transformPoints([m11, 0, 0, m22, e, f2], [sx, sy, sxr, sy, sx, syb]);
|
|
26876
|
+
}
|
|
26877
|
+
function deviceDestRect(device, src) {
|
|
26878
|
+
const [sx, sy, sw, sh] = src.map(Math.fround);
|
|
26879
|
+
const p = transformPoints(device, [sx, sy, addDown(sx, sw), addDown(sy, sh)]);
|
|
26880
|
+
return [p[0], p[1], sub3(p[2], p[0]), sub3(p[3], p[1])];
|
|
26881
|
+
}
|
|
26882
|
+
function rectFormDeviceMatrix(src, dest, world) {
|
|
26883
|
+
const pts = rectFormPoints(src, dest);
|
|
26884
|
+
if (!pts) return null;
|
|
26885
|
+
const n = inferPointsMatrix(pts, src);
|
|
26886
|
+
return n ? multiplyDown(n, world) : null;
|
|
26887
|
+
}
|
|
26428
26888
|
|
|
26429
26889
|
// src/emf-plus-hq-cubic-weights.ts
|
|
26430
26890
|
var HQ_CUBIC_HALF_TABLE = [
|
|
@@ -26526,6 +26986,270 @@ function hqCubicCdf(m) {
|
|
|
26526
26986
|
return HQ_CUBIC_CDF[m + 256];
|
|
26527
26987
|
}
|
|
26528
26988
|
|
|
26989
|
+
// src/gdiplus-span-stretch.ts
|
|
26990
|
+
var TWO_POW_M16 = 1 / 65536;
|
|
26991
|
+
function tentTable(n) {
|
|
26992
|
+
if (n <= -128) return 0;
|
|
26993
|
+
if (n >= 128) return 65536;
|
|
26994
|
+
return 32768 + (n < 0 ? -(512 * -n - 2 * n * n) : 512 * n - 2 * n * n);
|
|
26995
|
+
}
|
|
26996
|
+
function cubicTable(n) {
|
|
26997
|
+
if (n < -256) return 0;
|
|
26998
|
+
if (n > 255) return 65536;
|
|
26999
|
+
return 32768 + hqCubicCdf(n);
|
|
27000
|
+
}
|
|
27001
|
+
var i32 = (v) => v | 0;
|
|
27002
|
+
var mulShift16 = (a, b) => Math.floor(a * b / 65536);
|
|
27003
|
+
function validFixed16(v) {
|
|
27004
|
+
return v >= -32768 && v <= 32767;
|
|
27005
|
+
}
|
|
27006
|
+
function createStretch(request) {
|
|
27007
|
+
const [sx, sy, sw, sh] = request.src.map(Math.fround);
|
|
27008
|
+
const [dx, dy, dw, dh] = request.dest.map(Math.fround);
|
|
27009
|
+
if (![sx, sy, sw, sh, dx, dy, dw, dh].every(validFixed16)) return null;
|
|
27010
|
+
const kScale = request.kernel === "cubic" ? 2 : 1;
|
|
27011
|
+
const minStretch = request.kernel === "cubic" ? 131072 : 65536;
|
|
27012
|
+
const half = 0.5;
|
|
27013
|
+
const fix = (v2) => floorInt(add(mul(v2, 65536), half));
|
|
27014
|
+
const xStepS = fix(div(sw, dw));
|
|
27015
|
+
fix(div(dw, sw));
|
|
27016
|
+
const yStepS = fix(div(sh, dh));
|
|
27017
|
+
fix(div(dh, sh));
|
|
27018
|
+
if (xStepS === 0 || yStepS === 0) return null;
|
|
27019
|
+
const grid = (v2) => floorInt(add(mul(v2, 16), half));
|
|
27020
|
+
const left = grid(dx);
|
|
27021
|
+
const right = grid(add(mul(sw, div(dw, sw)), dx));
|
|
27022
|
+
const top = grid(dy);
|
|
27023
|
+
const bottom = grid(add(mul(sh, div(dh, sh)), dy));
|
|
27024
|
+
const lo = Math.min(left, right);
|
|
27025
|
+
const hi = Math.max(left, right);
|
|
27026
|
+
const topLo = Math.min(top, bottom);
|
|
27027
|
+
const botHi = Math.max(top, bottom);
|
|
27028
|
+
const firstColumn = lo + 15 >> 4;
|
|
27029
|
+
const loFix = i32(lo << 12);
|
|
27030
|
+
const hiFix = i32(hi << 12);
|
|
27031
|
+
const topFix = i32(topLo << 12);
|
|
27032
|
+
const botFix = i32(botHi << 12);
|
|
27033
|
+
const floatOf = (v2) => down32(v2);
|
|
27034
|
+
const sxF = floatOf(xStepS);
|
|
27035
|
+
let xBase;
|
|
27036
|
+
let xEdge;
|
|
27037
|
+
if (xStepS < 0) {
|
|
27038
|
+
xBase = floatOf(hiFix + 65535 >> 16);
|
|
27039
|
+
xEdge = add(dx, dw);
|
|
27040
|
+
} else {
|
|
27041
|
+
xBase = floatOf(loFix >> 16);
|
|
27042
|
+
xEdge = dx;
|
|
27043
|
+
}
|
|
27044
|
+
let v = sub(xEdge, xBase);
|
|
27045
|
+
v = mul(v, sxF);
|
|
27046
|
+
v = mul(v, TWO_POW_M16);
|
|
27047
|
+
v = add(v, sx);
|
|
27048
|
+
const xStart = fix(v);
|
|
27049
|
+
const stretchOf = (s, d) => {
|
|
27050
|
+
let r = fix(div(mul(kScale, s), d));
|
|
27051
|
+
if (r < 0) r = -r;
|
|
27052
|
+
return r < minStretch ? minStretch : r;
|
|
27053
|
+
};
|
|
27054
|
+
const xStretch = stretchOf(sw, dw);
|
|
27055
|
+
const xRecip = floorInt(add(mul(div(65536, floatOf(xStretch)), 65536), half));
|
|
27056
|
+
const syF = floatOf(yStepS);
|
|
27057
|
+
let yStart;
|
|
27058
|
+
if (yStepS < 0) {
|
|
27059
|
+
let w = floatOf(botFix + 65535 >> 16);
|
|
27060
|
+
w = sub(w, add(dh, dy));
|
|
27061
|
+
w = mul(w, syF);
|
|
27062
|
+
w = mul(w, TWO_POW_M16);
|
|
27063
|
+
yStart = fix(sub(sy, w));
|
|
27064
|
+
} else {
|
|
27065
|
+
let w = floatOf(topFix >> 16);
|
|
27066
|
+
w = sub(w, dy);
|
|
27067
|
+
w = mul(w, syF);
|
|
27068
|
+
w = mul(w, TWO_POW_M16);
|
|
27069
|
+
yStart = fix(add(w, sy));
|
|
27070
|
+
}
|
|
27071
|
+
const yStretch = stretchOf(sh, dh);
|
|
27072
|
+
const yRecip = floorInt(add(mul(div(65536, floatOf(yStretch)), 65536), half));
|
|
27073
|
+
const firstRow = topFix >> 16;
|
|
27074
|
+
const columns = (hiFix + 65535 >> 16) - (loFix >> 16) + 1;
|
|
27075
|
+
const kernelRows = 2 * (yStretch + 65535 >> 16) + 1;
|
|
27076
|
+
const range = (stretch, start) => {
|
|
27077
|
+
const r = start - 32768;
|
|
27078
|
+
return r >= -2147483648 && r <= 2147483647 && r - stretch >= -2147483648 && r + stretch <= 2147483647;
|
|
27079
|
+
};
|
|
27080
|
+
if (!range(xStretch, xStart) || !range(yStretch, yStart)) return null;
|
|
27081
|
+
return {
|
|
27082
|
+
request,
|
|
27083
|
+
firstColumn,
|
|
27084
|
+
columns,
|
|
27085
|
+
firstRow,
|
|
27086
|
+
xStart,
|
|
27087
|
+
xStep: xStepS,
|
|
27088
|
+
xStretch,
|
|
27089
|
+
xRecip,
|
|
27090
|
+
yStart,
|
|
27091
|
+
yStep: yStepS,
|
|
27092
|
+
yStretch,
|
|
27093
|
+
yRecip,
|
|
27094
|
+
kernelRows,
|
|
27095
|
+
table: request.kernel === "cubic" ? cubicTable : tentTable,
|
|
27096
|
+
shift: request.kernel === "cubic" ? 8 : 9,
|
|
27097
|
+
rows: /* @__PURE__ */ new Map()
|
|
27098
|
+
};
|
|
27099
|
+
}
|
|
27100
|
+
function wrapIndex2(index, size, mirror2) {
|
|
27101
|
+
if (!mirror2) {
|
|
27102
|
+
return (index % size + size) % size;
|
|
27103
|
+
}
|
|
27104
|
+
const q = (index % size + size) % size;
|
|
27105
|
+
return Math.floor(index / size) % 2 !== 0 ? size - q - 1 : q;
|
|
27106
|
+
}
|
|
27107
|
+
function clampBytes(argb) {
|
|
27108
|
+
return [argb >>> 16 & 255, argb >>> 8 & 255, argb & 255, argb >>> 24];
|
|
27109
|
+
}
|
|
27110
|
+
function stretchRow(state, rowPixels) {
|
|
27111
|
+
const { request, columns, xStart, xStep, xStretch, xRecip, table: table2, shift } = state;
|
|
27112
|
+
const { width, wrap = 4, clampArgb = 0 } = request;
|
|
27113
|
+
const cubic = request.kernel === "cubic";
|
|
27114
|
+
const out = new Uint8Array(columns * 4);
|
|
27115
|
+
const clamp2 = clampBytes(clampArgb);
|
|
27116
|
+
const mirrorX = wrap === 1 || wrap === 3;
|
|
27117
|
+
let pos = i32(xStart - 32768);
|
|
27118
|
+
const sum = [0, 0, 0, 0];
|
|
27119
|
+
for (let c = 0; c < columns; c++) {
|
|
27120
|
+
const edx = i32(xStretch + 65535 + pos);
|
|
27121
|
+
const last = edx >> 16;
|
|
27122
|
+
const first = i32(edx - 2 * xStretch) >> 16;
|
|
27123
|
+
sum[0] = sum[1] = sum[2] = sum[3] = 0;
|
|
27124
|
+
let prev = 0;
|
|
27125
|
+
const accumulate = (idx2, pixel, o2) => {
|
|
27126
|
+
const t = table2(i32(idx2) >> shift);
|
|
27127
|
+
const wgt = t - prev;
|
|
27128
|
+
prev = t;
|
|
27129
|
+
sum[0] += pixel[o2] * wgt;
|
|
27130
|
+
sum[1] += pixel[o2 + 1] * wgt;
|
|
27131
|
+
sum[2] += pixel[o2 + 2] * wgt;
|
|
27132
|
+
sum[3] += pixel[o2 + 3] * wgt;
|
|
27133
|
+
};
|
|
27134
|
+
const startOf = (col) => mulShift16(i32(i32(col << 16) - pos), xRecip);
|
|
27135
|
+
const inFirst = first < 0 ? 0 : first;
|
|
27136
|
+
const inLast = last < width - 1 ? last : width - 1;
|
|
27137
|
+
let idx = startOf(first);
|
|
27138
|
+
for (let t = first; t < Math.min(inFirst, last + 1); t++) {
|
|
27139
|
+
if (wrap === 4 || !rowPixels) accumulate(idx, clamp2, 0);
|
|
27140
|
+
else accumulate(idx, rowPixels, wrapIndex2(t, width, mirrorX) * 4);
|
|
27141
|
+
idx = i32(idx + xRecip);
|
|
27142
|
+
}
|
|
27143
|
+
if (inFirst <= inLast) {
|
|
27144
|
+
idx = startOf(inFirst);
|
|
27145
|
+
for (let t = inFirst; t <= inLast; t++) {
|
|
27146
|
+
if (rowPixels) accumulate(idx, rowPixels, t * 4);
|
|
27147
|
+
else accumulate(idx, clamp2, 0);
|
|
27148
|
+
idx = i32(idx + xRecip);
|
|
27149
|
+
}
|
|
27150
|
+
}
|
|
27151
|
+
const rightFirst = Math.max(inLast + 1, first);
|
|
27152
|
+
if (rightFirst <= last) {
|
|
27153
|
+
idx = startOf(rightFirst);
|
|
27154
|
+
for (let t = rightFirst; t <= last; t++) {
|
|
27155
|
+
if (wrap === 4 || !rowPixels) accumulate(idx, clamp2, 0);
|
|
27156
|
+
else accumulate(idx, rowPixels, wrapIndex2(t, width, mirrorX) * 4);
|
|
27157
|
+
idx = i32(idx + xRecip);
|
|
27158
|
+
}
|
|
27159
|
+
}
|
|
27160
|
+
const o = c * 4;
|
|
27161
|
+
const a = Math.max(0, Math.min(255, sum[3] + 32768 >> 16));
|
|
27162
|
+
out[o + 3] = a;
|
|
27163
|
+
for (let ch = 0; ch < 3; ch++) {
|
|
27164
|
+
const v = sum[ch] + 32768 >> 16;
|
|
27165
|
+
out[o + ch] = cubic ? Math.max(0, Math.min(a, v)) : Math.min(255, v);
|
|
27166
|
+
}
|
|
27167
|
+
pos = i32(pos + xStep);
|
|
27168
|
+
}
|
|
27169
|
+
return out;
|
|
27170
|
+
}
|
|
27171
|
+
function stretchedRow(state, row2) {
|
|
27172
|
+
const { request } = state;
|
|
27173
|
+
const { height, width, wrap = 4 } = request;
|
|
27174
|
+
let r = row2;
|
|
27175
|
+
if (r < 0 || r >= height) {
|
|
27176
|
+
if (wrap === 4) {
|
|
27177
|
+
return null;
|
|
27178
|
+
}
|
|
27179
|
+
r = wrapIndex2(r, height, wrap === 2 || wrap === 3);
|
|
27180
|
+
}
|
|
27181
|
+
let cached = state.rows.get(r);
|
|
27182
|
+
if (!cached) {
|
|
27183
|
+
const pixels = request.pixels instanceof Uint8Array || request.pixels instanceof Uint8ClampedArray ? request.pixels.subarray(r * width * 4, (r + 1) * width * 4) : Uint8Array.from(Array.prototype.slice.call(request.pixels, r * width * 4, (r + 1) * width * 4));
|
|
27184
|
+
cached = stretchRow(state, pixels);
|
|
27185
|
+
state.rows.set(r, cached);
|
|
27186
|
+
}
|
|
27187
|
+
return cached;
|
|
27188
|
+
}
|
|
27189
|
+
function clampRow(state) {
|
|
27190
|
+
let cached = state.rows.get(Number.NaN);
|
|
27191
|
+
if (!cached) {
|
|
27192
|
+
cached = stretchRow(state, null);
|
|
27193
|
+
state.rows.set(Number.NaN, cached);
|
|
27194
|
+
}
|
|
27195
|
+
return cached;
|
|
27196
|
+
}
|
|
27197
|
+
function stretchRun(state, y, xLeft, xRight) {
|
|
27198
|
+
const { firstColumn, columns, firstRow, yStart, yStep, yStretch, yRecip, kernelRows, table: table2, shift } = state;
|
|
27199
|
+
const xs = Math.max(xLeft, firstColumn);
|
|
27200
|
+
const xe = Math.min(xRight, firstColumn + columns);
|
|
27201
|
+
if (xe < xs || xe - xs > columns) return null;
|
|
27202
|
+
const n = xe - xs;
|
|
27203
|
+
const row2 = Math.max(y, firstRow);
|
|
27204
|
+
const pos = i32(yStart - 32768 + i32((row2 - firstRow) * yStep));
|
|
27205
|
+
const lastSource = i32(pos + yStretch + 65535) >> 16;
|
|
27206
|
+
const firstSource = i32(pos - yStretch + 65535) >> 16;
|
|
27207
|
+
if (lastSource < firstSource) return null;
|
|
27208
|
+
let idx = mulShift16(i32(i32(firstSource << 16) - pos), yRecip);
|
|
27209
|
+
let prev = 0;
|
|
27210
|
+
const sources = [];
|
|
27211
|
+
const weights = [];
|
|
27212
|
+
for (let k = 0; k < kernelRows; k++) {
|
|
27213
|
+
const source = firstSource + k;
|
|
27214
|
+
if (source > lastSource) {
|
|
27215
|
+
weights.push(0);
|
|
27216
|
+
sources.push(null);
|
|
27217
|
+
continue;
|
|
27218
|
+
}
|
|
27219
|
+
const t = table2(i32(idx) >> shift);
|
|
27220
|
+
weights.push(t - prev);
|
|
27221
|
+
prev = t;
|
|
27222
|
+
idx = i32(idx + yRecip);
|
|
27223
|
+
sources.push(source >= 0 && source < state.request.height ? stretchedRow(state, source) : state.request.wrap === 4 || state.request.wrap === void 0 ? clampRow(state) : stretchedRow(state, source));
|
|
27224
|
+
}
|
|
27225
|
+
const cubic = state.request.kernel === "cubic";
|
|
27226
|
+
const pixels = new Uint8Array(n * 4);
|
|
27227
|
+
for (let i = 0; i < n; i++) {
|
|
27228
|
+
const col = (xs - firstColumn + i) * 4;
|
|
27229
|
+
let r = 0;
|
|
27230
|
+
let g = 0;
|
|
27231
|
+
let b = 0;
|
|
27232
|
+
let a = 0;
|
|
27233
|
+
for (let k = 0; k < kernelRows; k++) {
|
|
27234
|
+
const src = sources[k];
|
|
27235
|
+
if (!src) continue;
|
|
27236
|
+
const wgt = weights[k];
|
|
27237
|
+
r += src[col] * wgt;
|
|
27238
|
+
g += src[col + 1] * wgt;
|
|
27239
|
+
b += src[col + 2] * wgt;
|
|
27240
|
+
a += src[col + 3] * wgt;
|
|
27241
|
+
}
|
|
27242
|
+
const o = i * 4;
|
|
27243
|
+
const alpha = Math.max(0, Math.min(255, a + 32768 >> 16));
|
|
27244
|
+
pixels[o + 3] = alpha;
|
|
27245
|
+
for (const [ch, v] of [[0, r], [1, g], [2, b]]) {
|
|
27246
|
+
const q = v + 32768 >> 16;
|
|
27247
|
+
pixels[o + ch] = cubic ? Math.max(0, Math.min(alpha, q)) : Math.min(255, q);
|
|
27248
|
+
}
|
|
27249
|
+
}
|
|
27250
|
+
return { x: xs, pixels };
|
|
27251
|
+
}
|
|
27252
|
+
|
|
26529
27253
|
// src/emf-plus-image-resample.ts
|
|
26530
27254
|
var INTERPOLATION_KERNELS = {
|
|
26531
27255
|
0: "bilinear",
|
|
@@ -26627,11 +27351,11 @@ function nearSourceExtent(deviceLen, srcLen) {
|
|
|
26627
27351
|
return d >= -1 && d <= 1;
|
|
26628
27352
|
}
|
|
26629
27353
|
function unitCopyOffset(t, other, spec) {
|
|
26630
|
-
const
|
|
26631
|
-
if (
|
|
26632
|
-
return
|
|
27354
|
+
const f2 = t - Math.round(t);
|
|
27355
|
+
if (f2 > -1 / 64 + 1e-9) {
|
|
27356
|
+
return f2 <= 1 / 64 + 1e-9;
|
|
26633
27357
|
}
|
|
26634
|
-
if (Math.abs(
|
|
27358
|
+
if (Math.abs(f2 + 1 / 64) > 1e-9 || !isPowerOfTwo(spec.srcW) || !isPowerOfTwo(spec.srcH)) {
|
|
26635
27359
|
return false;
|
|
26636
27360
|
}
|
|
26637
27361
|
const g = (other - Math.round(other)) * 128;
|
|
@@ -26749,11 +27473,11 @@ function wrapTap(t, lo, hi, mirror2, edge) {
|
|
|
26749
27473
|
return lo + (q < n ? q : 2 * n - 1 - q);
|
|
26750
27474
|
}
|
|
26751
27475
|
function mirroredOrigin(o) {
|
|
26752
|
-
const
|
|
26753
|
-
return
|
|
27476
|
+
const f2 = o - Math.floor(o);
|
|
27477
|
+
return f2 === 0 ? o : Math.floor(o) + 1 - f2;
|
|
26754
27478
|
}
|
|
26755
27479
|
function resampleImage(rgba, width, height, spec, surface, options2 = {}) {
|
|
26756
|
-
const { plainRotated: plainRotatedPass = false, keepOrigin = false, premultSource = false, premultOut = false } = typeof options2 === "boolean" ? { plainRotated: options2 } : options2;
|
|
27480
|
+
const { plainRotated: plainRotatedPass = false, keepOrigin = false, premultSource = false, premultOut = false, rasterQuad, rasterHalf = false, chainPad = 0 } = typeof options2 === "boolean" ? { plainRotated: options2 } : options2;
|
|
26757
27481
|
if (spec.rightHalo && spec.rightHalo.length === height * 4) {
|
|
26758
27482
|
const grown = new Uint8ClampedArray((width + 1) * height * 4);
|
|
26759
27483
|
for (let y = 0; y < height; y++) {
|
|
@@ -26836,7 +27560,7 @@ function resampleImage(rgba, width, height, spec, surface, options2 = {}) {
|
|
|
26836
27560
|
if (!(w > 0 && h > 0) || w * h > MAX_RESAMPLE_PIXELS) {
|
|
26837
27561
|
return null;
|
|
26838
27562
|
}
|
|
26839
|
-
const rasterCoverage = rasterCovered ? rasterizePlusFill(
|
|
27563
|
+
const rasterCoverage = rasterQuad ? rasterizePlusFill([rasterQuad], false, false, rasterHalf, { x: bx0, y: by0, w, h }) : rasterCovered ? rasterizePlusFill(
|
|
26840
27564
|
[[
|
|
26841
27565
|
[spec.srcX, spec.srcY],
|
|
26842
27566
|
[spec.srcX + spec.srcW, spec.srcY],
|
|
@@ -26876,12 +27600,18 @@ function resampleImage(rgba, width, height, spec, surface, options2 = {}) {
|
|
|
26876
27600
|
const bicubicDv = Math.round(inv3[1] * FIX16);
|
|
26877
27601
|
const steppedInv = !plainRotatedPass && (kernel === "bilinear" || kernel === "bicubic" && !axisAligned) ? invertTextureMatrix(m) : null;
|
|
26878
27602
|
let exactInv = null;
|
|
26879
|
-
if (steppedInv && spec.pointsForm && spec.worldPoints && spec.worldMatrix && kernel === "bilinear"
|
|
26880
|
-
const device = drawImagePointsDeviceMatrix(spec.worldPoints, [spec.srcX, spec.srcY, spec.srcW, spec.srcH], spec.worldMatrix);
|
|
27603
|
+
if ((steppedInv || plainRotatedPass) && spec.pointsForm && spec.worldPoints && spec.worldMatrix && (kernel === "bilinear" || kernel === "bicubic") && !spec.halfPixelOffset && !spec.chainHalf && !spec.wrap) {
|
|
27604
|
+
const device = drawImagePointsDeviceMatrix(spec.worldPoints, spec.chainSrc ?? [spec.srcX, spec.srcY, spec.srcW, spec.srcH], spec.worldMatrix);
|
|
27605
|
+
exactInv = device && invertDown(device);
|
|
27606
|
+
} else if (plainRotatedPass && spec.chainHalf && spec.pointsForm && spec.worldPoints && spec.worldMatrix && spec.chainSrc && (kernel === "bilinear" || kernel === "bicubic")) {
|
|
27607
|
+
const w2 = spec.worldMatrix;
|
|
27608
|
+
const device = drawImagePointsDeviceMatrix(spec.worldPoints, spec.chainSrc, [w2[0], w2[1], w2[2], w2[3], down32(w2[4] - 0.5), down32(w2[5] - 0.5)]);
|
|
26881
27609
|
exactInv = device && invertDown(device);
|
|
26882
27610
|
}
|
|
26883
27611
|
const runU = new Float64Array(w);
|
|
26884
27612
|
const runV = new Float64Array(w);
|
|
27613
|
+
const fixU = new Int32Array(w);
|
|
27614
|
+
const fixV = new Int32Array(w);
|
|
26885
27615
|
let runBase = 0;
|
|
26886
27616
|
const covers = (px, py) => {
|
|
26887
27617
|
const cx = px + COVERAGE_NUDGE_X;
|
|
@@ -26920,10 +27650,19 @@ function resampleImage(rgba, width, height, spec, surface, options2 = {}) {
|
|
|
26920
27650
|
while (end < w && (rasterCoverage ? rasterCoverage[j * w + end] !== 0 : covers(bx0 + end + o, py))) {
|
|
26921
27651
|
end++;
|
|
26922
27652
|
}
|
|
26923
|
-
|
|
27653
|
+
if (integerBicubic) {
|
|
27654
|
+
bicubicSpanPositions(exactInv, bx0 + i, by0 + j, end - i, fixU, fixV);
|
|
27655
|
+
} else {
|
|
27656
|
+
spanPositions(exactInv, bx0 + i, by0 + j, end - i, runU, runV);
|
|
27657
|
+
}
|
|
27658
|
+
}
|
|
27659
|
+
if (integerBicubic) {
|
|
27660
|
+
u = (fixU[i - runBase] + chainPad * FIX16) / FIX16;
|
|
27661
|
+
v = (fixV[i - runBase] + chainPad * FIX16) / FIX16;
|
|
27662
|
+
} else {
|
|
27663
|
+
u = runU[i - runBase] + chainPad;
|
|
27664
|
+
v = runV[i - runBase] + chainPad;
|
|
26924
27665
|
}
|
|
26925
|
-
u = runU[i - runBase];
|
|
26926
|
-
v = runV[i - runBase];
|
|
26927
27666
|
} else if (steppedInv) {
|
|
26928
27667
|
if (start < 0) {
|
|
26929
27668
|
start = i;
|
|
@@ -26946,7 +27685,10 @@ function resampleImage(rgba, width, height, spec, surface, options2 = {}) {
|
|
|
26946
27685
|
}
|
|
26947
27686
|
}
|
|
26948
27687
|
if (integerBicubic) {
|
|
26949
|
-
if (
|
|
27688
|
+
if (exactInv) {
|
|
27689
|
+
u = Math.floor(u * 64) / 64;
|
|
27690
|
+
v = Math.floor(v * 64) / 64;
|
|
27691
|
+
} else if (steppedInv) {
|
|
26950
27692
|
u = Math.floor(u * 64) / 64;
|
|
26951
27693
|
v = Math.floor(v * 64) / 64;
|
|
26952
27694
|
} else {
|
|
@@ -27124,6 +27866,10 @@ function resampleHqAxisAligned(rgba, width, height, spec, surface, m, premultOut
|
|
|
27124
27866
|
if (w * h > MAX_RESAMPLE_PIXELS) {
|
|
27125
27867
|
return null;
|
|
27126
27868
|
}
|
|
27869
|
+
const stretched = resampleHqStretch(rgba, width, height, spec, cx0, cy0, w, h, premultOut);
|
|
27870
|
+
if (stretched) {
|
|
27871
|
+
return stretched;
|
|
27872
|
+
}
|
|
27127
27873
|
const cubic = kernel === "hq-bicubic";
|
|
27128
27874
|
const bin = cubic ? 0.5 : 1;
|
|
27129
27875
|
let stepU = hqStep(scaleU);
|
|
@@ -27303,7 +28049,71 @@ function resampleHqAxisAligned(rgba, width, height, spec, surface, m, premultOut
|
|
|
27303
28049
|
}
|
|
27304
28050
|
return { x: cx0, y: cy0, w, h, rgba: out, premultiplied: premultOut };
|
|
27305
28051
|
}
|
|
27306
|
-
function
|
|
28052
|
+
function resampleHqStretch(rgba, width, height, spec, x0, y0, w, h, premultOut) {
|
|
28053
|
+
const world = spec.worldMatrix;
|
|
28054
|
+
if (spec.halfPixelOffset || !world || spec.wrap || spec.srcX !== 0 || spec.srcY !== 0 || spec.srcW !== width || spec.srcH !== height) {
|
|
28055
|
+
return void 0;
|
|
28056
|
+
}
|
|
28057
|
+
const src = [spec.srcX, spec.srcY, spec.srcW, spec.srcH];
|
|
28058
|
+
const inferred = spec.worldRect ? null : spec.worldPoints ? inferPointsMatrix(spec.worldPoints, src) : null;
|
|
28059
|
+
const device = spec.worldRect ? rectFormDeviceMatrix(src, spec.worldRect, world) : inferred ? multiplyDown(inferred, world) : null;
|
|
28060
|
+
if (!device || !(device[0] > 0 && device[3] > 0)) {
|
|
28061
|
+
return void 0;
|
|
28062
|
+
}
|
|
28063
|
+
const dest = deviceDestRect(device, src);
|
|
28064
|
+
const premultiplied2 = new Uint8Array(width * height * 4);
|
|
28065
|
+
for (let i = 0; i < width * height * 4; i += 4) {
|
|
28066
|
+
const a = rgba[i + 3];
|
|
28067
|
+
premultiplied2[i] = Math.round(rgba[i] * a / 255);
|
|
28068
|
+
premultiplied2[i + 1] = Math.round(rgba[i + 1] * a / 255);
|
|
28069
|
+
premultiplied2[i + 2] = Math.round(rgba[i + 2] * a / 255);
|
|
28070
|
+
premultiplied2[i + 3] = a;
|
|
28071
|
+
}
|
|
28072
|
+
const state = createStretch({
|
|
28073
|
+
kernel: spec.kernel === "hq-bicubic" ? "cubic" : "tent",
|
|
28074
|
+
pixels: premultiplied2,
|
|
28075
|
+
width,
|
|
28076
|
+
height,
|
|
28077
|
+
src,
|
|
28078
|
+
dest
|
|
28079
|
+
});
|
|
28080
|
+
if (!state) {
|
|
28081
|
+
return void 0;
|
|
28082
|
+
}
|
|
28083
|
+
const out = new Uint8ClampedArray(w * h * 4);
|
|
28084
|
+
for (let j = 0; j < h; j++) {
|
|
28085
|
+
const run = stretchRun(state, y0 + j, x0, x0 + w);
|
|
28086
|
+
if (!run) {
|
|
28087
|
+
continue;
|
|
28088
|
+
}
|
|
28089
|
+
for (let i = 0; i < run.pixels.length / 4; i++) {
|
|
28090
|
+
const o = run.pixels.subarray(i * 4, i * 4 + 4);
|
|
28091
|
+
const alpha = o[3];
|
|
28092
|
+
if (alpha === 0) {
|
|
28093
|
+
continue;
|
|
28094
|
+
}
|
|
28095
|
+
const d = (j * w + run.x - x0 + i) * 4;
|
|
28096
|
+
const k = premultOut ? 1 : 255 / alpha;
|
|
28097
|
+
out[d] = o[0] * k;
|
|
28098
|
+
out[d + 1] = o[1] * k;
|
|
28099
|
+
out[d + 2] = o[2] * k;
|
|
28100
|
+
out[d + 3] = alpha;
|
|
28101
|
+
}
|
|
28102
|
+
}
|
|
28103
|
+
return { x: x0, y: y0, w, h, rgba: out, premultiplied: premultOut };
|
|
28104
|
+
}
|
|
28105
|
+
function deviceEdgeLengths(points, world) {
|
|
28106
|
+
const p = transformPoints(world, points);
|
|
28107
|
+
const length = (dx, dy) => Math.ceil(sqrt(addDown(mul(dy, dy), mul(dx, dx))));
|
|
28108
|
+
return [
|
|
28109
|
+
length(addDown(p[2], -p[0]), addDown(p[3], -p[1])),
|
|
28110
|
+
length(addDown(p[4], -p[0]), addDown(p[5], -p[1]))
|
|
28111
|
+
];
|
|
28112
|
+
}
|
|
28113
|
+
function resampleRotatedTwoStage(rgba, width, height, spec, surface, m, kernel, nearHint) {
|
|
28114
|
+
const chain = !!(spec.pointsForm && spec.worldPoints && spec.worldMatrix && !spec.wrap);
|
|
28115
|
+
const edges = chain ? deviceEdgeLengths(spec.worldPoints, spec.worldMatrix) : null;
|
|
28116
|
+
const near = edges ? Math.abs(edges[0] - spec.srcW) <= 1.0000001 || Math.abs(edges[1] - spec.srcH) <= 1.0000001 : nearHint;
|
|
27307
28117
|
const pad = spec.wrap ? 0 : 2;
|
|
27308
28118
|
let img;
|
|
27309
28119
|
let pw;
|
|
@@ -27315,6 +28125,8 @@ function resampleRotatedTwoStage(rgba, width, height, spec, surface, m, kernel,
|
|
|
27315
28125
|
let ex;
|
|
27316
28126
|
let ey;
|
|
27317
28127
|
const half = spec.halfPixelOffset;
|
|
28128
|
+
let interW = 0;
|
|
28129
|
+
let interH = 0;
|
|
27318
28130
|
if (near) {
|
|
27319
28131
|
pw = width + 2 * pad;
|
|
27320
28132
|
ph = height + 2 * pad;
|
|
@@ -27334,8 +28146,10 @@ function resampleRotatedTwoStage(rgba, width, height, spec, surface, m, kernel,
|
|
|
27334
28146
|
ex = m[4] - (half ? 0.5 : 0);
|
|
27335
28147
|
ey = m[5] - (half ? 0.5 : 0);
|
|
27336
28148
|
} else {
|
|
27337
|
-
const W = ceilExtent(Math.hypot(m[0], m[1]) * spec.srcW);
|
|
27338
|
-
const H = ceilExtent(Math.hypot(m[2], m[3]) * spec.srcH);
|
|
28149
|
+
const W = edges ? edges[0] : ceilExtent(Math.hypot(m[0], m[1]) * spec.srcW);
|
|
28150
|
+
const H = edges ? edges[1] : ceilExtent(Math.hypot(m[2], m[3]) * spec.srcH);
|
|
28151
|
+
interW = W;
|
|
28152
|
+
interH = H;
|
|
27339
28153
|
const kx = W / spec.srcW;
|
|
27340
28154
|
const ky = H / spec.srcH;
|
|
27341
28155
|
const pre = resampleImage(rgba, width, height, {
|
|
@@ -27381,6 +28195,12 @@ function resampleRotatedTwoStage(rgba, width, height, spec, surface, m, kernel,
|
|
|
27381
28195
|
ex = half ? ox - 0.5 + 0.5 * (a + c) : ox;
|
|
27382
28196
|
ey = half ? oy - 0.5 + 0.5 * (b + d) : oy;
|
|
27383
28197
|
}
|
|
28198
|
+
const corners = [
|
|
28199
|
+
[spec.srcX, spec.srcY],
|
|
28200
|
+
[spec.srcX + spec.srcW, spec.srcY],
|
|
28201
|
+
[spec.srcX + spec.srcW, spec.srcY + spec.srcH],
|
|
28202
|
+
[spec.srcX, spec.srcY + spec.srcH]
|
|
28203
|
+
].flatMap(([u, v]) => [toPlusFix(m[0] * u + m[2] * v + m[4]), toPlusFix(m[1] * u + m[3] * v + m[5])]);
|
|
27384
28204
|
const block = resampleImage(img, pw, ph, {
|
|
27385
28205
|
srcX: 0,
|
|
27386
28206
|
srcY: 0,
|
|
@@ -27390,17 +28210,18 @@ function resampleRotatedTwoStage(rgba, width, height, spec, surface, m, kernel,
|
|
|
27390
28210
|
kernel: kernel === "hq-bicubic" ? "bicubic" : "bilinear",
|
|
27391
28211
|
halfPixelOffset: false,
|
|
27392
28212
|
wrap: spec.wrap,
|
|
27393
|
-
clampArgb: spec.clampArgb
|
|
27394
|
-
|
|
28213
|
+
clampArgb: spec.clampArgb,
|
|
28214
|
+
...chain ? {
|
|
28215
|
+
pointsForm: true,
|
|
28216
|
+
worldPoints: spec.worldPoints,
|
|
28217
|
+
worldMatrix: spec.worldMatrix,
|
|
28218
|
+
chainSrc: near ? [spec.srcX, spec.srcY, spec.srcW, spec.srcH] : [half ? -0.5 : 0, half ? -0.5 : 0, interW, interH],
|
|
28219
|
+
...half ? { chainHalf: true } : {}
|
|
28220
|
+
} : {}
|
|
28221
|
+
}, surface, { plainRotated: true, keepOrigin: true, premultSource: true, ...chain ? { rasterQuad: corners, rasterHalf: half, chainPad: pad } : {} });
|
|
27395
28222
|
if (!block) {
|
|
27396
28223
|
return block;
|
|
27397
28224
|
}
|
|
27398
|
-
const corners = [
|
|
27399
|
-
[spec.srcX, spec.srcY],
|
|
27400
|
-
[spec.srcX + spec.srcW, spec.srcY],
|
|
27401
|
-
[spec.srcX + spec.srcW, spec.srcY + spec.srcH],
|
|
27402
|
-
[spec.srcX, spec.srcY + spec.srcH]
|
|
27403
|
-
].flatMap(([u, v]) => [toPlusFix(m[0] * u + m[2] * v + m[4]), toPlusFix(m[1] * u + m[3] * v + m[5])]);
|
|
27404
28225
|
const coverage = rasterizePlusFill([corners], false, false, half, { x: block.x, y: block.y, w: block.w, h: block.h });
|
|
27405
28226
|
for (let i = 0; i < block.w * block.h; i++) {
|
|
27406
28227
|
if (!coverage[i]) {
|
|
@@ -28118,7 +28939,7 @@ function filterScanlines(input, width, height) {
|
|
|
28118
28939
|
const stride = width * 4;
|
|
28119
28940
|
const words = data.byteOffset % 4 === 0 ? new Uint32Array(data.buffer, data.byteOffset, width * height) : null;
|
|
28120
28941
|
const out = new Uint8Array((stride + 1) * height);
|
|
28121
|
-
const
|
|
28942
|
+
const sub4 = new Uint8Array(stride);
|
|
28122
28943
|
const up = new Uint8Array(stride);
|
|
28123
28944
|
const pae = new Uint8Array(stride);
|
|
28124
28945
|
for (let y = 0; y < height; y++) {
|
|
@@ -28153,12 +28974,12 @@ function filterScanlines(input, width, height) {
|
|
|
28153
28974
|
let upScore = 0;
|
|
28154
28975
|
for (let i = 0; i < 4 && i < stride; i++) {
|
|
28155
28976
|
const x = data[row2 + i];
|
|
28156
|
-
|
|
28977
|
+
sub4[i] = x;
|
|
28157
28978
|
subScore += x < 128 ? x : 256 - x;
|
|
28158
28979
|
}
|
|
28159
28980
|
for (let i = 4; i < stride; i++) {
|
|
28160
28981
|
const v = data[row2 + i] - data[row2 + i - 4] & 255;
|
|
28161
|
-
|
|
28982
|
+
sub4[i] = v;
|
|
28162
28983
|
subScore += v < 128 ? v : 256 - v;
|
|
28163
28984
|
}
|
|
28164
28985
|
if (y > 0) {
|
|
@@ -28176,7 +28997,7 @@ function filterScanlines(input, width, height) {
|
|
|
28176
28997
|
let bestScore = noneScore;
|
|
28177
28998
|
if (subScore < bestScore) {
|
|
28178
28999
|
bestScore = subScore;
|
|
28179
|
-
best =
|
|
29000
|
+
best = sub4;
|
|
28180
29001
|
code = 1;
|
|
28181
29002
|
}
|
|
28182
29003
|
if (upScore < bestScore) {
|
|
@@ -28432,7 +29253,7 @@ function svgTreeToJsx(node, options2 = {}) {
|
|
|
28432
29253
|
|
|
28433
29254
|
// src/svg-context.ts
|
|
28434
29255
|
var IDENTITY3 = [1, 0, 0, 1, 0, 0];
|
|
28435
|
-
function
|
|
29256
|
+
function mul5(m, n) {
|
|
28436
29257
|
return [
|
|
28437
29258
|
m[0] * n[0] + m[2] * n[1],
|
|
28438
29259
|
m[1] * n[0] + m[3] * n[1],
|
|
@@ -28969,23 +29790,23 @@ var SvgContext = class {
|
|
|
28969
29790
|
this.shadow?.restore();
|
|
28970
29791
|
}
|
|
28971
29792
|
getTransform() {
|
|
28972
|
-
const [a, b, c, d, e,
|
|
28973
|
-
return { a, b, c, d, e, f };
|
|
29793
|
+
const [a, b, c, d, e, f2] = this.state.transform;
|
|
29794
|
+
return { a, b, c, d, e, f: f2 };
|
|
28974
29795
|
}
|
|
28975
|
-
setTransform(a, b, c, d, e,
|
|
28976
|
-
if ([a, b, c, d, e,
|
|
28977
|
-
this.state.transform = [a, b, c, d, e,
|
|
29796
|
+
setTransform(a, b, c, d, e, f2) {
|
|
29797
|
+
if ([a, b, c, d, e, f2].every(Number.isFinite)) {
|
|
29798
|
+
this.state.transform = [a, b, c, d, e, f2];
|
|
28978
29799
|
}
|
|
28979
|
-
this.shadow?.setTransform(a, b, c, d, e,
|
|
29800
|
+
this.shadow?.setTransform(a, b, c, d, e, f2);
|
|
28980
29801
|
}
|
|
28981
29802
|
resetTransform() {
|
|
28982
29803
|
this.setTransform(1, 0, 0, 1, 0, 0);
|
|
28983
29804
|
}
|
|
28984
|
-
transform(a, b, c, d, e,
|
|
28985
|
-
if ([a, b, c, d, e,
|
|
28986
|
-
this.state.transform =
|
|
29805
|
+
transform(a, b, c, d, e, f2) {
|
|
29806
|
+
if ([a, b, c, d, e, f2].every(Number.isFinite)) {
|
|
29807
|
+
this.state.transform = mul5(this.state.transform, [a, b, c, d, e, f2]);
|
|
28987
29808
|
}
|
|
28988
|
-
this.shadow?.transform(a, b, c, d, e,
|
|
29809
|
+
this.shadow?.transform(a, b, c, d, e, f2);
|
|
28989
29810
|
}
|
|
28990
29811
|
translate(x, y) {
|
|
28991
29812
|
this.transform(1, 0, 0, 1, x, y);
|
|
@@ -29165,7 +29986,7 @@ var SvgContext = class {
|
|
|
29165
29986
|
return { tag: g.type === "linear" ? "linearGradient" : "radialGradient", attrs, children: stops };
|
|
29166
29987
|
}
|
|
29167
29988
|
patternNode(p, id, space) {
|
|
29168
|
-
const m =
|
|
29989
|
+
const m = mul5(space, p.matrix);
|
|
29169
29990
|
let spanU = p.width;
|
|
29170
29991
|
let spanV = p.height;
|
|
29171
29992
|
const im = inv(m);
|
|
@@ -29494,7 +30315,7 @@ var SvgContext = class {
|
|
|
29494
30315
|
let m = run.matrix ? [...run.matrix] : null;
|
|
29495
30316
|
if (run.scaleX && run.scaleX !== 1) {
|
|
29496
30317
|
const s = [run.scaleX, 0, 0, 1, 0, 0];
|
|
29497
|
-
m = m ?
|
|
30318
|
+
m = m ? mul5(m, s) : s;
|
|
29498
30319
|
attrs.x = run.xs.map((v) => fmt(v / run.scaleX)).join(" ");
|
|
29499
30320
|
}
|
|
29500
30321
|
if (m && !isIdentity(m)) {
|
|
@@ -29782,25 +30603,25 @@ function canReadBack(ctx) {
|
|
|
29782
30603
|
|
|
29783
30604
|
// src/emf-plus-state-handlers.ts
|
|
29784
30605
|
function rotateWorldTransform(m, degrees, append2) {
|
|
29785
|
-
const
|
|
29786
|
-
const rad =
|
|
29787
|
-
const s =
|
|
29788
|
-
const c =
|
|
30606
|
+
const f2 = down32;
|
|
30607
|
+
const rad = f2(Math.fround(degrees) * Math.fround(0.0174532924));
|
|
30608
|
+
const s = f2(Math.sin(rad));
|
|
30609
|
+
const c = f2(Math.cos(rad));
|
|
29789
30610
|
if (append2) {
|
|
29790
30611
|
return [
|
|
29791
|
-
|
|
29792
|
-
|
|
29793
|
-
|
|
29794
|
-
|
|
29795
|
-
|
|
29796
|
-
|
|
30612
|
+
f2(f2(m[0] * c) - f2(m[1] * s)),
|
|
30613
|
+
f2(f2(m[0] * s) + f2(m[1] * c)),
|
|
30614
|
+
f2(f2(m[2] * c) - f2(m[3] * s)),
|
|
30615
|
+
f2(f2(m[2] * s) + f2(m[3] * c)),
|
|
30616
|
+
f2(f2(m[4] * c) - f2(m[5] * s)),
|
|
30617
|
+
f2(f2(m[4] * s) + f2(m[5] * c))
|
|
29797
30618
|
];
|
|
29798
30619
|
}
|
|
29799
30620
|
return [
|
|
29800
|
-
|
|
29801
|
-
|
|
29802
|
-
|
|
29803
|
-
|
|
30621
|
+
f2(f2(m[0] * c) + f2(m[2] * s)),
|
|
30622
|
+
f2(f2(m[3] * s) + f2(m[1] * c)),
|
|
30623
|
+
f2(f2(m[2] * c) - f2(m[0] * s)),
|
|
30624
|
+
f2(f2(m[3] * c) - f2(m[1] * s)),
|
|
29804
30625
|
m[4],
|
|
29805
30626
|
m[5]
|
|
29806
30627
|
];
|
|
@@ -30383,10 +31204,10 @@ function handleEmfPlusStateRecord(rCtx, recType, recFlags, dataOff, recDataSize)
|
|
|
30383
31204
|
}
|
|
30384
31205
|
case EMFPLUS_BEGINCONTAINER: {
|
|
30385
31206
|
if (recDataSize >= 36) {
|
|
30386
|
-
const
|
|
31207
|
+
const f2 = (k) => view.getFloat32(dataOff + k, true);
|
|
30387
31208
|
const t = containerRectTransform(
|
|
30388
|
-
{ x:
|
|
30389
|
-
{ x:
|
|
31209
|
+
{ x: f2(0), y: f2(4), w: f2(8), h: f2(12) },
|
|
31210
|
+
{ x: f2(16), y: f2(20), w: f2(24), h: f2(28) },
|
|
30390
31211
|
recFlags & 255
|
|
30391
31212
|
);
|
|
30392
31213
|
beginContainer(rCtx, view.getUint32(dataOff + 32, true), t ?? [1, 0, 0, 1, 0, 0]);
|
|
@@ -30542,7 +31363,7 @@ function registerNestedMetafileReplayer(fn) {
|
|
|
30542
31363
|
nestedReplayer = fn;
|
|
30543
31364
|
}
|
|
30544
31365
|
function inclusiveNestedMapping(toDevice, srcX, srcY, srcW, srcH) {
|
|
30545
|
-
const [a, b, c, d, e,
|
|
31366
|
+
const [a, b, c, d, e, f2] = toDevice;
|
|
30546
31367
|
const lengthU = Math.hypot(a, b) * srcW;
|
|
30547
31368
|
const lengthV = Math.hypot(c, d) * srcH;
|
|
30548
31369
|
if (!(srcW > 1 && srcH > 1 && lengthU > 1 && lengthV > 1)) {
|
|
@@ -30554,7 +31375,7 @@ function inclusiveNestedMapping(toDevice, srcX, srcY, srcW, srcH) {
|
|
|
30554
31375
|
const nb = b * ku;
|
|
30555
31376
|
const nc = c * kv;
|
|
30556
31377
|
const nd = d * kv;
|
|
30557
|
-
return [na, nb, nc, nd, e + (a - na) * srcX + (c - nc) * srcY,
|
|
31378
|
+
return [na, nb, nc, nd, e + (a - na) * srcX + (c - nc) * srcY, f2 + (b - nb) * srcX + (d - nd) * srcY];
|
|
30558
31379
|
}
|
|
30559
31380
|
function drawNestedMetafile(rCtx, img, cached, source) {
|
|
30560
31381
|
const depth = rCtx.nestingDepth ?? 0;
|
|
@@ -31337,7 +32158,7 @@ function encodeJpeg(data, width, height, options2 = {}) {
|
|
|
31337
32158
|
}
|
|
31338
32159
|
const quality = Number.isFinite(options2.quality) ? Math.min(1, Math.max(0, options2.quality)) : DEFAULT_JPEG_QUALITY;
|
|
31339
32160
|
const [bgR, bgG, bgB] = options2.background ?? [255, 255, 255];
|
|
31340
|
-
const
|
|
32161
|
+
const sub4 = options2.chromaSubsampling ?? false;
|
|
31341
32162
|
const lumaQuant = scaleQuant(LUMA_QUANT, quality);
|
|
31342
32163
|
const chromaQuant = scaleQuant(CHROMA_QUANT, quality);
|
|
31343
32164
|
const n = width * height;
|
|
@@ -31357,7 +32178,7 @@ function encodeJpeg(data, width, height, options2 = {}) {
|
|
|
31357
32178
|
const acL = buildCodes(AC_LUMA);
|
|
31358
32179
|
const dcC = buildCodes(DC_CHROMA);
|
|
31359
32180
|
const acC = buildCodes(AC_CHROMA);
|
|
31360
|
-
const factor =
|
|
32181
|
+
const factor = sub4 ? 2 : 1;
|
|
31361
32182
|
const mcu = 8 * factor;
|
|
31362
32183
|
const block = new Float64Array(64);
|
|
31363
32184
|
const tmp = new Float64Array(64);
|
|
@@ -35618,8 +36439,8 @@ function parseRasterFontFile(data) {
|
|
|
35618
36439
|
}
|
|
35619
36440
|
const sig = view.getUint16(0, true);
|
|
35620
36441
|
if (sig === 512 || sig === 768) {
|
|
35621
|
-
const
|
|
35622
|
-
return
|
|
36442
|
+
const f2 = parseFnt(view, 0, view.byteLength);
|
|
36443
|
+
return f2 ? [f2] : out;
|
|
35623
36444
|
}
|
|
35624
36445
|
if (sig !== 23117) {
|
|
35625
36446
|
return out;
|
|
@@ -35644,9 +36465,9 @@ function parseRasterFontFile(data) {
|
|
|
35644
36465
|
}
|
|
35645
36466
|
const off = view.getUint16(p, true) * 2 ** shift;
|
|
35646
36467
|
const len = view.getUint16(p + 2, true) * 2 ** shift;
|
|
35647
|
-
const
|
|
35648
|
-
if (
|
|
35649
|
-
out.push(
|
|
36468
|
+
const f2 = parseFnt(view, off, Math.min(view.byteLength, off + len));
|
|
36469
|
+
if (f2) {
|
|
36470
|
+
out.push(f2);
|
|
35650
36471
|
}
|
|
35651
36472
|
}
|
|
35652
36473
|
}
|
|
@@ -36005,12 +36826,12 @@ function readGlyph(view, glyf, start, end) {
|
|
|
36005
36826
|
p += insLen;
|
|
36006
36827
|
const flags2 = new Uint8Array(nPts);
|
|
36007
36828
|
for (let i = 0; i < nPts; ) {
|
|
36008
|
-
const
|
|
36009
|
-
flags2[i++] =
|
|
36010
|
-
if (
|
|
36829
|
+
const f2 = view.getUint8(p++);
|
|
36830
|
+
flags2[i++] = f2;
|
|
36831
|
+
if (f2 & 8) {
|
|
36011
36832
|
let rep = view.getUint8(p++);
|
|
36012
36833
|
while (rep-- > 0 && i < nPts) {
|
|
36013
|
-
flags2[i++] =
|
|
36834
|
+
flags2[i++] = f2;
|
|
36014
36835
|
}
|
|
36015
36836
|
}
|
|
36016
36837
|
}
|
|
@@ -36018,11 +36839,11 @@ function readGlyph(view, glyf, start, end) {
|
|
|
36018
36839
|
const ys = new Array(nPts);
|
|
36019
36840
|
let v = 0;
|
|
36020
36841
|
for (let i = 0; i < nPts; i++) {
|
|
36021
|
-
const
|
|
36022
|
-
if (
|
|
36842
|
+
const f2 = flags2[i];
|
|
36843
|
+
if (f2 & 2) {
|
|
36023
36844
|
const d = view.getUint8(p++);
|
|
36024
|
-
v +=
|
|
36025
|
-
} else if (!(
|
|
36845
|
+
v += f2 & 16 ? d : -d;
|
|
36846
|
+
} else if (!(f2 & 16)) {
|
|
36026
36847
|
v += view.getInt16(p);
|
|
36027
36848
|
p += 2;
|
|
36028
36849
|
}
|
|
@@ -36030,11 +36851,11 @@ function readGlyph(view, glyf, start, end) {
|
|
|
36030
36851
|
}
|
|
36031
36852
|
v = 0;
|
|
36032
36853
|
for (let i = 0; i < nPts; i++) {
|
|
36033
|
-
const
|
|
36034
|
-
if (
|
|
36854
|
+
const f2 = flags2[i];
|
|
36855
|
+
if (f2 & 4) {
|
|
36035
36856
|
const d = view.getUint8(p++);
|
|
36036
|
-
v +=
|
|
36037
|
-
} else if (!(
|
|
36857
|
+
v += f2 & 32 ? d : -d;
|
|
36858
|
+
} else if (!(f2 & 32)) {
|
|
36038
36859
|
v += view.getInt16(p);
|
|
36039
36860
|
p += 2;
|
|
36040
36861
|
}
|
|
@@ -36574,9 +37395,9 @@ var HintedSize = class _HintedSize {
|
|
|
36574
37395
|
let metricsFrom = null;
|
|
36575
37396
|
let lastScan = scan;
|
|
36576
37397
|
for (const comp of glyph.components) {
|
|
36577
|
-
const
|
|
36578
|
-
lastScan = { scanControl:
|
|
36579
|
-
const z =
|
|
37398
|
+
const sub4 = this.loadRecursive(comp.glyphIndex, depth + 1);
|
|
37399
|
+
lastScan = { scanControl: sub4.scanControl, scanSet: sub4.scanSet, scanType: sub4.scanType };
|
|
37400
|
+
const z = sub4.zone;
|
|
36580
37401
|
const m = z.n - 4;
|
|
36581
37402
|
if (comp.flags & (WE_HAVE_A_SCALE | WE_HAVE_AN_X_AND_Y_SCALE | WE_HAVE_A_TWO_BY_TWO)) {
|
|
36582
37403
|
for (let i = 0; i < z.n; i++) {
|
|
@@ -36837,17 +37658,17 @@ var HintedSize = class _HintedSize {
|
|
|
36837
37658
|
* freedom vector was copied from the projection vector, or their rounded dot product is exactly 1.0): the move
|
|
36838
37659
|
* is then the distance times the component over 1.0 on both axes.
|
|
36839
37660
|
*/
|
|
36840
|
-
moveAmt(distance,
|
|
37661
|
+
moveAmt(distance, f2, alongX) {
|
|
36841
37662
|
if (this.gdiMath) {
|
|
36842
37663
|
if (this.gs.fvIsPv || this.fDotP === 16384) {
|
|
36843
|
-
return mulDiv(distance,
|
|
37664
|
+
return mulDiv(distance, f2, 16384);
|
|
36844
37665
|
}
|
|
36845
|
-
if (alongX &&
|
|
37666
|
+
if (alongX && f2 === this.fDotP) {
|
|
36846
37667
|
return distance;
|
|
36847
37668
|
}
|
|
36848
|
-
return alongX ? mulDivGdi(distance,
|
|
37669
|
+
return alongX ? mulDivGdi(distance, f2, this.fDotP) : mulDiv(distance, f2, this.fDotP);
|
|
36849
37670
|
}
|
|
36850
|
-
return mulDiv(distance,
|
|
37671
|
+
return mulDiv(distance, f2, this.fDotP);
|
|
36851
37672
|
}
|
|
36852
37673
|
moveOrig(zone, p, distance) {
|
|
36853
37674
|
const gs = this.gs;
|
|
@@ -37225,7 +38046,7 @@ var HintedSize = class _HintedSize {
|
|
|
37225
38046
|
break;
|
|
37226
38047
|
}
|
|
37227
38048
|
case 44: {
|
|
37228
|
-
const
|
|
38049
|
+
const f2 = this.pop();
|
|
37229
38050
|
let p = next;
|
|
37230
38051
|
while (p < cur.length && cur[p] !== 45) {
|
|
37231
38052
|
if (cur[p] === 44 || cur[p] === 137) {
|
|
@@ -37233,10 +38054,10 @@ var HintedSize = class _HintedSize {
|
|
|
37233
38054
|
}
|
|
37234
38055
|
p += _HintedSize.insLength(cur, p);
|
|
37235
38056
|
}
|
|
37236
|
-
if (
|
|
38057
|
+
if (f2 < 0 || f2 > 65535) {
|
|
37237
38058
|
throw new HintError("fdef");
|
|
37238
38059
|
}
|
|
37239
|
-
this.fdefs[
|
|
38060
|
+
this.fdefs[f2] = { code: cur, start: next, end: p };
|
|
37240
38061
|
next = p + 1;
|
|
37241
38062
|
break;
|
|
37242
38063
|
}
|
|
@@ -37267,8 +38088,8 @@ var HintedSize = class _HintedSize {
|
|
|
37267
38088
|
continue;
|
|
37268
38089
|
}
|
|
37269
38090
|
case 43: {
|
|
37270
|
-
const
|
|
37271
|
-
const def = this.fdefs[
|
|
38091
|
+
const f2 = this.pop();
|
|
38092
|
+
const def = this.fdefs[f2];
|
|
37272
38093
|
if (!def) {
|
|
37273
38094
|
throw new HintError("call");
|
|
37274
38095
|
}
|
|
@@ -37281,9 +38102,9 @@ var HintedSize = class _HintedSize {
|
|
|
37281
38102
|
continue;
|
|
37282
38103
|
}
|
|
37283
38104
|
case 42: {
|
|
37284
|
-
const
|
|
38105
|
+
const f2 = this.pop();
|
|
37285
38106
|
const cnt = this.pop();
|
|
37286
|
-
const def = this.fdefs[
|
|
38107
|
+
const def = this.fdefs[f2];
|
|
37287
38108
|
if (!def) {
|
|
37288
38109
|
throw new HintError("loopcall");
|
|
37289
38110
|
}
|
|
@@ -37592,7 +38413,7 @@ var HintedSize = class _HintedSize {
|
|
|
37592
38413
|
while (gs.loop > 0) {
|
|
37593
38414
|
const p = this.pop();
|
|
37594
38415
|
if (p >= 0 && p < this.zp2.n) {
|
|
37595
|
-
const keep = !this.ctCompat() || this.inComposite || gs.fvx === 0 && this.shpixAlongY(p) || gs.fvx !== 0 && !this.inSizeTweak() && (!this.env.grayscale || this.plusShpixX(p, amt));
|
|
38416
|
+
const keep = !this.ctCompat() || this.inComposite || gs.fvx === 0 && (this.shpixAlongY(p) || this.iupy && this.linkMode() && !this.inSizeTweak()) || gs.fvx !== 0 && !this.inSizeTweak() && (!this.env.grayscale || this.plusShpixX(p, amt));
|
|
37596
38417
|
if (keep) {
|
|
37597
38418
|
this.moveZp2(p, dx, dy, true);
|
|
37598
38419
|
}
|
|
@@ -38340,12 +39161,12 @@ var HintedSize = class _HintedSize {
|
|
|
38340
39161
|
if (pt === -1) {
|
|
38341
39162
|
return 0;
|
|
38342
39163
|
}
|
|
38343
|
-
let
|
|
38344
|
-
if (
|
|
39164
|
+
let f2 = links.flags[pt];
|
|
39165
|
+
if (f2 & 4) {
|
|
38345
39166
|
return 0;
|
|
38346
39167
|
}
|
|
38347
|
-
links.flags[pt] =
|
|
38348
|
-
if (!(
|
|
39168
|
+
links.flags[pt] = f2 |= 4;
|
|
39169
|
+
if (!(f2 & 2)) {
|
|
38349
39170
|
const lastEp = z.n - 5;
|
|
38350
39171
|
const w0 = links.w0[pt];
|
|
38351
39172
|
let shift = 0;
|
|
@@ -38584,8 +39405,8 @@ var HintedSize = class _HintedSize {
|
|
|
38584
39405
|
return;
|
|
38585
39406
|
}
|
|
38586
39407
|
if (zp2 === this.pts && this.recorder(false)) {
|
|
38587
|
-
const
|
|
38588
|
-
const steeperA =
|
|
39408
|
+
const mul7 = (u, v) => Math.abs(Math.floor((u * v + 32) / 64));
|
|
39409
|
+
const steeperA = mul7(zp1.curY[a1] - zp1.curY[a0], zp0.curX[b1] - zp0.curX[b0]) > mul7(zp1.curX[a1] - zp1.curX[a0], zp0.curY[b1] - zp0.curY[b0]);
|
|
38589
39410
|
this.linkProportion(zp2, steeperA ? a0 : b0, p, steeperA ? a1 : b1);
|
|
38590
39411
|
}
|
|
38591
39412
|
const dbx = zp0.curX[b1] - zp0.curX[b0];
|
|
@@ -40251,6 +41072,97 @@ function dropoutMode(scanControl, scanType) {
|
|
|
40251
41072
|
return 2;
|
|
40252
41073
|
}
|
|
40253
41074
|
}
|
|
41075
|
+
function compDiv2(n, d) {
|
|
41076
|
+
if (d === 0) return n < 0 ? -2147483648 : 2147483647;
|
|
41077
|
+
const h = Math.trunc(d / 2);
|
|
41078
|
+
return Math.trunc((n < 0 === d < 0 ? n + h : n - h) / d);
|
|
41079
|
+
}
|
|
41080
|
+
function nativeConicPieces(x0, y0, x1, y1, x2, y2, out) {
|
|
41081
|
+
for (; ; ) {
|
|
41082
|
+
const dx01 = x1 - x0;
|
|
41083
|
+
const dx12 = x2 - x1;
|
|
41084
|
+
const dy01 = y1 - y0;
|
|
41085
|
+
const dy12 = y2 - y1;
|
|
41086
|
+
if (dy01 > 0 && dy12 < 0 || dy01 < 0 && dy12 > 0) {
|
|
41087
|
+
const den = dy01 - dy12;
|
|
41088
|
+
const xa = x0 + compDiv2(dx01 * dy01, den);
|
|
41089
|
+
const xb = x1 + compDiv2(dx12 * dy01, den);
|
|
41090
|
+
const xs = xa + compDiv2((xb - xa) * dy01, den);
|
|
41091
|
+
const ys = y0 + compDiv2(dy01 * dy01, den);
|
|
41092
|
+
nativeConicPieces(x0, y0, xa, ys, xs, ys, out);
|
|
41093
|
+
x0 = xs;
|
|
41094
|
+
y0 = ys;
|
|
41095
|
+
x1 = xb;
|
|
41096
|
+
y1 = ys;
|
|
41097
|
+
continue;
|
|
41098
|
+
}
|
|
41099
|
+
if (dx01 > 0 && dx12 < 0 || dx01 < 0 && dx12 > 0) {
|
|
41100
|
+
const den = dx01 - dx12;
|
|
41101
|
+
const ya = y0 + compDiv2(dy01 * dx01, den);
|
|
41102
|
+
const yb = y1 + compDiv2(dy12 * dx01, den);
|
|
41103
|
+
const ys = ya + compDiv2((yb - ya) * dx01, den);
|
|
41104
|
+
const xs = x0 + compDiv2(dx01 * dx01, den);
|
|
41105
|
+
nativeConicPieces(x0, y0, xs, ya, xs, ys, out);
|
|
41106
|
+
x0 = xs;
|
|
41107
|
+
y0 = ys;
|
|
41108
|
+
x1 = xs;
|
|
41109
|
+
y1 = yb;
|
|
41110
|
+
continue;
|
|
41111
|
+
}
|
|
41112
|
+
if (Math.abs(x2 - x0) > 3200 || Math.abs(y2 - y0) > 3200) {
|
|
41113
|
+
const ax = x0 + x1 >> 1;
|
|
41114
|
+
const ay = y0 + y1 >> 1;
|
|
41115
|
+
const bx = x1 + x2 >> 1;
|
|
41116
|
+
const by = y1 + y2 >> 1;
|
|
41117
|
+
const mx = ax + bx >> 1;
|
|
41118
|
+
const my = ay + by >> 1;
|
|
41119
|
+
nativeConicPieces(x0, y0, ax, ay, mx, my, out);
|
|
41120
|
+
x0 = mx;
|
|
41121
|
+
y0 = my;
|
|
41122
|
+
x1 = bx;
|
|
41123
|
+
y1 = by;
|
|
41124
|
+
continue;
|
|
41125
|
+
}
|
|
41126
|
+
out.push([x1, y1, x2, y2]);
|
|
41127
|
+
return;
|
|
41128
|
+
}
|
|
41129
|
+
}
|
|
41130
|
+
var ARC_SHIFT = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3];
|
|
41131
|
+
function bitLength2(v) {
|
|
41132
|
+
v = Math.abs(v);
|
|
41133
|
+
let n = 0;
|
|
41134
|
+
while (v > 0) {
|
|
41135
|
+
n++;
|
|
41136
|
+
v = Math.floor(v / 2);
|
|
41137
|
+
}
|
|
41138
|
+
return n;
|
|
41139
|
+
}
|
|
41140
|
+
function nativeArc(x0, y0, x1, y1, x2, y2) {
|
|
41141
|
+
const sx = x2 > x0 ? 1 : -1;
|
|
41142
|
+
const sy = y2 > y0 ? 1 : -1;
|
|
41143
|
+
let dx = sx * (x2 - x0);
|
|
41144
|
+
let dy = sy * (y2 - y0);
|
|
41145
|
+
let ax = sx * (x1 - x0);
|
|
41146
|
+
let ay = sy * (y1 - y0);
|
|
41147
|
+
const first = (p0, sg) => sg > 0 ? Math.floor((p0 + 32) / 64) * 64 + 32 - p0 : p0 - (Math.floor((p0 - 33) / 64) * 64 + 32);
|
|
41148
|
+
const fx0 = first(x0, sx);
|
|
41149
|
+
const fy0 = first(y0, sy);
|
|
41150
|
+
let fx = fx0;
|
|
41151
|
+
let fy = fy0;
|
|
41152
|
+
const shift = ARC_SHIFT[bitLength2(2 * (dy * ax - dx * ay)) + bitLength2(Math.max(dx, dy))] ?? 0;
|
|
41153
|
+
if (shift > 0) {
|
|
41154
|
+
const h = 2 ** (shift - 1);
|
|
41155
|
+
const q = 2 ** shift;
|
|
41156
|
+
const r = (v) => Math.floor((v + h) / q) * q;
|
|
41157
|
+
dx = r(dx);
|
|
41158
|
+
dy = r(dy);
|
|
41159
|
+
ax = r(ax);
|
|
41160
|
+
ay = r(ay);
|
|
41161
|
+
fx = r(fx);
|
|
41162
|
+
fy = r(fy);
|
|
41163
|
+
}
|
|
41164
|
+
return { sx, sy, x0, y0, dx, ax, fx, dy, ay, fy, fx0, fy0 };
|
|
41165
|
+
}
|
|
40254
41166
|
var Raster = class {
|
|
40255
41167
|
constructor(dropOutControl, fineArcs = false) {
|
|
40256
41168
|
this.dropOutControl = dropOutControl;
|
|
@@ -40273,6 +41185,9 @@ var Raster = class {
|
|
|
40273
41185
|
* curved edges with that rounding; FreeType's black rasterizer keeps the half and truncates at its own precision).
|
|
40274
41186
|
*/
|
|
40275
41187
|
this.roundImpliedPoints = false;
|
|
41188
|
+
/** Walks arcs the way GDI's scan converter does (see {@link nativeConicPieces}, {@link nativeArc}); needs `roundImpliedPoints`. */
|
|
41189
|
+
this.nativeArcs = false;
|
|
41190
|
+
this.arcRecord = null;
|
|
40276
41191
|
/**
|
|
40277
41192
|
* Decides a pixel centre that lies exactly on an edge the way GDI's rotated glyphs do (native GetGlyphOutline bitmaps
|
|
40278
41193
|
* of diagonal edges through pixel centres): the pixel is in when the contour runs downward there and out when it runs
|
|
@@ -40280,6 +41195,7 @@ var Raster = class {
|
|
|
40280
41195
|
*/
|
|
40281
41196
|
this.directedTies = false;
|
|
40282
41197
|
this.flipped = false;
|
|
41198
|
+
this.arcFlipped = false;
|
|
40283
41199
|
this.precBits = 16;
|
|
40284
41200
|
this.precStep = fineArcs ? 512 : 4096;
|
|
40285
41201
|
this.precJitter = 480;
|
|
@@ -40584,7 +41500,9 @@ var Raster = class {
|
|
|
40584
41500
|
}
|
|
40585
41501
|
this.newProfileState(stateBez, o);
|
|
40586
41502
|
}
|
|
40587
|
-
if (
|
|
41503
|
+
if (this.arcRecord) {
|
|
41504
|
+
this.nativeBezier(stateBez !== ASCENDING, this.minY, this.maxY);
|
|
41505
|
+
} else if (stateBez === ASCENDING) {
|
|
40588
41506
|
this.bezierUp(this.minY, this.maxY);
|
|
40589
41507
|
} else {
|
|
40590
41508
|
this.bezierDown(this.minY, this.maxY);
|
|
@@ -40594,6 +41512,109 @@ var Raster = class {
|
|
|
40594
41512
|
this.lastX = x3;
|
|
40595
41513
|
this.lastY = y3;
|
|
40596
41514
|
}
|
|
41515
|
+
/**
|
|
41516
|
+
* Adds the arc from (tsx, tsy) through (tcx, tcy) to (tex, tey), all in the outline's own axes and raw units, as GDI
|
|
41517
|
+
* walks it: cut into monotonic pieces (see {@link nativeConicPieces}), each walked on its rounded differences
|
|
41518
|
+
* (see {@link nativeArc}); a piece whose three points are on a line is a line.
|
|
41519
|
+
*/
|
|
41520
|
+
nativeConic(flipped, tsx, tsy, tcx, tcy, tex, tey) {
|
|
41521
|
+
const pieces = [];
|
|
41522
|
+
nativeConicPieces(tsx, tsy, tcx, tcy, tex, tey, pieces);
|
|
41523
|
+
let px = tsx;
|
|
41524
|
+
let py = tsy;
|
|
41525
|
+
for (const [cx, cy, ex, ey] of pieces) {
|
|
41526
|
+
const sx = this.scaled(flipped ? ey : ex);
|
|
41527
|
+
const sy = this.scaled(flipped ? ex : ey);
|
|
41528
|
+
if ((cy - py) * (ex - cx) === (ey - cy) * (cx - px)) {
|
|
41529
|
+
this.lineTo(sx, sy);
|
|
41530
|
+
} else {
|
|
41531
|
+
this.arcRecord = nativeArc(px, py, cx, cy, ex, ey);
|
|
41532
|
+
this.arcFlipped = flipped;
|
|
41533
|
+
this.conicTo(this.scaled(flipped ? cy : cx), this.scaled(flipped ? cx : cy), sx, sy);
|
|
41534
|
+
this.arcRecord = null;
|
|
41535
|
+
}
|
|
41536
|
+
px = ex;
|
|
41537
|
+
py = ey;
|
|
41538
|
+
}
|
|
41539
|
+
}
|
|
41540
|
+
/**
|
|
41541
|
+
* Where the native walk of the current arc meets the scan line at `lineY` (a multiple of the precision in the
|
|
41542
|
+
* sweep's own axes), in the sweep's x.
|
|
41543
|
+
*/
|
|
41544
|
+
nativeCrossing(lineY) {
|
|
41545
|
+
const a = this.arcRecord;
|
|
41546
|
+
const flipped = this.arcFlipped;
|
|
41547
|
+
const raw = lineY * 64 / this.prec + 32;
|
|
41548
|
+
const start = flipped ? a.x0 : a.y0;
|
|
41549
|
+
const sA = flipped ? a.sx : a.sy;
|
|
41550
|
+
const dA = flipped ? a.dx : a.dy;
|
|
41551
|
+
const aA = flipped ? a.ax : a.ay;
|
|
41552
|
+
const fA0 = flipped ? a.fx0 : a.fy0;
|
|
41553
|
+
const fA = flipped ? a.fx : a.fy;
|
|
41554
|
+
const dB = flipped ? a.dy : a.dx;
|
|
41555
|
+
const aB = flipped ? a.ay : a.ax;
|
|
41556
|
+
const sB = flipped ? a.sy : a.sx;
|
|
41557
|
+
const startB = flipped ? a.y0 : a.x0;
|
|
41558
|
+
const fB = flipped ? a.fy : a.fx;
|
|
41559
|
+
const fB0 = flipped ? a.fy0 : a.fx0;
|
|
41560
|
+
const line = sA * (raw - start);
|
|
41561
|
+
const index = Math.round((line - fA0) / 64);
|
|
41562
|
+
const dist = fA + 64 * index;
|
|
41563
|
+
let t = 1;
|
|
41564
|
+
if (dist < dA) {
|
|
41565
|
+
const b = 2 * aA;
|
|
41566
|
+
const c = dA - 2 * aA;
|
|
41567
|
+
t = 2 * dist / (b + Math.sqrt(b * b + 4 * c * dist));
|
|
41568
|
+
}
|
|
41569
|
+
const along = 2 * t * aB + t * t * (dB - 2 * aB);
|
|
41570
|
+
return Math.round((startB + sB * (along + fB0 - fB)) * this.prec / 64 - this.precHalf);
|
|
41571
|
+
}
|
|
41572
|
+
/** {@link bezierUp} for an arc walked natively: one pass over its scan lines, the crossings from {@link nativeCrossing}. */
|
|
41573
|
+
nativeBezier(down, miny, maxy) {
|
|
41574
|
+
const X = this.arcX;
|
|
41575
|
+
const Y = this.arcY;
|
|
41576
|
+
const sg = down ? -1 : 1;
|
|
41577
|
+
const mn = down ? -maxy : miny;
|
|
41578
|
+
const mx = down ? -miny : maxy;
|
|
41579
|
+
const y1 = sg * Y[2];
|
|
41580
|
+
const y2 = sg * Y[0];
|
|
41581
|
+
const xs = this.cProfile.xs;
|
|
41582
|
+
const fresh = this.fresh;
|
|
41583
|
+
this.arc -= 2;
|
|
41584
|
+
if (y2 < mn || y1 > mx) return;
|
|
41585
|
+
let e2 = this.floorP(y2);
|
|
41586
|
+
if (e2 > mx) e2 = mx;
|
|
41587
|
+
let e0 = mn;
|
|
41588
|
+
let e;
|
|
41589
|
+
if (y1 < mn) {
|
|
41590
|
+
e = mn;
|
|
41591
|
+
} else {
|
|
41592
|
+
e = this.ceilP(y1);
|
|
41593
|
+
e0 = e;
|
|
41594
|
+
if (this.frac(y1) === 0) {
|
|
41595
|
+
if (this.joint) {
|
|
41596
|
+
xs.pop();
|
|
41597
|
+
this.joint = false;
|
|
41598
|
+
}
|
|
41599
|
+
xs.push(X[2]);
|
|
41600
|
+
e += this.prec;
|
|
41601
|
+
}
|
|
41602
|
+
}
|
|
41603
|
+
if (this.fresh) {
|
|
41604
|
+
this.cProfile.start = this.trunc(e0);
|
|
41605
|
+
this.fresh = false;
|
|
41606
|
+
}
|
|
41607
|
+
for (; e <= e2; e += this.prec) {
|
|
41608
|
+
this.joint = false;
|
|
41609
|
+
if (y2 > e) {
|
|
41610
|
+
xs.push(this.nativeCrossing(sg * e));
|
|
41611
|
+
} else {
|
|
41612
|
+
this.joint = true;
|
|
41613
|
+
xs.push(X[0]);
|
|
41614
|
+
}
|
|
41615
|
+
}
|
|
41616
|
+
if (down && fresh && !this.fresh) this.cProfile.start = -this.cProfile.start;
|
|
41617
|
+
}
|
|
40597
41618
|
decomposeContour(o, first, last, flipped) {
|
|
40598
41619
|
const px = (i) => this.scaled(flipped ? o.ys[i] : o.xs[i]);
|
|
40599
41620
|
const py = (i) => this.scaled(flipped ? o.xs[i] : o.ys[i]);
|
|
@@ -40606,12 +41627,30 @@ var Raster = class {
|
|
|
40606
41627
|
const lastY = py(last);
|
|
40607
41628
|
let limit = last;
|
|
40608
41629
|
let point = first;
|
|
41630
|
+
const native = this.nativeArcs && this.roundImpliedPoints;
|
|
41631
|
+
let curTx = o.xs[first];
|
|
41632
|
+
let curTy = o.ys[first];
|
|
41633
|
+
let startTx = curTx;
|
|
41634
|
+
let startTy = curTy;
|
|
41635
|
+
const arc = (tcx, tcy, tex, tey, cx, cy, x, y) => {
|
|
41636
|
+
if (native) {
|
|
41637
|
+
this.nativeConic(flipped, curTx, curTy, tcx, tcy, tex, tey);
|
|
41638
|
+
curTx = tex;
|
|
41639
|
+
curTy = tey;
|
|
41640
|
+
} else {
|
|
41641
|
+
this.conicTo(cx, cy, x, y);
|
|
41642
|
+
}
|
|
41643
|
+
};
|
|
40609
41644
|
if (!o.onCurve[first]) {
|
|
40610
41645
|
if (o.onCurve[last]) {
|
|
40611
41646
|
startX = lastX;
|
|
40612
41647
|
startY = lastY;
|
|
41648
|
+
startTx = curTx = o.xs[last];
|
|
41649
|
+
startTy = curTy = o.ys[last];
|
|
40613
41650
|
limit--;
|
|
40614
41651
|
} else {
|
|
41652
|
+
startTx = curTx = Math.floor((o.xs[first] + o.xs[last] + 1) / 2);
|
|
41653
|
+
startTy = curTy = Math.floor((o.ys[first] + o.ys[last] + 1) / 2);
|
|
40615
41654
|
if (this.roundImpliedPoints) {
|
|
40616
41655
|
startX = mid(rx(first), rx(last));
|
|
40617
41656
|
startY = mid(ry(first), ry(last));
|
|
@@ -40628,12 +41667,16 @@ var Raster = class {
|
|
|
40628
41667
|
point++;
|
|
40629
41668
|
if (o.onCurve[point]) {
|
|
40630
41669
|
this.lineTo(px(point), py(point));
|
|
41670
|
+
curTx = o.xs[point];
|
|
41671
|
+
curTy = o.ys[point];
|
|
40631
41672
|
continue;
|
|
40632
41673
|
}
|
|
40633
41674
|
let cx = px(point);
|
|
40634
41675
|
let cy = py(point);
|
|
40635
41676
|
let cxRaw = rx(point);
|
|
40636
41677
|
let cyRaw = ry(point);
|
|
41678
|
+
let ctx = o.xs[point];
|
|
41679
|
+
let cty = o.ys[point];
|
|
40637
41680
|
let closed = false;
|
|
40638
41681
|
while (true) {
|
|
40639
41682
|
if (point < limit) {
|
|
@@ -40641,11 +41684,11 @@ var Raster = class {
|
|
|
40641
41684
|
const x = px(point);
|
|
40642
41685
|
const y = py(point);
|
|
40643
41686
|
if (o.onCurve[point]) {
|
|
40644
|
-
|
|
41687
|
+
arc(ctx, cty, o.xs[point], o.ys[point], cx, cy, x, y);
|
|
40645
41688
|
break;
|
|
40646
41689
|
}
|
|
40647
41690
|
if (this.roundImpliedPoints) {
|
|
40648
|
-
|
|
41691
|
+
arc(ctx, cty, Math.floor((ctx + o.xs[point] + 1) / 2), Math.floor((cty + o.ys[point] + 1) / 2), cx, cy, mid(cxRaw, rx(point)), mid(cyRaw, ry(point)));
|
|
40649
41692
|
} else {
|
|
40650
41693
|
this.conicTo(cx, cy, Math.trunc((cx + x) / 2), Math.trunc((cy + y) / 2));
|
|
40651
41694
|
}
|
|
@@ -40653,9 +41696,11 @@ var Raster = class {
|
|
|
40653
41696
|
cy = y;
|
|
40654
41697
|
cxRaw = rx(point);
|
|
40655
41698
|
cyRaw = ry(point);
|
|
41699
|
+
ctx = o.xs[point];
|
|
41700
|
+
cty = o.ys[point];
|
|
40656
41701
|
continue;
|
|
40657
41702
|
}
|
|
40658
|
-
|
|
41703
|
+
arc(ctx, cty, startTx, startTy, cx, cy, startX, startY);
|
|
40659
41704
|
closed = true;
|
|
40660
41705
|
break;
|
|
40661
41706
|
}
|
|
@@ -41029,6 +42074,69 @@ function flattenForStubs(o) {
|
|
|
41029
42074
|
}
|
|
41030
42075
|
return { xs, ys, onCurve: new Array(xs.length).fill(1), endPts };
|
|
41031
42076
|
}
|
|
42077
|
+
var ScanLists = class {
|
|
42078
|
+
constructor(count, P) {
|
|
42079
|
+
this.P = P;
|
|
42080
|
+
this.pairs = Array.from({ length: count }, () => []);
|
|
42081
|
+
}
|
|
42082
|
+
add(line, x1, x2) {
|
|
42083
|
+
if (line < 0 || line >= this.pairs.length) return;
|
|
42084
|
+
this.pairs[line].push({ start: Math.ceil(x1 / this.P), stop: Math.floor(x2 / this.P) + 1, x1, x2 });
|
|
42085
|
+
}
|
|
42086
|
+
/** Entries of `line` whose start or stop is `value` (native `HorizCrossings` / `VertCrossings`; 0 outside the box). */
|
|
42087
|
+
count(line, value) {
|
|
42088
|
+
if (line < 0 || line >= this.pairs.length) return 0;
|
|
42089
|
+
let n = 0;
|
|
42090
|
+
for (const p of this.pairs[line]) n += (p.start === value ? 1 : 0) + (p.stop === value ? 1 : 0);
|
|
42091
|
+
return n;
|
|
42092
|
+
}
|
|
42093
|
+
};
|
|
42094
|
+
var NativeScanLists = class {
|
|
42095
|
+
constructor(width, height, P) {
|
|
42096
|
+
this.width = width;
|
|
42097
|
+
this.height = height;
|
|
42098
|
+
this.rows = new ScanLists(height, P);
|
|
42099
|
+
this.cols = new ScanLists(width, P);
|
|
42100
|
+
}
|
|
42101
|
+
};
|
|
42102
|
+
function nativeDropoutPass(lists, mode, data, width, height, smartPixel, raster) {
|
|
42103
|
+
const stubs = mode === 1 || mode === 5;
|
|
42104
|
+
const smart = mode === 4 || mode === 5;
|
|
42105
|
+
const P = raster.precision;
|
|
42106
|
+
const at = (col, row2) => (height - 1 - row2) * width + col;
|
|
42107
|
+
const step = P / 64;
|
|
42108
|
+
const pick = (x1, x2, start) => smart ? Math.floor((Math.floor(x1 / step) + Math.floor(x2 / step) + 63) / 128) : start - 1;
|
|
42109
|
+
for (let y = height - 1; y >= 0; y--) {
|
|
42110
|
+
for (const p of lists.rows.pairs[y]) {
|
|
42111
|
+
if (p.start !== p.stop) continue;
|
|
42112
|
+
const x = p.start;
|
|
42113
|
+
if (stubs) {
|
|
42114
|
+
if (lists.rows.count(y + 1, x) + lists.cols.count(x - 1, y + 1) + lists.cols.count(x, y + 1) < 2) continue;
|
|
42115
|
+
if (lists.rows.count(y - 1, x) + lists.cols.count(x - 1, y) + lists.cols.count(x, y) < 2) continue;
|
|
42116
|
+
}
|
|
42117
|
+
if (x > 0 && x - 1 < width && data[at(x - 1, y)]) continue;
|
|
42118
|
+
if (x < width && x >= 0 && data[at(x, y)]) continue;
|
|
42119
|
+
const c = Math.max(0, pick(p.x1, p.x2, x));
|
|
42120
|
+
if (c < width) data[at(c, y)] = 1;
|
|
42121
|
+
}
|
|
42122
|
+
}
|
|
42123
|
+
for (let c = 0; c < width; c++) {
|
|
42124
|
+
for (let k = lists.cols.pairs[c].length - 1; k >= 0; k--) {
|
|
42125
|
+
const p = lists.cols.pairs[c][k];
|
|
42126
|
+
if (p.start !== p.stop) continue;
|
|
42127
|
+
const r = p.start;
|
|
42128
|
+
if (r < 0 || r > height) continue;
|
|
42129
|
+
if (stubs) {
|
|
42130
|
+
if (lists.cols.count(c - 1, r) + lists.rows.count(r, c) + lists.rows.count(r - 1, c) < 2) continue;
|
|
42131
|
+
if (lists.cols.count(c + 1, r) + lists.rows.count(r, c + 1) + lists.rows.count(r - 1, c + 1) < 2) continue;
|
|
42132
|
+
}
|
|
42133
|
+
if (r > 0 && r - 1 < height && data[at(c, r - 1)]) continue;
|
|
42134
|
+
if (r < height && data[at(c, r)]) continue;
|
|
42135
|
+
const row2 = Math.max(0, pick(p.x1, p.x2, r));
|
|
42136
|
+
if (row2 < height) data[at(c, row2)] = 1;
|
|
42137
|
+
}
|
|
42138
|
+
}
|
|
42139
|
+
}
|
|
41032
42140
|
var StubSquares = class {
|
|
41033
42141
|
constructor(o) {
|
|
41034
42142
|
this.contours = [];
|
|
@@ -41147,7 +42255,7 @@ function monoBox(o) {
|
|
|
41147
42255
|
if (collapsedY) yMax += 1;
|
|
41148
42256
|
return { xMin, xMax, yMin, yMax, collapsedX, collapsedY };
|
|
41149
42257
|
}
|
|
41150
|
-
function rasterizeMono(o, dropout, fixedBox, stubOvershoot = true, smartCrossings26Dot6 = false, roundImpliedPoints = false, directedTies = false, fineArcs = false, closedTies = false, squareStubs = false) {
|
|
42258
|
+
function rasterizeMono(o, dropout, fixedBox, stubOvershoot = true, smartCrossings26Dot6 = false, roundImpliedPoints = false, directedTies = false, fineArcs = false, closedTies = false, squareStubs = false, nativeDropouts = false) {
|
|
41151
42259
|
const box = fixedBox ?? monoBox(o);
|
|
41152
42260
|
if (!box) {
|
|
41153
42261
|
return null;
|
|
@@ -41169,6 +42277,7 @@ function rasterizeMono(o, dropout, fixedBox, stubOvershoot = true, smartCrossing
|
|
|
41169
42277
|
const at = (col, row2) => (height - 1 - row2) * width + col;
|
|
41170
42278
|
const r = new Raster(dropout, fineArcs);
|
|
41171
42279
|
r.roundImpliedPoints = roundImpliedPoints;
|
|
42280
|
+
r.nativeArcs = nativeDropouts;
|
|
41172
42281
|
r.directedTies = directedTies;
|
|
41173
42282
|
const P = r.precision;
|
|
41174
42283
|
const monoContour = !squareStubs && stubOvershoot && (dropout === 1 || dropout === 4 || dropout === 5) ? MonoStubContours.create(local) : null;
|
|
@@ -41183,9 +42292,11 @@ function rasterizeMono(o, dropout, fixedBox, stubOvershoot = true, smartCrossing
|
|
|
41183
42292
|
}
|
|
41184
42293
|
return raster.floorPub(Math.floor((x1 + x2 + Math.floor(P * 63 / 64)) / 2));
|
|
41185
42294
|
};
|
|
42295
|
+
const native = nativeDropouts && dropout !== 2 ? new NativeScanLists(width, height, P) : null;
|
|
41186
42296
|
if (r.convert(local, false, 0, (height - 1) * P)) {
|
|
41187
42297
|
r.sweep(
|
|
41188
42298
|
(y, x1, x2) => {
|
|
42299
|
+
native?.rows.add(y, x1, x2);
|
|
41189
42300
|
let e1 = r.ceilPub(x1);
|
|
41190
42301
|
let e2 = r.floorPub(x2);
|
|
41191
42302
|
if (dropout !== 2 && x2 - x1 - P <= r.jitter && e1 !== x1 && e2 !== x2) {
|
|
@@ -41200,6 +42311,10 @@ function rasterizeMono(o, dropout, fixedBox, stubOvershoot = true, smartCrossing
|
|
|
41200
42311
|
}
|
|
41201
42312
|
},
|
|
41202
42313
|
(y, x1, x2, left, right) => {
|
|
42314
|
+
if (native) {
|
|
42315
|
+
native.rows.add(y, x1, x2);
|
|
42316
|
+
return;
|
|
42317
|
+
}
|
|
41203
42318
|
let e1 = r.ceilPub(x1);
|
|
41204
42319
|
let e2 = r.floorPub(x2);
|
|
41205
42320
|
let pxl = e1;
|
|
@@ -41247,9 +42362,12 @@ function rasterizeMono(o, dropout, fixedBox, stubOvershoot = true, smartCrossing
|
|
|
41247
42362
|
if (dropout !== 2) {
|
|
41248
42363
|
const h = new Raster(dropout, fineArcs);
|
|
41249
42364
|
h.directedTies = directedTies;
|
|
42365
|
+
h.roundImpliedPoints = roundImpliedPoints && nativeDropouts;
|
|
42366
|
+
h.nativeArcs = nativeDropouts;
|
|
41250
42367
|
if (h.convert(local, true, 0, (width - 1) * P)) {
|
|
41251
42368
|
h.sweep(
|
|
41252
42369
|
(col, x1, x2) => {
|
|
42370
|
+
native?.cols.add(col, x1, x2);
|
|
41253
42371
|
if (x2 - x1 < P) {
|
|
41254
42372
|
const e1 = h.ceilPub(x1);
|
|
41255
42373
|
const e2 = h.floorPub(x2);
|
|
@@ -41262,6 +42380,10 @@ function rasterizeMono(o, dropout, fixedBox, stubOvershoot = true, smartCrossing
|
|
|
41262
42380
|
}
|
|
41263
42381
|
},
|
|
41264
42382
|
(col, x1, x2, left, right) => {
|
|
42383
|
+
if (native) {
|
|
42384
|
+
native.cols.add(col, x1, x2);
|
|
42385
|
+
return;
|
|
42386
|
+
}
|
|
41265
42387
|
let e1 = h.ceilPub(x1);
|
|
41266
42388
|
const e2 = h.floorPub(x2);
|
|
41267
42389
|
let pxl = e1;
|
|
@@ -41307,11 +42429,12 @@ function rasterizeMono(o, dropout, fixedBox, stubOvershoot = true, smartCrossing
|
|
|
41307
42429
|
);
|
|
41308
42430
|
}
|
|
41309
42431
|
}
|
|
42432
|
+
if (native) nativeDropoutPass(native, dropout, data, width, height, smartPixel, r);
|
|
41310
42433
|
if (closedTies) fillTieRows(local, curved, data, width, height, at);
|
|
41311
42434
|
return { width, height, left: box.xMin, top: box.yMax, data };
|
|
41312
42435
|
}
|
|
41313
42436
|
var GRAY_OVERSAMPLE = 4;
|
|
41314
|
-
function rasterizeSamples(o, kx, ky, padX = 0, dropout = 2, stubOvershoot = true, fineArcs = false, closedTies = false, squareStubs = false, roundImpliedPoints = false) {
|
|
42437
|
+
function rasterizeSamples(o, kx, ky, padX = 0, dropout = 2, stubOvershoot = true, fineArcs = false, closedTies = false, squareStubs = false, roundImpliedPoints = false, nativeDropouts = false) {
|
|
41315
42438
|
const n = o.xs.length;
|
|
41316
42439
|
if (n === 0) {
|
|
41317
42440
|
return null;
|
|
@@ -41340,7 +42463,7 @@ function rasterizeSamples(o, kx, ky, padX = 0, dropout = 2, stubOvershoot = true
|
|
|
41340
42463
|
onCurve: o.onCurve,
|
|
41341
42464
|
endPts: o.endPts
|
|
41342
42465
|
};
|
|
41343
|
-
const hi = rasterizeMono(big, dropout, { xMin: box.xMin * kx, xMax: box.xMax * kx, yMin: box.yMin * ky, yMax: box.yMax * ky }, stubOvershoot, false, roundImpliedPoints, false, fineArcs, closedTies, squareStubs);
|
|
42466
|
+
const hi = rasterizeMono(big, dropout, { xMin: box.xMin * kx, xMax: box.xMax * kx, yMin: box.yMin * ky, yMax: box.yMax * ky }, stubOvershoot, false, roundImpliedPoints, false, fineArcs, closedTies, squareStubs, nativeDropouts);
|
|
41344
42467
|
return hi ? { box, hi } : null;
|
|
41345
42468
|
}
|
|
41346
42469
|
function rasterizeGray(o, dropout = 2, roundImpliedPoints = false, fineArcs = false, squareStubs = false) {
|
|
@@ -41396,6 +42519,7 @@ var NONANTIALIASED_QUALITY = 3;
|
|
|
41396
42519
|
var ANTIALIASED_QUALITY = 4;
|
|
41397
42520
|
var CLEARTYPE_QUALITY = 5;
|
|
41398
42521
|
var CLEARTYPE_NATURAL_QUALITY = 6;
|
|
42522
|
+
var UNHINTED_MONO_DROPOUT = 1;
|
|
41399
42523
|
var NOTDEF = 0;
|
|
41400
42524
|
var FONT_SUBSTITUTES = {
|
|
41401
42525
|
"ms shell dlg": "microsoft sans serif",
|
|
@@ -41436,8 +42560,8 @@ var RASTER_SUBSTITUTES = {
|
|
|
41436
42560
|
"tms rmn": "ms serif"
|
|
41437
42561
|
};
|
|
41438
42562
|
var ITALIC_SHEAR = 22272 / 65536;
|
|
41439
|
-
function isItalicFace(
|
|
41440
|
-
return (
|
|
42563
|
+
function isItalicFace(f2) {
|
|
42564
|
+
return (f2.fsSelection & 1) !== 0 || (f2.macStyle & 2) !== 0;
|
|
41441
42565
|
}
|
|
41442
42566
|
var CP1252_HIGH = [
|
|
41443
42567
|
8364,
|
|
@@ -42011,13 +43135,13 @@ var RealizedFont = class {
|
|
|
42011
43135
|
if (this.mode === "mono") {
|
|
42012
43136
|
const smartGrid = !m && !subX && !subY && (!this.gdiPlus || this.ppemX === this.ppem && !this.syntheticItalic);
|
|
42013
43137
|
const controlOn = src.scanSet ? src.scanControl : this.ppem <= DEFAULT_DROPOUT_PPEM;
|
|
42014
|
-
bitmap = this.gdiPlus ? rasterizeMono(o, dropoutMode(controlOn, src.scanType), void 0, true, smartGrid, false, false, false, false, true) : msMonoBitmap(o, msScanFlags(controlOn, src.scanType));
|
|
43138
|
+
bitmap = this.gdiPlus ? rasterizeMono(o, this.gdiPlus && !this.gridFit ? UNHINTED_MONO_DROPOUT : dropoutMode(controlOn, src.scanType), void 0, true, smartGrid, false, false, false, false, true) : msMonoBitmap(o, msScanFlags(controlOn, src.scanType));
|
|
42015
43139
|
} else if (this.mode === "cleartype") {
|
|
42016
|
-
const dropout = src.scanSet ? dropoutMode(src.scanControl, src.scanType) : 2;
|
|
43140
|
+
const dropout = src.scanSet ? dropoutMode(src.scanControl, src.scanType) : !this.gdiPlus ? 0 : 2;
|
|
42017
43141
|
bitmap = rasterizeClearType(o, this.gdiPlus, this.gdiPlus ? clearTypeSpread(this.ttf) : void 0, dropout, !this.gdiPlus && clearTypeSmoothsVertically(this.ttf, this.ppem));
|
|
42018
43142
|
} else {
|
|
42019
43143
|
const dropout = this.gdiPlus ? src.scanSet ? dropoutMode(src.scanControl, src.scanType) : 2 : msScanFlags(src.scanSet ? src.scanControl : this.ppem <= DEFAULT_DROPOUT_PPEM, src.scanType);
|
|
42020
|
-
bitmap = this.gdiPlus && !this.gridFit && !m && !this.syntheticBold && !this.syntheticItalic && this.ttf.weightClass < 600 && this.ttf.family.toLowerCase() === "courier new" ? rasterizeCourierGray(o, dropout) : this.gdiPlus ? rasterizeGray(o, dropout, false, false, true) : msGrayBitmap(o, dropout);
|
|
43144
|
+
bitmap = this.gdiPlus && !this.gridFit && !m && !this.syntheticBold && !this.syntheticItalic && this.ttf.weightClass < 600 && this.ttf.family.toLowerCase() === "courier new" ? rasterizeCourierGray(o, dropout) : this.gdiPlus && !this.installed ? rasterizeGray(o, dropout, false, false, true) : msGrayBitmap(o, dropout);
|
|
42021
43145
|
}
|
|
42022
43146
|
if (bitmap && this.syntheticBold) {
|
|
42023
43147
|
bitmap = embolden(bitmap, this.mode === "mono" ? 1 : 16);
|
|
@@ -42045,27 +43169,32 @@ function roundedRotationMatrix(m, ppem) {
|
|
|
42045
43169
|
return [Math.round(m[0] * p) / p, Math.round(m[1] * p) / p, Math.round(m[2] * p) / p, Math.round(m[3] * p) / p];
|
|
42046
43170
|
}
|
|
42047
43171
|
function rotationMatrix(m, ppem, integerPpem) {
|
|
42048
|
-
const
|
|
43172
|
+
const xLength = Math.hypot(m[0], m[1]);
|
|
43173
|
+
const yLength = Math.hypot(m[2], m[3]);
|
|
43174
|
+
const stretch = yLength > 0 ? xLength / yLength : 0;
|
|
43175
|
+
const isRotation = stretch > 0.9 && stretch < 1.1 && Math.abs(m[0] * m[2] + m[1] * m[3]) < 1e-6 * xLength * yLength;
|
|
42049
43176
|
if (!isRotation || ppem <= 0) {
|
|
42050
43177
|
return null;
|
|
42051
43178
|
}
|
|
42052
43179
|
if (!integerPpem) {
|
|
42053
43180
|
return { ppem: 0, matrix: [m[0], m[1], m[2], m[3]] };
|
|
42054
43181
|
}
|
|
42055
|
-
const
|
|
42056
|
-
|
|
42057
|
-
|
|
42058
|
-
|
|
43182
|
+
const normalise = (vx, vy) => {
|
|
43183
|
+
const ax = Math.abs(vx);
|
|
43184
|
+
const ay = Math.abs(vy);
|
|
43185
|
+
const majorFixed = Math.round(Math.max(ax, ay) * ppem * 32);
|
|
43186
|
+
const q = Math.round(Math.round(Math.min(ax, ay) * ppem * 32) / majorFixed * 65536) / 65536;
|
|
43187
|
+
const sx = vx < 0 ? -1 : 1;
|
|
43188
|
+
const sy = vy < 0 ? -1 : 1;
|
|
43189
|
+
return ax >= ay ? { x: sx, y: sy * q, majorFixed } : { x: sx * q, y: sy, majorFixed };
|
|
43190
|
+
};
|
|
43191
|
+
const xv = normalise(m[0], -m[1]);
|
|
43192
|
+
const yv = normalise(-m[2], m[3]);
|
|
43193
|
+
const target = Math.floor((xv.majorFixed + 16) / 32);
|
|
42059
43194
|
if (target < 1) {
|
|
42060
43195
|
return null;
|
|
42061
43196
|
}
|
|
42062
|
-
|
|
42063
|
-
const xMajor = Math.abs(m[0]) >= Math.abs(m[1]);
|
|
42064
|
-
const sg = (v) => v < 0 ? -1 : 1;
|
|
42065
|
-
return {
|
|
42066
|
-
ppem: target,
|
|
42067
|
-
matrix: xMajor ? [sg(m[0]), sg(m[1]) * q, sg(m[2]) * q, sg(m[3])] : [sg(m[0]) * q, sg(m[1]), sg(m[2]), sg(m[3]) * q]
|
|
42068
|
-
};
|
|
43197
|
+
return { ppem: target, matrix: [xv.x, -xv.y, -yv.x, yv.y] };
|
|
42069
43198
|
}
|
|
42070
43199
|
function embolden(b, full) {
|
|
42071
43200
|
const w = b.width + 1;
|
|
@@ -42133,7 +43262,7 @@ var GdiFontCollection = class _GdiFontCollection {
|
|
|
42133
43262
|
const list = this.families.get(k);
|
|
42134
43263
|
if (!list) {
|
|
42135
43264
|
this.families.set(k, [face]);
|
|
42136
|
-
} else if (!list.some((
|
|
43265
|
+
} else if (!list.some((f2) => f2.family.toLowerCase().trim() === k)) {
|
|
42137
43266
|
list.push(face);
|
|
42138
43267
|
}
|
|
42139
43268
|
}
|
|
@@ -42151,9 +43280,9 @@ var GdiFontCollection = class _GdiFontCollection {
|
|
|
42151
43280
|
return m;
|
|
42152
43281
|
}
|
|
42153
43282
|
}
|
|
42154
|
-
const
|
|
42155
|
-
if (
|
|
42156
|
-
return this.families.get(
|
|
43283
|
+
const sub4 = FONT_SUBSTITUTES[k];
|
|
43284
|
+
if (sub4 && this.families.get(sub4)) {
|
|
43285
|
+
return this.families.get(sub4);
|
|
42157
43286
|
}
|
|
42158
43287
|
const family = pitchAndFamily & 240;
|
|
42159
43288
|
const fixed = (pitchAndFamily & 3) === 1;
|
|
@@ -42171,7 +43300,7 @@ var GdiFontCollection = class _GdiFontCollection {
|
|
|
42171
43300
|
}
|
|
42172
43301
|
if (height === 0) {
|
|
42173
43302
|
const sorted = faces.slice().sort((a, b) => a.pixHeight - b.pixHeight);
|
|
42174
|
-
const face = sorted.find((
|
|
43303
|
+
const face = sorted.find((f2) => f2.points >= 10) ?? sorted[0];
|
|
42175
43304
|
return { face, scale: 1, scaleX: 1 };
|
|
42176
43305
|
}
|
|
42177
43306
|
const pick = pickRasterFace(faces, height, width, weight);
|
|
@@ -42204,8 +43333,8 @@ var GdiFontCollection = class _GdiFontCollection {
|
|
|
42204
43333
|
if (!pick || pick.scale !== 1 || pick.face.pixHeight > 16) {
|
|
42205
43334
|
return 0;
|
|
42206
43335
|
}
|
|
42207
|
-
const
|
|
42208
|
-
return
|
|
43336
|
+
const f2 = pick.face;
|
|
43337
|
+
return f2.pixHeight <= ttCell + 1 ? f2.pixHeight - f2.internalLeading : 0;
|
|
42209
43338
|
}
|
|
42210
43339
|
/** Realises `spec`, or null when no supplied font can stand in for it. */
|
|
42211
43340
|
realize(spec, fontFamilyMap) {
|
|
@@ -42229,11 +43358,11 @@ var GdiFontCollection = class _GdiFontCollection {
|
|
|
42229
43358
|
const weight = spec.weight || 400;
|
|
42230
43359
|
let best = faces[0];
|
|
42231
43360
|
let bestScore = Infinity;
|
|
42232
|
-
for (const
|
|
42233
|
-
const dw =
|
|
42234
|
-
const score2 = (isItalicFace(
|
|
43361
|
+
for (const f2 of faces) {
|
|
43362
|
+
const dw = f2.weightClass - weight;
|
|
43363
|
+
const score2 = (isItalicFace(f2) !== spec.italic ? 1e4 : 0) + (dw > 0 ? dw * 3 : -dw);
|
|
42235
43364
|
if (score2 < bestScore) {
|
|
42236
|
-
best =
|
|
43365
|
+
best = f2;
|
|
42237
43366
|
bestScore = score2;
|
|
42238
43367
|
}
|
|
42239
43368
|
}
|
|
@@ -42389,7 +43518,7 @@ function rasterizeClearType(o, truncate = false, spread, dropout = 2, vertical =
|
|
|
42389
43518
|
const KY = vertical ? CLEARTYPE_ROWS : 1;
|
|
42390
43519
|
const WT = vertical ? CLEARTYPE_ROW_WEIGHTS : [1];
|
|
42391
43520
|
const WSUM = WT.reduce((a, c) => a + c, 0);
|
|
42392
|
-
const r = rasterizeSamples(o, CLEARTYPE_OVERSAMPLE, KY, 1, dropout, false, !truncate, !truncate, true, !truncate);
|
|
43521
|
+
const r = rasterizeSamples(o, CLEARTYPE_OVERSAMPLE, KY, 1, dropout, false, !truncate, !truncate, true, !truncate, !truncate);
|
|
42393
43522
|
if (!r) {
|
|
42394
43523
|
return null;
|
|
42395
43524
|
}
|
|
@@ -42397,10 +43526,10 @@ function rasterizeClearType(o, truncate = false, spread, dropout = 2, vertical =
|
|
|
42397
43526
|
const width = box.xMax - box.xMin;
|
|
42398
43527
|
const height = box.yMax - box.yMin;
|
|
42399
43528
|
const n = width * 3;
|
|
42400
|
-
const
|
|
43529
|
+
const sub4 = new Float64Array(n);
|
|
42401
43530
|
const data = new Uint8Array(n * height);
|
|
42402
43531
|
for (let y = 0; y < height; y++) {
|
|
42403
|
-
|
|
43532
|
+
sub4.fill(0);
|
|
42404
43533
|
for (let yy = 0; yy < KY; yy++) {
|
|
42405
43534
|
const row2 = (y * KY + yy) * hi.width;
|
|
42406
43535
|
for (let x = 0; x < hi.width; x++) {
|
|
@@ -42411,15 +43540,15 @@ function rasterizeClearType(o, truncate = false, spread, dropout = 2, vertical =
|
|
|
42411
43540
|
}
|
|
42412
43541
|
}
|
|
42413
43542
|
if (on) {
|
|
42414
|
-
|
|
43543
|
+
sub4[Math.floor(x / S)] += WT[yy] ?? 1;
|
|
42415
43544
|
}
|
|
42416
43545
|
}
|
|
42417
43546
|
}
|
|
42418
43547
|
for (let j = 0; j < n; j++) {
|
|
42419
|
-
const before = j > 0 ?
|
|
42420
|
-
const after = j + 1 < n ?
|
|
42421
|
-
let acc = before +
|
|
42422
|
-
if (spread && acc === 1 &&
|
|
43548
|
+
const before = j > 0 ? sub4[j - 1] : 0;
|
|
43549
|
+
const after = j + 1 < n ? sub4[j + 1] : 0;
|
|
43550
|
+
let acc = before + sub4[j] + after;
|
|
43551
|
+
if (spread && acc === 1 && sub4[j] === 0 && (j % 3 === 0 && before === 1 || (j + 1) % 3 === 0 && after === 1)) {
|
|
42423
43552
|
acc = 0;
|
|
42424
43553
|
}
|
|
42425
43554
|
data[y * n + j] = vertical ? Math.floor((acc + WSUM / 2) / WSUM) : (truncate ? Math.floor : Math.round)(255 * acc / (3 * S * WSUM));
|
|
@@ -42997,7 +44126,7 @@ function measurePathBox(build, pad, surface) {
|
|
|
42997
44126
|
let tx = 0;
|
|
42998
44127
|
let ty = 0;
|
|
42999
44128
|
let unknown = false;
|
|
43000
|
-
const
|
|
44129
|
+
const add3 = (x, y, r = 0) => {
|
|
43001
44130
|
minX = Math.min(minX, x + tx - r);
|
|
43002
44131
|
minY = Math.min(minY, y + ty - r);
|
|
43003
44132
|
maxX = Math.max(maxX, x + tx + r);
|
|
@@ -43007,35 +44136,35 @@ function measurePathBox(build, pad, surface) {
|
|
|
43007
44136
|
unknown = true;
|
|
43008
44137
|
};
|
|
43009
44138
|
const recorder = {
|
|
43010
|
-
moveTo: (x, y) =>
|
|
43011
|
-
lineTo: (x, y) =>
|
|
44139
|
+
moveTo: (x, y) => add3(x, y),
|
|
44140
|
+
lineTo: (x, y) => add3(x, y),
|
|
43012
44141
|
rect: (x, y, w, h) => {
|
|
43013
|
-
|
|
43014
|
-
|
|
44142
|
+
add3(x, y);
|
|
44143
|
+
add3(x + w, y + h);
|
|
43015
44144
|
},
|
|
43016
44145
|
fillRect: (x, y, w, h) => {
|
|
43017
|
-
|
|
43018
|
-
|
|
44146
|
+
add3(x, y);
|
|
44147
|
+
add3(x + w, y + h);
|
|
43019
44148
|
},
|
|
43020
44149
|
strokeRect: (x, y, w, h) => {
|
|
43021
|
-
|
|
43022
|
-
|
|
44150
|
+
add3(x, y);
|
|
44151
|
+
add3(x + w, y + h);
|
|
43023
44152
|
},
|
|
43024
44153
|
bezierCurveTo: (ax, ay, bx, by, x, y) => {
|
|
43025
|
-
|
|
43026
|
-
|
|
43027
|
-
|
|
44154
|
+
add3(ax, ay);
|
|
44155
|
+
add3(bx, by);
|
|
44156
|
+
add3(x, y);
|
|
43028
44157
|
},
|
|
43029
44158
|
quadraticCurveTo: (ax, ay, x, y) => {
|
|
43030
|
-
|
|
43031
|
-
|
|
44159
|
+
add3(ax, ay);
|
|
44160
|
+
add3(x, y);
|
|
43032
44161
|
},
|
|
43033
44162
|
arcTo: (x12, y12, x2, y2) => {
|
|
43034
|
-
|
|
43035
|
-
|
|
44163
|
+
add3(x12, y12);
|
|
44164
|
+
add3(x2, y2);
|
|
43036
44165
|
},
|
|
43037
|
-
arc: (x, y, r) =>
|
|
43038
|
-
ellipse: (x, y, rx, ry) =>
|
|
44166
|
+
arc: (x, y, r) => add3(x, y, Math.abs(r)),
|
|
44167
|
+
ellipse: (x, y, rx, ry) => add3(x, y, Math.max(Math.abs(rx), Math.abs(ry))),
|
|
43039
44168
|
translate: (x, y) => {
|
|
43040
44169
|
tx += x;
|
|
43041
44170
|
ty += y;
|
|
@@ -43737,11 +44866,11 @@ function penPolygon(width, height = width) {
|
|
|
43737
44866
|
} else {
|
|
43738
44867
|
const rx = Math.ceil(width / 2);
|
|
43739
44868
|
const ry = Math.ceil(height / 2);
|
|
43740
|
-
const
|
|
44869
|
+
const f2 = flattenBezierPath(ellipseBeziers(-rx, -ry, rx, ry));
|
|
43741
44870
|
const half = [];
|
|
43742
|
-
for (let i = 0; i + 1 <
|
|
43743
|
-
half.push([
|
|
43744
|
-
if (i > 0 &&
|
|
44871
|
+
for (let i = 0; i + 1 < f2.length; i += 2) {
|
|
44872
|
+
half.push([f2[i], f2[i + 1]]);
|
|
44873
|
+
if (i > 0 && f2[i + 1] === 0) {
|
|
43745
44874
|
break;
|
|
43746
44875
|
}
|
|
43747
44876
|
}
|
|
@@ -43772,10 +44901,10 @@ function penPolygonMatrix(width, m) {
|
|
|
43772
44901
|
const hx = [halfVectorComponent(m[0] * h), halfVectorComponent(m[1] * h)];
|
|
43773
44902
|
const hy = [mirror2 * halfVectorComponent(m[2] * h), mirror2 * halfVectorComponent(m[3] * h)];
|
|
43774
44903
|
const box = ellipseBeziersBox({ ax: -hx[0] - hy[0], ay: -hx[1] - hy[1], exx: 2 * hx[0], exy: 2 * hx[1], eyx: 2 * hy[0], eyy: 2 * hy[1] });
|
|
43775
|
-
const
|
|
44904
|
+
const f2 = flattenBezierPath(box.slice(0, 14));
|
|
43776
44905
|
const half = [];
|
|
43777
|
-
for (let i = 0; i + 1 <
|
|
43778
|
-
half.push([
|
|
44906
|
+
for (let i = 0; i + 1 < f2.length; i += 2) {
|
|
44907
|
+
half.push([f2[i], f2[i + 1]]);
|
|
43779
44908
|
}
|
|
43780
44909
|
half.pop();
|
|
43781
44910
|
const pen = [...half, ...half.map((p) => [0 - p[0] || 0, 0 - p[1] || 0])];
|
|
@@ -44515,20 +45644,20 @@ function boxFrame(box) {
|
|
|
44515
45644
|
return { l: 0, t: 0, r: w, b: h };
|
|
44516
45645
|
}
|
|
44517
45646
|
function roundRectDeviceBeziers(box, cw, ch, recordedClockwise = false, compatible = false) {
|
|
44518
|
-
const
|
|
45647
|
+
const f2 = boxFrame(box);
|
|
44519
45648
|
const mirrorX = isAxisBox(box) && box.exx < 0;
|
|
44520
45649
|
const mirrorY = isAxisBox(box) && box.eyy < 0;
|
|
44521
45650
|
const clockwise = recordedClockwise !== mirrorY;
|
|
44522
|
-
const q = roundRectCorners(
|
|
44523
|
-
const map = frameMapper(box,
|
|
45651
|
+
const q = roundRectCorners(f2.l, f2.t, f2.r, f2.b, cw, ch, compatible, clockwise, mirrorX, isAxisBox(box) ? box.cornerRatio : void 0);
|
|
45652
|
+
const map = frameMapper(box, f2.l, f2.t, f2.r - f2.l, f2.b - f2.t);
|
|
44524
45653
|
const pts = [];
|
|
44525
45654
|
for (let i = 0; i < q.length; i += 2) {
|
|
44526
|
-
pts.push(...map(q[i], clockwise ?
|
|
45655
|
+
pts.push(...map(q[i], clockwise ? f2.t + f2.b - q[i + 1] : q[i + 1]));
|
|
44527
45656
|
}
|
|
44528
45657
|
if (box.halfX) {
|
|
44529
45658
|
if (box.halfXCompat || !clockwise) {
|
|
44530
|
-
const cy = (
|
|
44531
|
-
const ry = (
|
|
45659
|
+
const cy = (f2.t + f2.b) / 2;
|
|
45660
|
+
const ry = (f2.b - f2.t) / 2 || 1;
|
|
44532
45661
|
for (let k = 0; k < 16; k++) {
|
|
44533
45662
|
const v = (cy - pts[2 * k + 1]) / ry;
|
|
44534
45663
|
pts[2 * k] += k >= 8 ? Math.round(1 + v) : Math.ceil(v - 0.5);
|
|
@@ -44541,8 +45670,8 @@ function roundRectDeviceBeziers(box, cw, ch, recordedClockwise = false, compatib
|
|
|
44541
45670
|
}
|
|
44542
45671
|
}
|
|
44543
45672
|
if (box.cornerExact && isAxisBox(box)) {
|
|
44544
|
-
const w =
|
|
44545
|
-
const h =
|
|
45673
|
+
const w = f2.r - f2.l;
|
|
45674
|
+
const h = f2.b - f2.t;
|
|
44546
45675
|
if (w >= 0 && h >= 0) {
|
|
44547
45676
|
const hx = w === 0 ? 0 : Math.round(box.cornerExact[0] * (mirrorX ? w - w % 2 : w + w % 2) / w / 2);
|
|
44548
45677
|
const hy = h === 0 ? 0 : Math.round(box.cornerExact[1] * (clockwise ? h + h % 2 : h - h % 2) / h / 2);
|
|
@@ -44550,30 +45679,30 @@ function roundRectDeviceBeziers(box, cw, ch, recordedClockwise = false, compatib
|
|
|
44550
45679
|
const vc = clockwise ? Math.ceil(KAPPA * hy) : Math.floor(KAPPA * hy);
|
|
44551
45680
|
const set = (k, x, y) => {
|
|
44552
45681
|
if (x !== null) pts[2 * k] = x;
|
|
44553
|
-
pts[2 * k + 1] = clockwise ?
|
|
45682
|
+
pts[2 * k + 1] = clockwise ? f2.t + f2.b - y : y;
|
|
44554
45683
|
};
|
|
44555
45684
|
const a = box.halfX ? 1 : 0;
|
|
44556
|
-
set(0, null,
|
|
44557
|
-
set(1, null,
|
|
44558
|
-
set(2,
|
|
44559
|
-
set(3,
|
|
44560
|
-
set(4,
|
|
44561
|
-
set(5,
|
|
44562
|
-
set(6, null,
|
|
44563
|
-
set(7, null,
|
|
44564
|
-
set(8, null,
|
|
44565
|
-
set(9, null,
|
|
44566
|
-
set(10,
|
|
44567
|
-
set(11,
|
|
44568
|
-
set(12,
|
|
44569
|
-
set(13,
|
|
44570
|
-
set(14, null,
|
|
44571
|
-
set(15, null,
|
|
45685
|
+
set(0, null, f2.t + hy);
|
|
45686
|
+
set(1, null, f2.t + hy - vc);
|
|
45687
|
+
set(2, f2.r + a - hx + hc, f2.t);
|
|
45688
|
+
set(3, f2.r + a - hx, f2.t);
|
|
45689
|
+
set(4, f2.l + a + hx, f2.t);
|
|
45690
|
+
set(5, f2.l + a + hx - hc, f2.t);
|
|
45691
|
+
set(6, null, f2.t + hy - vc);
|
|
45692
|
+
set(7, null, f2.t + hy);
|
|
45693
|
+
set(8, null, f2.b - hy);
|
|
45694
|
+
set(9, null, f2.b - hy + vc);
|
|
45695
|
+
set(10, f2.l + hx - hc, f2.b);
|
|
45696
|
+
set(11, f2.l + hx, f2.b);
|
|
45697
|
+
set(12, f2.r - hx, f2.b);
|
|
45698
|
+
set(13, f2.r - hx + hc, f2.b);
|
|
45699
|
+
set(14, null, f2.b - hy + vc);
|
|
45700
|
+
set(15, null, f2.b - hy);
|
|
44572
45701
|
}
|
|
44573
45702
|
}
|
|
44574
45703
|
if (mirrorX) {
|
|
44575
45704
|
for (let i = 0; i < pts.length; i += 2) {
|
|
44576
|
-
pts[i] =
|
|
45705
|
+
pts[i] = f2.l + f2.r - pts[i];
|
|
44577
45706
|
}
|
|
44578
45707
|
}
|
|
44579
45708
|
return pts;
|
|
@@ -44590,8 +45719,8 @@ function roundRectRasterPath(box, cw, ch, clockwise = false, rectangle = false,
|
|
|
44590
45719
|
return path;
|
|
44591
45720
|
}
|
|
44592
45721
|
function arcRasterPath(box, s, e, clockwise, kind, from, path = new GdiRasterPath(), mirror2) {
|
|
44593
|
-
const
|
|
44594
|
-
const map = frameMapper(box,
|
|
45722
|
+
const f2 = boxFrame(box);
|
|
45723
|
+
const map = frameMapper(box, f2.l, f2.t, f2.r - f2.l, f2.b - f2.t);
|
|
44595
45724
|
let sx = s[0];
|
|
44596
45725
|
let sy = s[1];
|
|
44597
45726
|
let ex = e[0];
|
|
@@ -44604,7 +45733,7 @@ function arcRasterPath(box, s, e, clockwise, kind, from, path = new GdiRasterPat
|
|
|
44604
45733
|
const qy = py - box.ay;
|
|
44605
45734
|
const u = (qx * box.eyy - qy * box.eyx) / det;
|
|
44606
45735
|
const v = (box.exx * qy - box.exy * qx) / det;
|
|
44607
|
-
return [
|
|
45736
|
+
return [f2.l + u * (f2.r - f2.l), f2.t + v * (f2.b - f2.t)];
|
|
44608
45737
|
};
|
|
44609
45738
|
[sx, sy] = toFrame(sx, sy);
|
|
44610
45739
|
[ex, ey] = toFrame(ex, ey);
|
|
@@ -44614,8 +45743,8 @@ function arcRasterPath(box, s, e, clockwise, kind, from, path = new GdiRasterPat
|
|
|
44614
45743
|
} else if (mirror2) {
|
|
44615
45744
|
cw = clockwise !== mirror2.y;
|
|
44616
45745
|
if (mirror2.x) {
|
|
44617
|
-
sx =
|
|
44618
|
-
ex =
|
|
45746
|
+
sx = f2.l + f2.r - sx;
|
|
45747
|
+
ex = f2.l + f2.r - ex;
|
|
44619
45748
|
}
|
|
44620
45749
|
} else {
|
|
44621
45750
|
if (box.exx < 0 !== box.eyy < 0) {
|
|
@@ -44623,7 +45752,7 @@ function arcRasterPath(box, s, e, clockwise, kind, from, path = new GdiRasterPat
|
|
|
44623
45752
|
}
|
|
44624
45753
|
}
|
|
44625
45754
|
const mirrorX = !!mirror2?.x && isAxisBox(box);
|
|
44626
|
-
const bz = arcBeziers(
|
|
45755
|
+
const bz = arcBeziers(f2.l, f2.t, f2.r, f2.b, sx, sy, ex, ey, cw, !!box.halfX, !!box.framed, mirrorX);
|
|
44627
45756
|
const pts = [];
|
|
44628
45757
|
for (let i = 0; i < bz.length; i += 2) {
|
|
44629
45758
|
pts.push(...map(bz[i], bz[i + 1]));
|
|
@@ -44635,9 +45764,9 @@ function arcRasterPath(box, s, e, clockwise, kind, from, path = new GdiRasterPat
|
|
|
44635
45764
|
path.addBeziers(pts, true);
|
|
44636
45765
|
}
|
|
44637
45766
|
if (kind === "pie") {
|
|
44638
|
-
const w =
|
|
44639
|
-
const h =
|
|
44640
|
-
const [cx, cy] = map(
|
|
45767
|
+
const w = f2.r - f2.l;
|
|
45768
|
+
const h = f2.b - f2.t;
|
|
45769
|
+
const [cx, cy] = map(f2.l + Math.ceil(w / 2) + (box.halfX && !mirrorX ? 1 : 0), f2.t + Math.ceil(h / 2));
|
|
44641
45770
|
path.lineTo(cx, cy);
|
|
44642
45771
|
}
|
|
44643
45772
|
if (kind === "pie" || kind === "chord") {
|
|
@@ -44747,11 +45876,11 @@ function brushPaint2(rCtx) {
|
|
|
44747
45876
|
};
|
|
44748
45877
|
}
|
|
44749
45878
|
function withoutCurveTangents(path) {
|
|
44750
|
-
if (!path.figures.some((
|
|
45879
|
+
if (!path.figures.some((f2) => f2.tangents)) {
|
|
44751
45880
|
return path;
|
|
44752
45881
|
}
|
|
44753
45882
|
const plain = new GdiRasterPath();
|
|
44754
|
-
plain.figures = path.figures.map((
|
|
45883
|
+
plain.figures = path.figures.map((f2) => ({ pts: f2.pts, closed: f2.closed, roundWiden: f2.roundWiden }));
|
|
44755
45884
|
return plain;
|
|
44756
45885
|
}
|
|
44757
45886
|
function layoutRasterPath(rCtx, path, boxShape = false) {
|
|
@@ -44981,11 +46110,11 @@ function strokeStyledCosmetic(rCtx, path, pattern, style) {
|
|
|
44981
46110
|
const paint = rop2Paint(state.rop2);
|
|
44982
46111
|
const bk = state.bkMode === 2 && styleGapsUseBackground(flags);
|
|
44983
46112
|
const segs2 = [];
|
|
44984
|
-
path.figures.forEach((
|
|
46113
|
+
path.figures.forEach((f2, fi) => {
|
|
44985
46114
|
if (fi > 0) {
|
|
44986
46115
|
style.pos = 0;
|
|
44987
46116
|
}
|
|
44988
|
-
const p =
|
|
46117
|
+
const p = f2.closed ? [...f2.pts, f2.pts[0], f2.pts[1]] : f2.pts;
|
|
44989
46118
|
for (let i = 0; i + 3 < p.length; i += 2) {
|
|
44990
46119
|
let n = 0;
|
|
44991
46120
|
cosmeticLine(p[i], p[i + 1], p[i + 2], p[i + 3], () => {
|
|
@@ -45007,10 +46136,10 @@ function strokeStyledCosmetic(rCtx, path, pattern, style) {
|
|
|
45007
46136
|
for (const pass of bk ? ["bk", "fg"] : ["fg"]) {
|
|
45008
46137
|
ctx.strokeStyle = rop2TransformColor(pass === "bk" ? state.bkColor : state.penColor, paint.colorTransform);
|
|
45009
46138
|
for (const [x0, y0, x1, y1, pos, n] of segs2) {
|
|
45010
|
-
const
|
|
46139
|
+
const f2 = Math.hypot(x1 - x0, y1 - y0) / 16 / n;
|
|
45011
46140
|
if (pass === "fg") {
|
|
45012
|
-
ctx.setLineDash(pattern.map((v) => v *
|
|
45013
|
-
ctx.lineDashOffset = pos % period *
|
|
46141
|
+
ctx.setLineDash(pattern.map((v) => v * f2));
|
|
46142
|
+
ctx.lineDashOffset = pos % period * f2;
|
|
45014
46143
|
} else {
|
|
45015
46144
|
ctx.setLineDash([]);
|
|
45016
46145
|
}
|
|
@@ -45276,6 +46405,25 @@ function tileIndex(i, n, mirror2) {
|
|
|
45276
46405
|
const m = (i % (2 * n) + 2 * n) % (2 * n);
|
|
45277
46406
|
return m < n ? m : 2 * n - 1 - m;
|
|
45278
46407
|
}
|
|
46408
|
+
function flattenUnderMatrix(source, toTile, full) {
|
|
46409
|
+
const points = source.points.map((p) => toTile({ x: full[0] * p.x + full[2] * p.y + full[4], y: full[1] * p.x + full[3] * p.y + full[5] }));
|
|
46410
|
+
const out = [];
|
|
46411
|
+
for (let k = 0; k < points.length; k++) {
|
|
46412
|
+
if ((source.types[k] & 7) === 3 && k > 0 && k + 2 < points.length) {
|
|
46413
|
+
const curve = points.slice(k - 1, k + 3).flatMap((p) => [gdiplusFix(p.x), gdiplusFix(p.y)]);
|
|
46414
|
+
out[out.length - 1] = { x: curve[0] / 16, y: curve[1] / 16 };
|
|
46415
|
+
const flat = [];
|
|
46416
|
+
flattenBezierGdiplus(curve, flat);
|
|
46417
|
+
for (let q = 0; q < flat.length; q += 2) out.push({ x: flat[q] / 16, y: flat[q + 1] / 16 });
|
|
46418
|
+
k += 2;
|
|
46419
|
+
} else {
|
|
46420
|
+
out.push(points[k]);
|
|
46421
|
+
}
|
|
46422
|
+
}
|
|
46423
|
+
const n = out.length;
|
|
46424
|
+
if (n > 1 && out[0].x === out[n - 1].x && out[0].y === out[n - 1].y) out.pop();
|
|
46425
|
+
return out;
|
|
46426
|
+
}
|
|
45279
46427
|
function fractionalTileSampler(shape, wrap, full) {
|
|
45280
46428
|
if (Math.abs(full[1]) > 1e-9 || Math.abs(full[2]) > 1e-9 || full[0] <= 0 || full[3] <= 0) return null;
|
|
45281
46429
|
if (!shape.boundaryArgb.every((color) => color === shape.boundaryArgb[0])) return null;
|
|
@@ -45283,7 +46431,7 @@ function fractionalTileSampler(shape, wrap, full) {
|
|
|
45283
46431
|
let y0 = Infinity;
|
|
45284
46432
|
let x1 = -Infinity;
|
|
45285
46433
|
let y1 = -Infinity;
|
|
45286
|
-
for (const point of shape.boundary) {
|
|
46434
|
+
for (const point of shape.source ? shape.source.points : shape.boundary) {
|
|
45287
46435
|
const x = full[0] * point.x + full[4];
|
|
45288
46436
|
const y = full[3] * point.y + full[5];
|
|
45289
46437
|
x0 = Math.min(x0, x);
|
|
@@ -45303,7 +46451,8 @@ function fractionalTileSampler(shape, wrap, full) {
|
|
|
45303
46451
|
});
|
|
45304
46452
|
const inner = pathGradientSampler({
|
|
45305
46453
|
...shape,
|
|
45306
|
-
boundary: shape.boundary.map(toTile),
|
|
46454
|
+
boundary: shape.source ? flattenUnderMatrix(shape.source, toTile, full) : shape.boundary.map(toTile),
|
|
46455
|
+
source: void 0,
|
|
45307
46456
|
center: toTile(shape.center),
|
|
45308
46457
|
transform: null
|
|
45309
46458
|
}, "clamp", IDENTITY4, false, true);
|
|
@@ -45318,9 +46467,9 @@ function fractionalTileSampler(shape, wrap, full) {
|
|
|
45318
46467
|
texels = new Float64Array(width * height * 4);
|
|
45319
46468
|
for (let i = 0; i < width * height; i++) {
|
|
45320
46469
|
const a = rgba[i * 4 + 3];
|
|
45321
|
-
texels[i * 4] = rgba[i * 4] * a / 255;
|
|
45322
|
-
texels[i * 4 + 1] = rgba[i * 4 + 1] * a / 255;
|
|
45323
|
-
texels[i * 4 + 2] = rgba[i * 4 + 2] * a / 255;
|
|
46470
|
+
texels[i * 4] = Math.floor(rgba[i * 4] * a / 255 + 0.5);
|
|
46471
|
+
texels[i * 4 + 1] = Math.floor(rgba[i * 4 + 1] * a / 255 + 0.5);
|
|
46472
|
+
texels[i * 4 + 2] = Math.floor(rgba[i * 4 + 2] * a / 255 + 0.5);
|
|
45324
46473
|
texels[i * 4 + 3] = a;
|
|
45325
46474
|
}
|
|
45326
46475
|
return texels;
|
|
@@ -45347,10 +46496,10 @@ function fractionalTileSampler(shape, wrap, full) {
|
|
|
45347
46496
|
out[o] = out[o + 1] = out[o + 2] = out[o + 3] = 0;
|
|
45348
46497
|
continue;
|
|
45349
46498
|
}
|
|
45350
|
-
|
|
45351
|
-
|
|
45352
|
-
|
|
45353
|
-
|
|
46499
|
+
for (let k = 0; k < 3; k++) {
|
|
46500
|
+
const premultiplied2 = Math.floor(sample2(k) + 0.5);
|
|
46501
|
+
out[o + k] = Math.min(255, coverage >= 255 ? premultiplied2 : Math.floor(premultiplied2 * 255 / alpha + 0.5));
|
|
46502
|
+
}
|
|
45354
46503
|
out[o + 3] = alpha;
|
|
45355
46504
|
}
|
|
45356
46505
|
}
|
|
@@ -45380,14 +46529,26 @@ function pathGradientSampler(shape, wrap, device, strictOutside = true, straight
|
|
|
45380
46529
|
const mirrorY = wrap === "tile-flip-y" || wrap === "tile-flip-xy";
|
|
45381
46530
|
const bias = wrap === "clamp" ? CLAMP_EDGE_BIAS : 0;
|
|
45382
46531
|
const tile = wrap === "clamp" ? null : tileDeviceRect(box, full);
|
|
45383
|
-
return (x0, y0, w, h, out) => {
|
|
46532
|
+
return (x0, y0, w, h, out, coverage) => {
|
|
45384
46533
|
const inside = tile !== null && x0 >= tile[0] && x0 + w <= tile[2] && y0 >= tile[1] && y0 + h <= tile[3];
|
|
45385
|
-
|
|
45386
|
-
|
|
46534
|
+
let windowLeft = tile && !inside ? tile[0] : x0;
|
|
46535
|
+
let windowRight = tile && !inside ? tile[2] : x0 + w;
|
|
45387
46536
|
const bitmap = straightBitmap || tile !== null && !inside;
|
|
46537
|
+
const spans = coverage !== void 0 && !(tile && !inside);
|
|
45388
46538
|
for (let j = 0; j < h; j++) {
|
|
45389
46539
|
const dy = y0 + j;
|
|
46540
|
+
let runEnd = -1;
|
|
45390
46541
|
for (let i = 0; i < w; i++) {
|
|
46542
|
+
if (spans && coverage[j * w + i]) {
|
|
46543
|
+
if (i >= runEnd) {
|
|
46544
|
+
let start = i;
|
|
46545
|
+
while (start > 0 && coverage[j * w + start - 1]) start--;
|
|
46546
|
+
runEnd = i;
|
|
46547
|
+
while (runEnd < w && coverage[j * w + runEnd]) runEnd++;
|
|
46548
|
+
windowLeft = x0 + start;
|
|
46549
|
+
windowRight = x0 + runEnd;
|
|
46550
|
+
}
|
|
46551
|
+
}
|
|
45391
46552
|
const dx = x0 + i + bias;
|
|
45392
46553
|
let bx = inv3[0] * dx + inv3[2] * dy + inv3[4];
|
|
45393
46554
|
let by = inv3[1] * dx + inv3[3] * dy + inv3[5];
|
|
@@ -46018,8 +47179,8 @@ function handleMoveToEx(rCtx, dataOff, recSize) {
|
|
|
46018
47179
|
if (inPath) {
|
|
46019
47180
|
const p = hasWorldRotation(rCtx) ? gmapPoint(rCtx, state.curX, state.curY) : { x: gmx(rCtx, state.curX), y: gmy(rCtx, state.curY) };
|
|
46020
47181
|
gdiPathRecorder(rCtx).moveTo(p.x, p.y);
|
|
46021
|
-
const
|
|
46022
|
-
rasterPathOf(rCtx).moveTo(
|
|
47182
|
+
const f2 = fixPoint(rCtx, state.curX, state.curY);
|
|
47183
|
+
rasterPathOf(rCtx).moveTo(f2[0], f2[1]);
|
|
46023
47184
|
}
|
|
46024
47185
|
}
|
|
46025
47186
|
return true;
|
|
@@ -46176,7 +47337,7 @@ function rectangleInterior(state, x, y, w, h, scale = 1) {
|
|
|
46176
47337
|
c.rect(x0 + 1, y0 + 1, iw, ih);
|
|
46177
47338
|
};
|
|
46178
47339
|
}
|
|
46179
|
-
var
|
|
47340
|
+
var KAPPA3 = 0.5522847498307936;
|
|
46180
47341
|
function appendRoundRectPath(c, x0, y0, x1, y1, rx, ry, map) {
|
|
46181
47342
|
const left = Math.min(x0, x1);
|
|
46182
47343
|
const right = Math.max(x0, x1);
|
|
@@ -46224,8 +47385,8 @@ function appendRoundRectPath(c, x0, y0, x1, y1, rx, ry, map) {
|
|
|
46224
47385
|
c.closePath();
|
|
46225
47386
|
return;
|
|
46226
47387
|
}
|
|
46227
|
-
const kx = ex *
|
|
46228
|
-
const ky = ey *
|
|
47388
|
+
const kx = ex * KAPPA3;
|
|
47389
|
+
const ky = ey * KAPPA3;
|
|
46229
47390
|
move(left + ex, top);
|
|
46230
47391
|
line(right - ex, top);
|
|
46231
47392
|
curve(right - ex + kx, top, right, top + ey - ky, right, top + ey);
|
|
@@ -46761,14 +47922,14 @@ var WHITE_D = WHITE[0] + 15 * WHITE[1] + 3 * WHITE[2];
|
|
|
46761
47922
|
var WHITE_U = 4 * WHITE[0] / WHITE_D;
|
|
46762
47923
|
var WHITE_V = 9 * WHITE[1] / WHITE_D;
|
|
46763
47924
|
function invert3(m) {
|
|
46764
|
-
const [[a, b, c], [d, e,
|
|
46765
|
-
const A = e * i -
|
|
46766
|
-
const B =
|
|
47925
|
+
const [[a, b, c], [d, e, f2], [g, h, i]] = m;
|
|
47926
|
+
const A = e * i - f2 * h;
|
|
47927
|
+
const B = f2 * g - d * i;
|
|
46767
47928
|
const C = d * h - e * g;
|
|
46768
47929
|
const det = a * A + b * B + c * C;
|
|
46769
47930
|
return [
|
|
46770
|
-
[A / det, (c * h - b * i) / det, (b *
|
|
46771
|
-
[B / det, (a * i - c * g) / det, (c * d - a *
|
|
47931
|
+
[A / det, (c * h - b * i) / det, (b * f2 - c * e) / det],
|
|
47932
|
+
[B / det, (a * i - c * g) / det, (c * d - a * f2) / det],
|
|
46772
47933
|
[C / det, (b * g - a * h) / det, (a * e - b * d) / det]
|
|
46773
47934
|
];
|
|
46774
47935
|
}
|
|
@@ -46814,7 +47975,7 @@ function chromaTieTable(ca) {
|
|
|
46814
47975
|
table2 = null;
|
|
46815
47976
|
if (flips) {
|
|
46816
47977
|
table2 = new Int8Array(32768 * 3);
|
|
46817
|
-
for (const
|
|
47978
|
+
for (const f2 of flips) table2[f2 >> 1] = f2 & 1 ? 1 : -1;
|
|
46818
47979
|
}
|
|
46819
47980
|
chromaTieTables.set(key, table2);
|
|
46820
47981
|
}
|
|
@@ -50004,7 +51165,11 @@ function compositeGlyphs(ctx, placed, color, gray, clip, opaque = false) {
|
|
|
50004
51165
|
const dx = p.x + x - x0;
|
|
50005
51166
|
if (dx < 0 || dx >= w) continue;
|
|
50006
51167
|
const i = dy * w + dx;
|
|
50007
|
-
if (
|
|
51168
|
+
if (gray && cov[i]) {
|
|
51169
|
+
cov[i] = ((cov[i] - 1 | v - 1) & 15) + 1;
|
|
51170
|
+
} else if (v > cov[i]) {
|
|
51171
|
+
cov[i] = v;
|
|
51172
|
+
}
|
|
50008
51173
|
}
|
|
50009
51174
|
}
|
|
50010
51175
|
}
|
|
@@ -50068,7 +51233,7 @@ function deviceLogFont(state, heightScale, widthScale) {
|
|
|
50068
51233
|
};
|
|
50069
51234
|
}
|
|
50070
51235
|
function drawGdiTextCall(ctx, fonts, state, call) {
|
|
50071
|
-
const [a, b, c, d, e,
|
|
51236
|
+
const [a, b, c, d, e, f2] = call.matrix;
|
|
50072
51237
|
const advanceScale = Math.hypot(a, b);
|
|
50073
51238
|
const fontScale = Math.hypot(c, d);
|
|
50074
51239
|
if (!(advanceScale > 0) || !(fontScale > 0) || call.codes.length === 0) {
|
|
@@ -50100,10 +51265,14 @@ function drawGdiTextCall(ctx, fonts, state, call) {
|
|
|
50100
51265
|
glyphFrame = compose(table2.sin, table2.cos);
|
|
50101
51266
|
frame2 = compose(Math.sin(t), Math.cos(t));
|
|
50102
51267
|
}
|
|
51268
|
+
if (glyphFrame && call.playbackStretch && call.playbackStretch !== 1) {
|
|
51269
|
+
const k = call.playbackStretch;
|
|
51270
|
+
glyphFrame = [glyphFrame[0] * k, glyphFrame[1] * k, glyphFrame[2], glyphFrame[3]];
|
|
51271
|
+
}
|
|
50103
51272
|
const updateCp = (state.textAlign & 1) !== 0;
|
|
50104
51273
|
const lx = updateCp ? state.curX : call.x;
|
|
50105
51274
|
const ly = updateCp ? state.curY : call.y;
|
|
50106
|
-
const map = (x, y) => ({ x: a * x + c * y + e, y: b * x + d * y +
|
|
51275
|
+
const map = (x, y) => ({ x: a * x + c * y + e, y: b * x + d * y + f2 });
|
|
50107
51276
|
const ref = map(lx, ly);
|
|
50108
51277
|
let rect = null;
|
|
50109
51278
|
if (call.rect && call.options & (ETO_OPAQUE | ETO_CLIPPED)) {
|
|
@@ -50247,15 +51416,15 @@ function gdiTextCoverage(font, run, options2 = {}) {
|
|
|
50247
51416
|
const end = x + Math.round(total);
|
|
50248
51417
|
const snapped = run.plusBars === "snapped" && font.exactDecorations ? fractionalBars(font.exactDecorations, run, run.x + startAlong, run.y + baseDown, total) : null;
|
|
50249
51418
|
let barIndex = 0;
|
|
50250
|
-
const
|
|
51419
|
+
const add3 = (position, thickness) => {
|
|
50251
51420
|
const top = Math.round(run.y + baseDown) - position;
|
|
50252
51421
|
const snap = snapped?.[barIndex++];
|
|
50253
51422
|
const l = snap ? Math.round(snap.left) : x;
|
|
50254
51423
|
const r = snap ? Math.round(snap.right) : end;
|
|
50255
51424
|
bars.push({ left: Math.min(l, r), right: Math.max(l, r), top, bottom: top + Math.max(1, thickness) });
|
|
50256
51425
|
};
|
|
50257
|
-
if (run.underline)
|
|
50258
|
-
if (run.strikeOut)
|
|
51426
|
+
if (run.underline) add3(font.underlinePosition, font.underlineThickness);
|
|
51427
|
+
if (run.strikeOut) add3(font.strikeoutPosition, font.strikeoutThickness);
|
|
50259
51428
|
}
|
|
50260
51429
|
if (placed.length === 0 && bars.length === 0 && softBars.length === 0) {
|
|
50261
51430
|
return null;
|
|
@@ -51482,9 +52651,9 @@ function handlePolyDraw(rCtx, offset, dataOff, recSize, pointSize) {
|
|
|
51482
52651
|
if (kind === PT_MOVETO) {
|
|
51483
52652
|
const [x, y] = readPt(i);
|
|
51484
52653
|
const p = gmapPoint(rCtx, x, y);
|
|
51485
|
-
const
|
|
52654
|
+
const f2 = fixPoint(rCtx, x, y);
|
|
51486
52655
|
canvas?.moveTo(p.x, p.y);
|
|
51487
|
-
raster?.moveTo(
|
|
52656
|
+
raster?.moveTo(f2[0], f2[1]);
|
|
51488
52657
|
open = true;
|
|
51489
52658
|
continue;
|
|
51490
52659
|
}
|
|
@@ -51492,9 +52661,9 @@ function handlePolyDraw(rCtx, offset, dataOff, recSize, pointSize) {
|
|
|
51492
52661
|
ensureOpen();
|
|
51493
52662
|
const [x, y] = readPt(i);
|
|
51494
52663
|
const p = gmapPoint(rCtx, x, y);
|
|
51495
|
-
const
|
|
52664
|
+
const f2 = fixPoint(rCtx, x, y);
|
|
51496
52665
|
canvas?.lineTo(p.x, p.y);
|
|
51497
|
-
raster?.lineTo(
|
|
52666
|
+
raster?.lineTo(f2[0], f2[1]);
|
|
51498
52667
|
} else if (kind === PT_BEZIERTO && i + 2 < count) {
|
|
51499
52668
|
ensureOpen();
|
|
51500
52669
|
const pts = [0, 1, 2].map((k) => readPt(i + k));
|
|
@@ -51567,8 +52736,8 @@ function paintBracketPath(rCtx, fill2, stroke) {
|
|
|
51567
52736
|
if (close) {
|
|
51568
52737
|
const closed = new GdiRasterPath();
|
|
51569
52738
|
closed.append(raster);
|
|
51570
|
-
for (const
|
|
51571
|
-
|
|
52739
|
+
for (const f2 of closed.figures) {
|
|
52740
|
+
f2.closed = true;
|
|
51572
52741
|
}
|
|
51573
52742
|
raster = closed;
|
|
51574
52743
|
}
|
|
@@ -51586,11 +52755,11 @@ function discardPath(rCtx) {
|
|
|
51586
52755
|
}
|
|
51587
52756
|
function syncPathCmds(rCtx) {
|
|
51588
52757
|
const cmds = [];
|
|
51589
|
-
for (const
|
|
51590
|
-
for (let i = 0; i + 1 <
|
|
51591
|
-
cmds.push({ op: i === 0 ? "moveTo" : "lineTo", x:
|
|
52758
|
+
for (const f2 of rCtx.rasterPath?.figures ?? []) {
|
|
52759
|
+
for (let i = 0; i + 1 < f2.pts.length; i += 2) {
|
|
52760
|
+
cmds.push({ op: i === 0 ? "moveTo" : "lineTo", x: f2.pts[i] / 16, y: f2.pts[i + 1] / 16 });
|
|
51592
52761
|
}
|
|
51593
|
-
if (
|
|
52762
|
+
if (f2.closed) {
|
|
51594
52763
|
cmds.push({ op: "closePath" });
|
|
51595
52764
|
}
|
|
51596
52765
|
}
|
|
@@ -51600,10 +52769,10 @@ function flattenBracketPath(rCtx) {
|
|
|
51600
52769
|
if (rCtx.inPath || !rCtx.rasterPath) {
|
|
51601
52770
|
return;
|
|
51602
52771
|
}
|
|
51603
|
-
for (const
|
|
51604
|
-
delete
|
|
51605
|
-
delete
|
|
51606
|
-
delete
|
|
52772
|
+
for (const f2 of rCtx.rasterPath.figures) {
|
|
52773
|
+
delete f2.tangents;
|
|
52774
|
+
delete f2.curveSegs;
|
|
52775
|
+
delete f2.roundWiden;
|
|
51607
52776
|
}
|
|
51608
52777
|
syncPathCmds(rCtx);
|
|
51609
52778
|
}
|
|
@@ -52588,12 +53757,12 @@ function nearestFix2(v) {
|
|
|
52588
53757
|
function leafMask(build, m, evenOdd, box, half) {
|
|
52589
53758
|
let figures;
|
|
52590
53759
|
try {
|
|
52591
|
-
figures = recordDeviceFigures(build, m).map((
|
|
53760
|
+
figures = recordDeviceFigures(build, m).map((f2) => f2.pts.map(nearestFix2));
|
|
52592
53761
|
} catch {
|
|
52593
53762
|
return null;
|
|
52594
53763
|
}
|
|
52595
53764
|
const coverage = rasterizePlusFill(
|
|
52596
|
-
figures.filter((
|
|
53765
|
+
figures.filter((f2) => f2.length >= 6),
|
|
52597
53766
|
evenOdd,
|
|
52598
53767
|
false,
|
|
52599
53768
|
half,
|
|
@@ -52704,7 +53873,7 @@ function insetStrokeCoverage(strokeGroups, figureFix, antialias, half, box, even
|
|
|
52704
53873
|
}
|
|
52705
53874
|
return mask;
|
|
52706
53875
|
});
|
|
52707
|
-
const shifted2 = half ? open.map((
|
|
53876
|
+
const shifted2 = half ? open.map((f2) => f2.map((v) => v - 8)) : open;
|
|
52708
53877
|
return rasterizePlusFill([...masks.flatMap((mask) => insetMaskOutline(mask, box.w, box.h, box.x, box.y)), ...shifted2], false, antialias, false, box);
|
|
52709
53878
|
}
|
|
52710
53879
|
function insetMaskOutline(mask, w, h, ox, oy) {
|
|
@@ -53250,7 +54419,7 @@ function strokeGdiplus(rCtx, pen, nib, sampler, buildPath, device, size, mode, c
|
|
|
53250
54419
|
return false;
|
|
53251
54420
|
}
|
|
53252
54421
|
if (closedFigure) {
|
|
53253
|
-
figures = figures.map((
|
|
54422
|
+
figures = figures.map((f2) => ({ ...f2, closed: true }));
|
|
53254
54423
|
}
|
|
53255
54424
|
const width = (pen.width || 1) * frame2.unit;
|
|
53256
54425
|
const devicePen = framePen(pen, frame2.unit, nib);
|
|
@@ -53282,15 +54451,15 @@ function strokeGdiplus(rCtx, pen, nib, sampler, buildPath, device, size, mode, c
|
|
|
53282
54451
|
return compositeBrushCoverage(rCtx, sampler, box, coverage, 1, true);
|
|
53283
54452
|
}
|
|
53284
54453
|
function widenedPen(figures, devicePen, toFix) {
|
|
53285
|
-
const closedFigures = figures.filter((
|
|
54454
|
+
const closedFigures = figures.filter((f2) => f2.closed);
|
|
53286
54455
|
if (!devicePen.inset || devicePen.compound || closedFigures.length === 0) {
|
|
53287
54456
|
const fix = widenFigures(figures, devicePen).map(toFix);
|
|
53288
54457
|
return { fix, groups: [fix], insetFigures: null, open: [] };
|
|
53289
54458
|
}
|
|
53290
54459
|
const widenPen = { ...devicePen, inset: false, half: devicePen.half * 2, dashOffset: devicePen.dashOffset * 2, dashCapWidth: devicePen.half * 2, doubleRoundCap: true };
|
|
53291
|
-
const groups = closedFigures.map((
|
|
54460
|
+
const groups = closedFigures.map((f2) => widenFigures([f2], widenPen).map(toFix));
|
|
53292
54461
|
const open = widenFigures(
|
|
53293
|
-
figures.filter((
|
|
54462
|
+
figures.filter((f2) => !f2.closed),
|
|
53294
54463
|
{ ...devicePen, inset: false }
|
|
53295
54464
|
).map(toFix).map((poly) => {
|
|
53296
54465
|
const reversed2 = [];
|
|
@@ -53299,7 +54468,7 @@ function widenedPen(figures, devicePen, toFix) {
|
|
|
53299
54468
|
}
|
|
53300
54469
|
return reversed2;
|
|
53301
54470
|
});
|
|
53302
|
-
const insetFigures = figures.map((
|
|
54471
|
+
const insetFigures = figures.map((f2) => toFix(Array.from({ length: f2.pts.length >> 1 }, (_, i) => ({ x: f2.pts[2 * i], y: f2.pts[2 * i + 1] }))));
|
|
53303
54472
|
return { fix: [...groups.flat(), ...open], groups, insetFigures, open };
|
|
53304
54473
|
}
|
|
53305
54474
|
function strokeNominal(rCtx, pen, sampler, buildPath, device, size, antialias, closedFigure) {
|
|
@@ -53310,10 +54479,10 @@ function strokeNominal(rCtx, pen, sampler, buildPath, device, size, antialias, c
|
|
|
53310
54479
|
return false;
|
|
53311
54480
|
}
|
|
53312
54481
|
if (closedFigure) {
|
|
53313
|
-
figures = figures.map((
|
|
54482
|
+
figures = figures.map((f2) => ({ ...f2, closed: true }));
|
|
53314
54483
|
}
|
|
53315
54484
|
const box = figuresBox(
|
|
53316
|
-
figures.map((
|
|
54485
|
+
figures.map((f2) => f2.pts),
|
|
53317
54486
|
size
|
|
53318
54487
|
);
|
|
53319
54488
|
if (!box) {
|
|
@@ -53369,7 +54538,7 @@ function penOutlineWorld(rCtx, pen, nib, buildPath, closedFigure) {
|
|
|
53369
54538
|
return null;
|
|
53370
54539
|
}
|
|
53371
54540
|
if (closedFigure) {
|
|
53372
|
-
figures = figures.map((
|
|
54541
|
+
figures = figures.map((f2) => ({ ...f2, closed: true }));
|
|
53373
54542
|
}
|
|
53374
54543
|
const width = (pen.width || 1) * frame2.unit;
|
|
53375
54544
|
const devicePen = framePen(pen, frame2.unit, nib);
|
|
@@ -53465,7 +54634,7 @@ function deviceQuad(wt, s, pts) {
|
|
|
53465
54634
|
}
|
|
53466
54635
|
return out;
|
|
53467
54636
|
}
|
|
53468
|
-
function imageResampleSpec(rCtx, dataOff, isMetafile, toWorld, points, nominalScale, worldPoints) {
|
|
54637
|
+
function imageResampleSpec(rCtx, dataOff, isMetafile, toWorld, points, nominalScale, worldPoints, worldRect) {
|
|
53469
54638
|
const { view } = rCtx;
|
|
53470
54639
|
const kernel = resampleKernelFor(rCtx.interpolationMode ?? 0);
|
|
53471
54640
|
if (isMetafile || view.getUint32(dataOff + 4, true) !== UNIT_PIXEL2) {
|
|
@@ -53488,11 +54657,12 @@ function imageResampleSpec(rCtx, dataOff, isMetafile, toWorld, points, nominalSc
|
|
|
53488
54657
|
halfPixelOffset: isHalfPixelOffset(rCtx.pixelOffsetMode ?? 0),
|
|
53489
54658
|
...points ? { pointsForm: true } : {},
|
|
53490
54659
|
...points && worldPoints ? { worldPoints, worldMatrix: plusWorldMatrix(rCtx) } : {},
|
|
54660
|
+
...!points && worldRect ? { worldRect, worldMatrix: plusWorldMatrix(rCtx) } : {},
|
|
53491
54661
|
...nominalScale ? { nominalScale: nominalScale(srcW, srcH) } : {},
|
|
53492
54662
|
...imageAttributesWrap(rCtx, view.getUint32(dataOff, true))
|
|
53493
54663
|
};
|
|
53494
54664
|
}
|
|
53495
|
-
function drawOrDeferImage(rCtx, imgObj, dataOff, dx, dy, dw, dh, toWorld, effect = null, points = false, nominalScale, worldPoints) {
|
|
54665
|
+
function drawOrDeferImage(rCtx, imgObj, dataOff, dx, dy, dw, dh, toWorld, effect = null, points = false, nominalScale, worldPoints, worldRect) {
|
|
53496
54666
|
if (!imgObj.data) {
|
|
53497
54667
|
return;
|
|
53498
54668
|
}
|
|
@@ -53505,7 +54675,7 @@ function drawOrDeferImage(rCtx, imgObj, dataOff, dx, dy, dw, dh, toWorld, effect
|
|
|
53505
54675
|
dh,
|
|
53506
54676
|
transform: plusWorldMatrix(rCtx),
|
|
53507
54677
|
isMetafile,
|
|
53508
|
-
resample: imageResampleSpec(rCtx, dataOff, isMetafile, toWorld, points, nominalScale, worldPoints)
|
|
54678
|
+
resample: imageResampleSpec(rCtx, dataOff, isMetafile, toWorld, points, nominalScale, worldPoints, worldRect)
|
|
53509
54679
|
};
|
|
53510
54680
|
const { view } = rCtx;
|
|
53511
54681
|
const source = {
|
|
@@ -53961,7 +55131,7 @@ function handleEmfPlusTextImageRecord(rCtx, recType, recFlags, dataOff, recDataS
|
|
|
53961
55131
|
down32(dh / sh),
|
|
53962
55132
|
dx - sx * dw / sw,
|
|
53963
55133
|
dy - sy * dh / sh
|
|
53964
|
-
], null, false, (sw, sh) => [Math.fround(dw / sw), Math.fround(dh / sh)]);
|
|
55134
|
+
], null, false, (sw, sh) => [Math.fround(dw / sw), Math.fround(dh / sh)], void 0, [dx, dy, dw, dh]);
|
|
53965
55135
|
}
|
|
53966
55136
|
}
|
|
53967
55137
|
return true;
|
|
@@ -55152,10 +56322,10 @@ function replayNestedEmf(bytes, ctx, canvasW, canvasH, toCanvas, options2) {
|
|
|
55152
56322
|
if (!header) {
|
|
55153
56323
|
return null;
|
|
55154
56324
|
}
|
|
55155
|
-
const [a, b, c, d, e,
|
|
56325
|
+
const [a, b, c, d, e, f2] = toCanvas;
|
|
55156
56326
|
if (b === 0 && c === 0 && a > 0 && d > 0) {
|
|
55157
56327
|
const left = -e / a;
|
|
55158
|
-
const top = -
|
|
56328
|
+
const top = -f2 / d;
|
|
55159
56329
|
const bounds2 = { left, top, right: left + canvasW / a, bottom: top + canvasH / d };
|
|
55160
56330
|
return replayEmfRecords(view, ctx, bounds2, canvasW, canvasH, 1, options2);
|
|
55161
56331
|
}
|
|
@@ -55715,15 +56885,15 @@ function selectObject(p, slot) {
|
|
|
55715
56885
|
selectBrush(p, obj);
|
|
55716
56886
|
break;
|
|
55717
56887
|
case "font": {
|
|
55718
|
-
const
|
|
55719
|
-
s.fontHeight =
|
|
55720
|
-
s.fontWeight =
|
|
55721
|
-
s.fontItalic =
|
|
55722
|
-
s.fontUnderline =
|
|
55723
|
-
s.fontStrikeOut =
|
|
55724
|
-
s.fontFamily =
|
|
55725
|
-
s.fontEscapementTenthDeg =
|
|
55726
|
-
s.fontDetails =
|
|
56888
|
+
const f2 = obj.font;
|
|
56889
|
+
s.fontHeight = f2.height;
|
|
56890
|
+
s.fontWeight = f2.weight;
|
|
56891
|
+
s.fontItalic = f2.italic;
|
|
56892
|
+
s.fontUnderline = f2.underline;
|
|
56893
|
+
s.fontStrikeOut = f2.strikeOut;
|
|
56894
|
+
s.fontFamily = f2.family;
|
|
56895
|
+
s.fontEscapementTenthDeg = f2.escapementTenthDeg ?? 0;
|
|
56896
|
+
s.fontDetails = f2.details;
|
|
55727
56897
|
break;
|
|
55728
56898
|
}
|
|
55729
56899
|
}
|
|
@@ -57806,14 +58976,14 @@ function winAnsiByte(cp) {
|
|
|
57806
58976
|
return WIN_ANSI_HIGH[cp] ?? -1;
|
|
57807
58977
|
}
|
|
57808
58978
|
function standardFamilyFor(familyList) {
|
|
57809
|
-
const
|
|
57810
|
-
if (/courier|mono|consolas|lucida console|terminal|fixedsys|andale|menlo|monaco|typewriter/.test(
|
|
58979
|
+
const f2 = familyList.toLowerCase();
|
|
58980
|
+
if (/courier|mono|consolas|lucida console|terminal|fixedsys|andale|menlo|monaco|typewriter/.test(f2)) {
|
|
57811
58981
|
return "Courier";
|
|
57812
58982
|
}
|
|
57813
|
-
if (/sans|arial|helvet|verdana|tahoma|calibri|segoe|trebuchet|impact/.test(
|
|
58983
|
+
if (/sans|arial|helvet|verdana|tahoma|calibri|segoe|trebuchet|impact/.test(f2)) {
|
|
57814
58984
|
return "Helvetica";
|
|
57815
58985
|
}
|
|
57816
|
-
if (/times|serif|georgia|garamond|palatino|cambria|book antiqua|century|bookman|minion|constantia|baskerville|didot/.test(
|
|
58986
|
+
if (/times|serif|georgia|garamond|palatino|cambria|book antiqua|century|bookman|minion|constantia|baskerville|didot/.test(f2)) {
|
|
57817
58987
|
return "Times";
|
|
57818
58988
|
}
|
|
57819
58989
|
return "Helvetica";
|
|
@@ -58124,12 +59294,12 @@ var PdfFontBook = class {
|
|
|
58124
59294
|
const want = bold ? 700 : 400;
|
|
58125
59295
|
let best = faces[0];
|
|
58126
59296
|
let bestScore = Infinity;
|
|
58127
|
-
for (const
|
|
58128
|
-
const isItalic = (
|
|
58129
|
-
const score2 = Math.abs(
|
|
59297
|
+
for (const f2 of faces) {
|
|
59298
|
+
const isItalic = (f2.ttf.fsSelection & 1) !== 0 || (f2.ttf.macStyle & 2) !== 0;
|
|
59299
|
+
const score2 = Math.abs(f2.ttf.weightClass - want) + (isItalic !== italic ? 1e3 : 0);
|
|
58130
59300
|
if (score2 < bestScore) {
|
|
58131
59301
|
bestScore = score2;
|
|
58132
|
-
best =
|
|
59302
|
+
best = f2;
|
|
58133
59303
|
}
|
|
58134
59304
|
}
|
|
58135
59305
|
return best;
|
|
@@ -58167,8 +59337,8 @@ var PdfFontBook = class {
|
|
|
58167
59337
|
}
|
|
58168
59338
|
/** Writes the subset programs and CID font objects of every embedded font. Call once, after all text is placed. */
|
|
58169
59339
|
finish() {
|
|
58170
|
-
for (const
|
|
58171
|
-
|
|
59340
|
+
for (const f2 of this.embeddedFonts) {
|
|
59341
|
+
f2.finish(this.writer, this.compress);
|
|
58172
59342
|
}
|
|
58173
59343
|
}
|
|
58174
59344
|
};
|
|
@@ -58254,7 +59424,7 @@ function parseSvgMarkup(markup) {
|
|
|
58254
59424
|
|
|
58255
59425
|
// src/pdf-svg.ts
|
|
58256
59426
|
var IDENTITY6 = [1, 0, 0, 1, 0, 0];
|
|
58257
|
-
function
|
|
59427
|
+
function mul6(m, n) {
|
|
58258
59428
|
return [
|
|
58259
59429
|
m[0] * n[0] + m[2] * n[1],
|
|
58260
59430
|
m[1] * n[0] + m[3] * n[1],
|
|
@@ -58302,11 +59472,11 @@ function parseTransform(value) {
|
|
|
58302
59472
|
const s = Math.sin(r);
|
|
58303
59473
|
n = [c, s, -s, c, 0, 0];
|
|
58304
59474
|
if (a.length === 3) {
|
|
58305
|
-
n =
|
|
59475
|
+
n = mul6(mul6([1, 0, 0, 1, a[1], a[2]], n), [1, 0, 0, 1, -a[1], -a[2]]);
|
|
58306
59476
|
}
|
|
58307
59477
|
}
|
|
58308
59478
|
if (n && n.every(Number.isFinite)) {
|
|
58309
|
-
m =
|
|
59479
|
+
m = mul6(m, n);
|
|
58310
59480
|
}
|
|
58311
59481
|
}
|
|
58312
59482
|
return m;
|
|
@@ -58823,7 +59993,7 @@ var PdfBuilder = class {
|
|
|
58823
59993
|
}
|
|
58824
59994
|
const bounds = pts.slice(1, -1).map((p) => num(p.offset));
|
|
58825
59995
|
return this.writer.add(
|
|
58826
|
-
`<< /FunctionType 3 /Domain [0 1] /Functions [${fns.map((
|
|
59996
|
+
`<< /FunctionType 3 /Domain [0 1] /Functions [${fns.map((f2) => `${f2} 0 R`).join(" ")}] /Bounds [${bounds.join(" ")}] /Encode [${fns.map(() => "0 1").join(" ")}] >>`
|
|
58827
59997
|
);
|
|
58828
59998
|
}
|
|
58829
59999
|
/**
|
|
@@ -58904,8 +60074,8 @@ var PdfBuilder = class {
|
|
|
58904
60074
|
smask = this.alphaMask(c, node, stops, gt, ctm);
|
|
58905
60075
|
}
|
|
58906
60076
|
const pattern = this.cached(
|
|
58907
|
-
`gp:${node.attrs.id}:${
|
|
58908
|
-
() => this.writer.add(`<< /Type /Pattern /PatternType 2 /Shading ${shading} 0 R /Matrix [${
|
|
60077
|
+
`gp:${node.attrs.id}:${mul6(ctm, gt).map(num).join(",")}`,
|
|
60078
|
+
() => this.writer.add(`<< /Type /Pattern /PatternType 2 /Shading ${shading} 0 R /Matrix [${mul6(ctm, gt).map(num).join(" ")}] >>`)
|
|
58909
60079
|
);
|
|
58910
60080
|
colorOp = `/Pattern ${stroke ? "CS" : "cs"} ${c.res.use("Pattern", pattern)} ${stroke ? "SCN" : "scn"}`;
|
|
58911
60081
|
}
|
|
@@ -58974,7 +60144,7 @@ var PdfBuilder = class {
|
|
|
58974
60144
|
if (tw <= 0 || th <= 0) {
|
|
58975
60145
|
return null;
|
|
58976
60146
|
}
|
|
58977
|
-
const m =
|
|
60147
|
+
const m = mul6(ctm, parseTransform(p.attrs.patternTransform));
|
|
58978
60148
|
return this.cached(`tp:${p.attrs.id}:${m.map(num).join(",")}`, () => {
|
|
58979
60149
|
const tile = { ops: [], res: new Resources(), bounds: [0, 0, tw, th] };
|
|
58980
60150
|
for (const child of p.children ?? []) {
|
|
@@ -59034,7 +60204,7 @@ var PdfBuilder = class {
|
|
|
59034
60204
|
if (node.attrs.transform !== void 0) {
|
|
59035
60205
|
const t = parseTransform(node.attrs.transform);
|
|
59036
60206
|
c.ops.push(matrixOp(t));
|
|
59037
|
-
m =
|
|
60207
|
+
m = mul6(ctm, t);
|
|
59038
60208
|
}
|
|
59039
60209
|
this.clipOps(c, node.attrs["clip-path"], scope);
|
|
59040
60210
|
for (const child of node.children ?? []) {
|
|
@@ -59065,7 +60235,7 @@ var PdfBuilder = class {
|
|
|
59065
60235
|
const style = parseStyleAttr(a.style);
|
|
59066
60236
|
const blend = BLEND_NAMES[style["mix-blend-mode"]] ?? null;
|
|
59067
60237
|
const t = a.transform !== void 0 ? parseTransform(a.transform) : null;
|
|
59068
|
-
const m = t ?
|
|
60238
|
+
const m = t ? mul6(ctm, t) : ctm;
|
|
59069
60239
|
if (!isFinite(m[0] + m[3]) || m[0] * m[3] - m[1] * m[2] === 0) {
|
|
59070
60240
|
return;
|
|
59071
60241
|
}
|
|
@@ -59178,7 +60348,7 @@ var PdfBuilder = class {
|
|
|
59178
60348
|
const families = String(a["font-family"] ?? "sans-serif");
|
|
59179
60349
|
const font = this.fontBook.resolve(families, bold, italic);
|
|
59180
60350
|
const t = a.transform !== void 0 ? parseTransform(a.transform) : null;
|
|
59181
|
-
const m = t ?
|
|
60351
|
+
const m = t ? mul6(ctm, t) : ctm;
|
|
59182
60352
|
c.ops.push("q");
|
|
59183
60353
|
if (t) {
|
|
59184
60354
|
c.ops.push(matrixOp(t));
|
|
@@ -59274,7 +60444,7 @@ async function svgTreeToPdf(tree, options2 = {}) {
|
|
|
59274
60444
|
offY = (pageH - heightPx * scale) / 2;
|
|
59275
60445
|
}
|
|
59276
60446
|
const toPage = [scale, 0, 0, -scale, offX, pageH - offY];
|
|
59277
|
-
const base =
|
|
60447
|
+
const base = mul6(toPage, toPx);
|
|
59278
60448
|
const content = { ops: [], res: new Resources(), bounds: [0, 0, pageW, pageH] };
|
|
59279
60449
|
const scope = { defs: /* @__PURE__ */ new Map() };
|
|
59280
60450
|
indexIds(tree, scope.defs);
|
|
@@ -59416,12 +60586,12 @@ function addImage(scan, mime) {
|
|
|
59416
60586
|
scan.mimeTypes.add(mime);
|
|
59417
60587
|
}
|
|
59418
60588
|
function mergeNested(scan, inner) {
|
|
59419
|
-
for (const
|
|
59420
|
-
if (
|
|
59421
|
-
addFont(scan,
|
|
60589
|
+
for (const f2 of inner.fonts.values()) {
|
|
60590
|
+
if (f2.gdi) {
|
|
60591
|
+
addFont(scan, f2.name, "gdi");
|
|
59422
60592
|
}
|
|
59423
|
-
if (
|
|
59424
|
-
addFont(scan,
|
|
60593
|
+
if (f2.emfPlus) {
|
|
60594
|
+
addFont(scan, f2.name, "emfPlus");
|
|
59425
60595
|
}
|
|
59426
60596
|
}
|
|
59427
60597
|
scan.hasText || (scan.hasText = inner.hasText);
|
|
@@ -59725,10 +60895,10 @@ function inspectWmf(view, opts) {
|
|
|
59725
60895
|
width = inner.width;
|
|
59726
60896
|
height = inner.height;
|
|
59727
60897
|
description = inner.description;
|
|
59728
|
-
for (const
|
|
59729
|
-
addFont(scan,
|
|
59730
|
-
if (
|
|
59731
|
-
addFont(scan,
|
|
60898
|
+
for (const f2 of inner.fonts) {
|
|
60899
|
+
addFont(scan, f2.name, f2.gdi ? "gdi" : "emfPlus");
|
|
60900
|
+
if (f2.gdi && f2.emfPlus) {
|
|
60901
|
+
addFont(scan, f2.name, "emfPlus");
|
|
59732
60902
|
}
|
|
59733
60903
|
}
|
|
59734
60904
|
scan.hasText || (scan.hasText = inner.hasText);
|