libpag 4.5.1 → 4.5.3
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/LICENSE.txt +1589 -0
- package/README.md +172 -10
- package/README.zh_CN.md +114 -15
- package/lib/libpag.cjs.js +389 -887
- package/lib/libpag.cjs.js.map +1 -1
- package/lib/libpag.esm.js +389 -887
- package/lib/libpag.esm.js.map +1 -1
- package/lib/libpag.min.js +1 -1
- package/lib/libpag.min.js.map +1 -1
- package/lib/libpag.umd.js +389 -887
- package/lib/libpag.umd.js.map +1 -1
- package/lib/libpag.wasm +0 -0
- package/package.json +24 -12
- package/src/.pag.wasm-mt.md5 +1 -0
- package/src/.pag.wasm.md5 +1 -1
- package/src/core/matrix.ts +1 -2
- package/src/core/video-reader.ts +73 -94
- package/src/interfaces.ts +8 -17
- package/src/pag-composition.ts +12 -5
- package/src/pag-file.ts +146 -129
- package/src/pag-font.ts +1 -3
- package/src/pag-image-layer.ts +1 -2
- package/src/pag-image.ts +1 -3
- package/src/pag-layer.ts +2 -3
- package/src/pag-player.ts +7 -6
- package/src/pag-solid-layer.ts +1 -2
- package/src/pag-surface.ts +1 -2
- package/src/pag-text-layer.ts +1 -2
- package/src/pag-view.ts +3 -14
- package/src/pag.ts +0 -6
- package/src/types.ts +46 -3
- package/src/utils/decorators.ts +0 -42
- package/src/utils/type-utils.ts +1 -9
- package/src/utils/ua.ts +0 -1
- package/src/wasm/libpag.js +1 -1
- package/src/wasm/libpag.wasm +0 -0
- package/src/wasm-mt/libpag.js +5 -5
- package/src/wasm-mt/libpag.wasm +0 -0
- package/src/wechat/pag-file.ts +1 -2
- package/src/wechat/pag-image.ts +0 -2
- package/src/wechat/pag-view.ts +1 -2
- package/types/third_party/tgfx/web/src/core/path-rasterizer.d.ts +4 -0
- package/types/third_party/tgfx/web/src/core/scaler-context.d.ts +9 -2
- package/types/third_party/tgfx/web/src/utils/decorators.d.ts +0 -2
- package/types/web/src/core/video-reader.d.ts +4 -3
- package/types/web/src/interfaces.d.ts +8 -15
- package/types/web/src/pag-composition.d.ts +4 -4
- package/types/web/src/pag-file.d.ts +4 -4
- package/types/web/src/pag-layer.d.ts +1 -1
- package/types/web/src/pag-player.d.ts +2 -2
- package/types/web/src/pag-view.d.ts +1 -1
- package/types/web/src/types.d.ts +13 -4
- package/types/web/src/utils/decorators.d.ts +0 -2
- package/types/web/src/utils/ua.d.ts +0 -1
- package/types/web/tsconfig.json +19 -0
- package/lib/libpag.worker.cjs.js +0 -798
- package/lib/libpag.worker.cjs.js.map +0 -1
- package/lib/libpag.worker.esm.js +0 -793
- package/lib/libpag.worker.esm.js.map +0 -1
- package/lib/libpag.worker.js +0 -804
- package/lib/libpag.worker.js.map +0 -1
- package/lib/libpag.worker.min.js +0 -2
- package/lib/libpag.worker.min.js.map +0 -1
- package/src/worker/client.ts +0 -80
- package/src/worker/events.ts +0 -41
- package/src/worker/pag-file.ts +0 -90
- package/src/worker/pag-image.ts +0 -43
- package/src/worker/pag-view.ts +0 -171
- package/src/worker/utils.ts +0 -29
- package/src/worker/video-reader.ts +0 -62
- package/src/worker/worker.ts +0 -169
- package/types/third_party/tgfx/web/src/core/web-mask.d.ts +0 -26
- package/types/web/src/utils/canvas.d.ts +0 -4
- package/types/web/src/worker/client.d.ts +0 -16
- package/types/web/src/worker/events.d.ts +0 -32
- package/types/web/src/worker/pag-file.d.ts +0 -33
- package/types/web/src/worker/pag-image.d.ts +0 -8
- package/types/web/src/worker/pag-view.d.ts +0 -67
- package/types/web/src/worker/utils.d.ts +0 -7
- package/types/web/src/worker/video-reader.d.ts +0 -16
- package/types/web/src/worker/worker.d.ts +0 -13
package/lib/libpag.umd.js
CHANGED
|
@@ -51,43 +51,6 @@
|
|
|
51
51
|
PAGModule = module;
|
|
52
52
|
};
|
|
53
53
|
|
|
54
|
-
function wasmAwaitRewind$1(constructor) {
|
|
55
|
-
const ignoreStaticFunctions = ["length", "name", "prototype", "wasmAsyncMethods"];
|
|
56
|
-
let staticFunctions = Object.getOwnPropertyNames(constructor).filter(
|
|
57
|
-
(name) => ignoreStaticFunctions.indexOf(name) === -1
|
|
58
|
-
);
|
|
59
|
-
if (constructor.wasmAsyncMethods && constructor.wasmAsyncMethods.length > 0) {
|
|
60
|
-
staticFunctions = staticFunctions.filter((name) => constructor.wasmAsyncMethods.indexOf(name) === -1);
|
|
61
|
-
}
|
|
62
|
-
let functions = Object.getOwnPropertyNames(constructor.prototype).filter(
|
|
63
|
-
(name) => name !== "constructor" && typeof constructor.prototype[name] === "function"
|
|
64
|
-
);
|
|
65
|
-
if (constructor.prototype.wasmAsyncMethods && constructor.prototype.wasmAsyncMethods.length > 0) {
|
|
66
|
-
functions = functions.filter((name) => constructor.prototype.wasmAsyncMethods.indexOf(name) === -1);
|
|
67
|
-
}
|
|
68
|
-
const proxyFn = (target, methodName) => {
|
|
69
|
-
const fn = target[methodName];
|
|
70
|
-
target[methodName] = function(...args) {
|
|
71
|
-
if (PAGModule.Asyncify.currData !== null) {
|
|
72
|
-
const currData = PAGModule.Asyncify.currData;
|
|
73
|
-
PAGModule.Asyncify.currData = null;
|
|
74
|
-
const ret = fn.call(this, ...args);
|
|
75
|
-
PAGModule.Asyncify.currData = currData;
|
|
76
|
-
return ret;
|
|
77
|
-
} else {
|
|
78
|
-
return fn.call(this, ...args);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
staticFunctions.forEach((name) => proxyFn(constructor, name));
|
|
83
|
-
functions.forEach((name) => proxyFn(constructor.prototype, name));
|
|
84
|
-
}
|
|
85
|
-
function wasmAsyncMethod(target, propertyKey, descriptor) {
|
|
86
|
-
if (!target.wasmAsyncMethods) {
|
|
87
|
-
target.wasmAsyncMethods = [];
|
|
88
|
-
}
|
|
89
|
-
target.wasmAsyncMethods.push(propertyKey);
|
|
90
|
-
}
|
|
91
54
|
function destroyVerify$1(constructor) {
|
|
92
55
|
let functions = Object.getOwnPropertyNames(constructor.prototype).filter(
|
|
93
56
|
(name) => name !== "constructor" && typeof constructor.prototype[name] === "function"
|
|
@@ -185,6 +148,41 @@
|
|
|
185
148
|
AlphaType2[AlphaType2["Unpremultiplied"] = 3] = "Unpremultiplied";
|
|
186
149
|
return AlphaType2;
|
|
187
150
|
})(AlphaType || {});
|
|
151
|
+
class VecArray extends Array {
|
|
152
|
+
constructor(...items) {
|
|
153
|
+
super(...items);
|
|
154
|
+
this.isDeleted = false;
|
|
155
|
+
Object.setPrototypeOf(this, VecArray.prototype);
|
|
156
|
+
}
|
|
157
|
+
static create() {
|
|
158
|
+
return new VecArray();
|
|
159
|
+
}
|
|
160
|
+
get(index) {
|
|
161
|
+
this.ensureNotDeleted();
|
|
162
|
+
if (index < 0 || index >= this.length) {
|
|
163
|
+
throw new RangeError("Index out of bounds");
|
|
164
|
+
}
|
|
165
|
+
return this[index];
|
|
166
|
+
}
|
|
167
|
+
push_back(value) {
|
|
168
|
+
this.ensureNotDeleted();
|
|
169
|
+
this.push(value);
|
|
170
|
+
}
|
|
171
|
+
size() {
|
|
172
|
+
this.ensureNotDeleted();
|
|
173
|
+
return this.length;
|
|
174
|
+
}
|
|
175
|
+
delete() {
|
|
176
|
+
this.ensureNotDeleted();
|
|
177
|
+
this.length = 0;
|
|
178
|
+
this.isDeleted = true;
|
|
179
|
+
}
|
|
180
|
+
ensureNotDeleted() {
|
|
181
|
+
if (this.isDeleted) {
|
|
182
|
+
throw new Error("This VecArray instance has been deleted.");
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
188
186
|
|
|
189
187
|
var types = /*#__PURE__*/Object.freeze({
|
|
190
188
|
__proto__: null,
|
|
@@ -197,7 +195,8 @@
|
|
|
197
195
|
MatrixIndex: MatrixIndex$1,
|
|
198
196
|
DecoderResult: DecoderResult,
|
|
199
197
|
ColorType: ColorType,
|
|
200
|
-
AlphaType: AlphaType
|
|
198
|
+
AlphaType: AlphaType,
|
|
199
|
+
VecArray: VecArray
|
|
201
200
|
});
|
|
202
201
|
|
|
203
202
|
var __defProp$d = Object.defineProperty;
|
|
@@ -343,20 +342,11 @@
|
|
|
343
342
|
}
|
|
344
343
|
};
|
|
345
344
|
Matrix$1 = __decorateClass$c([
|
|
346
|
-
destroyVerify$1
|
|
347
|
-
wasmAwaitRewind$1
|
|
345
|
+
destroyVerify$1
|
|
348
346
|
], Matrix$1);
|
|
349
347
|
|
|
350
348
|
const rewindData = (fn, scope, ...args) => {
|
|
351
|
-
|
|
352
|
-
const currData = PAGModule.Asyncify.currData;
|
|
353
|
-
PAGModule.Asyncify.currData = null;
|
|
354
|
-
const ret = fn.call(scope, ...args);
|
|
355
|
-
PAGModule.Asyncify.currData = currData;
|
|
356
|
-
return ret;
|
|
357
|
-
} else {
|
|
358
|
-
return fn.call(scope, ...args);
|
|
359
|
-
}
|
|
349
|
+
return fn.call(scope, ...args);
|
|
360
350
|
};
|
|
361
351
|
const proxyVector = (vector, process) => {
|
|
362
352
|
const proxy = new Proxy(vector, {
|
|
@@ -544,7 +534,7 @@
|
|
|
544
534
|
return this.wasmIns._isPAGFile();
|
|
545
535
|
}
|
|
546
536
|
asTypeLayer() {
|
|
547
|
-
return layer2typeLayer(this);
|
|
537
|
+
return layer2typeLayer(this.wasmIns);
|
|
548
538
|
}
|
|
549
539
|
isDelete() {
|
|
550
540
|
return this.wasmIns.isDelete();
|
|
@@ -555,8 +545,7 @@
|
|
|
555
545
|
}
|
|
556
546
|
};
|
|
557
547
|
PAGLayer = __decorateClass$b([
|
|
558
|
-
destroyVerify$1
|
|
559
|
-
wasmAwaitRewind$1
|
|
548
|
+
destroyVerify$1
|
|
560
549
|
], PAGLayer);
|
|
561
550
|
|
|
562
551
|
var __defProp$b = Object.defineProperty;
|
|
@@ -647,18 +636,25 @@
|
|
|
647
636
|
const wasmIns = this.wasmIns._getLayersByName(layerName);
|
|
648
637
|
if (!wasmIns)
|
|
649
638
|
throw new Error(`Get layers by ${layerName} fail!`);
|
|
650
|
-
|
|
639
|
+
const layerArray = VecArray.create();
|
|
640
|
+
for (const wasmIn of wasmIns) {
|
|
641
|
+
layerArray.push(layer2typeLayer(wasmIn));
|
|
642
|
+
}
|
|
643
|
+
return layerArray;
|
|
651
644
|
}
|
|
652
645
|
getLayersUnderPoint(localX, localY) {
|
|
653
646
|
const wasmIns = this.wasmIns._getLayersUnderPoint(localX, localY);
|
|
654
647
|
if (!wasmIns)
|
|
655
648
|
throw new Error(`Get layers under point ${localX},${localY} fail!`);
|
|
656
|
-
|
|
649
|
+
const layerArray = VecArray.create();
|
|
650
|
+
for (const wasmIn of wasmIns) {
|
|
651
|
+
layerArray.push(layer2typeLayer(wasmIn));
|
|
652
|
+
}
|
|
653
|
+
return layerArray;
|
|
657
654
|
}
|
|
658
655
|
};
|
|
659
656
|
PAGComposition = __decorateClass$a([
|
|
660
|
-
destroyVerify$1
|
|
661
|
-
wasmAwaitRewind$1
|
|
657
|
+
destroyVerify$1
|
|
662
658
|
], PAGComposition);
|
|
663
659
|
|
|
664
660
|
const readFile = (file) => new Promise((resolve) => {
|
|
@@ -740,7 +736,11 @@
|
|
|
740
736
|
const wasmIns = this.wasmIns._getLayersByEditableIndex(editableIndex, layerType);
|
|
741
737
|
if (!wasmIns)
|
|
742
738
|
throw new Error(`Get ${getLayerTypeName(layerType)} layers by ${editableIndex} fail!`);
|
|
743
|
-
|
|
739
|
+
const layerArray = VecArray.create();
|
|
740
|
+
for (const wasmIn of wasmIns) {
|
|
741
|
+
layerArray.push(layer2typeLayer(wasmIn));
|
|
742
|
+
}
|
|
743
|
+
return layerArray;
|
|
744
744
|
}
|
|
745
745
|
getEditableIndices(layerType) {
|
|
746
746
|
return this.wasmIns._getEditableIndices(layerType);
|
|
@@ -761,12 +761,8 @@
|
|
|
761
761
|
return new PAGFile(wasmIns);
|
|
762
762
|
}
|
|
763
763
|
};
|
|
764
|
-
__decorateClass$9([
|
|
765
|
-
wasmAsyncMethod
|
|
766
|
-
], PAGFile, "load", 1);
|
|
767
764
|
PAGFile = __decorateClass$9([
|
|
768
|
-
destroyVerify$1
|
|
769
|
-
wasmAwaitRewind$1
|
|
765
|
+
destroyVerify$1
|
|
770
766
|
], PAGFile);
|
|
771
767
|
|
|
772
768
|
var __defProp$9 = Object.defineProperty;
|
|
@@ -830,8 +826,7 @@
|
|
|
830
826
|
}
|
|
831
827
|
};
|
|
832
828
|
PAGSurface = __decorateClass$8([
|
|
833
|
-
destroyVerify$1
|
|
834
|
-
wasmAwaitRewind$1
|
|
829
|
+
destroyVerify$1
|
|
835
830
|
], PAGSurface);
|
|
836
831
|
|
|
837
832
|
var __defProp$8 = Object.defineProperty;
|
|
@@ -967,7 +962,11 @@
|
|
|
967
962
|
const wasmIns = this.wasmIns._getLayersUnderPoint(localX, localY);
|
|
968
963
|
if (!wasmIns)
|
|
969
964
|
throw new Error(`Get layers under point, x: ${localX} y:${localY} fail!`);
|
|
970
|
-
|
|
965
|
+
const layerArray = VecArray.create();
|
|
966
|
+
for (const wasmIn of wasmIns) {
|
|
967
|
+
layerArray.push(layer2typeLayer(wasmIn));
|
|
968
|
+
}
|
|
969
|
+
return layerArray;
|
|
971
970
|
}
|
|
972
971
|
hitTestPoint(pagLayer, surfaceX, surfaceY, pixelHitTest = false) {
|
|
973
972
|
return this.wasmIns._hitTestPoint(pagLayer.wasmIns, surfaceX, surfaceY, pixelHitTest);
|
|
@@ -1005,15 +1004,8 @@
|
|
|
1005
1004
|
}
|
|
1006
1005
|
}
|
|
1007
1006
|
};
|
|
1008
|
-
__decorateClass$7([
|
|
1009
|
-
wasmAsyncMethod
|
|
1010
|
-
], PAGPlayer.prototype, "flush", 1);
|
|
1011
|
-
__decorateClass$7([
|
|
1012
|
-
wasmAsyncMethod
|
|
1013
|
-
], PAGPlayer.prototype, "flushInternal", 1);
|
|
1014
1007
|
PAGPlayer = __decorateClass$7([
|
|
1015
|
-
destroyVerify$1
|
|
1016
|
-
wasmAwaitRewind$1
|
|
1008
|
+
destroyVerify$1
|
|
1017
1009
|
], PAGPlayer);
|
|
1018
1010
|
|
|
1019
1011
|
var __defProp$7 = Object.defineProperty;
|
|
@@ -1089,12 +1081,8 @@
|
|
|
1089
1081
|
this.isDestroyed = true;
|
|
1090
1082
|
}
|
|
1091
1083
|
};
|
|
1092
|
-
__decorateClass$6([
|
|
1093
|
-
wasmAsyncMethod
|
|
1094
|
-
], PAGImage, "fromFile", 1);
|
|
1095
1084
|
PAGImage = __decorateClass$6([
|
|
1096
|
-
destroyVerify$1
|
|
1097
|
-
wasmAwaitRewind$1
|
|
1085
|
+
destroyVerify$1
|
|
1098
1086
|
], PAGImage);
|
|
1099
1087
|
|
|
1100
1088
|
class EventManager {
|
|
@@ -1322,26 +1310,17 @@
|
|
|
1322
1310
|
}
|
|
1323
1311
|
}
|
|
1324
1312
|
|
|
1313
|
+
const CANVAS_POOL_MAX_SIZE = 10;
|
|
1314
|
+
|
|
1315
|
+
const isInstanceOf = (value, type) => typeof type !== "undefined" && value instanceof type;
|
|
1316
|
+
|
|
1325
1317
|
const nav$1 = navigator?.userAgent || "";
|
|
1326
1318
|
const ANDROID$1 = /android|adr/i.test(nav$1);
|
|
1327
1319
|
const MOBILE$1 = /(mobile)/i.test(nav$1) && ANDROID$1;
|
|
1328
1320
|
!(/(mobile)/i.test(nav$1) || MOBILE$1) && /Mac OS X/i.test(nav$1);
|
|
1329
1321
|
const IPHONE$1 = /(iphone|ipad|ipod)/i.test(nav$1);
|
|
1330
|
-
|
|
1322
|
+
/MicroMessenger/i.test(nav$1);
|
|
1331
1323
|
const SAFARI_OR_IOS_WEBVIEW$1 = /^((?!chrome|android).)*safari/i.test(nav$1) || IPHONE$1;
|
|
1332
|
-
const WORKER$1 = typeof globalThis.importScripts === "function";
|
|
1333
|
-
|
|
1334
|
-
const CANVAS_POOL_MAX_SIZE = 10;
|
|
1335
|
-
|
|
1336
|
-
const isInstanceOf = (value, type) => typeof type !== "undefined" && value instanceof type;
|
|
1337
|
-
|
|
1338
|
-
const nav = navigator?.userAgent || "";
|
|
1339
|
-
const ANDROID = /android|adr/i.test(nav);
|
|
1340
|
-
const MOBILE = /(mobile)/i.test(nav) && ANDROID;
|
|
1341
|
-
!(/(mobile)/i.test(nav) || MOBILE) && /Mac OS X/i.test(nav);
|
|
1342
|
-
const IPHONE = /(iphone|ipad|ipod)/i.test(nav);
|
|
1343
|
-
/MicroMessenger/i.test(nav);
|
|
1344
|
-
const SAFARI_OR_IOS_WEBVIEW = /^((?!chrome|android).)*safari/i.test(nav) || IPHONE;
|
|
1345
1324
|
const WORKER = typeof globalThis.importScripts === "function";
|
|
1346
1325
|
|
|
1347
1326
|
const canvasPool = new Array();
|
|
@@ -1361,7 +1340,7 @@
|
|
|
1361
1340
|
}
|
|
1362
1341
|
};
|
|
1363
1342
|
const createCanvas2D = () => {
|
|
1364
|
-
if (SAFARI_OR_IOS_WEBVIEW && !WORKER) {
|
|
1343
|
+
if (SAFARI_OR_IOS_WEBVIEW$1 && !WORKER) {
|
|
1365
1344
|
return document.createElement("canvas");
|
|
1366
1345
|
}
|
|
1367
1346
|
try {
|
|
@@ -1644,8 +1623,8 @@
|
|
|
1644
1623
|
prepare() {
|
|
1645
1624
|
return this.player.prepare();
|
|
1646
1625
|
}
|
|
1647
|
-
makeSnapshot() {
|
|
1648
|
-
return createImageBitmap(this.canvasElement);
|
|
1626
|
+
async makeSnapshot() {
|
|
1627
|
+
return await createImageBitmap(this.canvasElement);
|
|
1649
1628
|
}
|
|
1650
1629
|
destroy() {
|
|
1651
1630
|
this.clearTimer();
|
|
@@ -1725,23 +1704,13 @@
|
|
|
1725
1704
|
}
|
|
1726
1705
|
}
|
|
1727
1706
|
setTimer() {
|
|
1728
|
-
|
|
1729
|
-
this.
|
|
1730
|
-
|
|
1731
|
-
}, 1 / this.frameRate * 1e3);
|
|
1732
|
-
} else {
|
|
1733
|
-
this.timer = globalThis.requestAnimationFrame(() => {
|
|
1734
|
-
this.flushLoop();
|
|
1735
|
-
});
|
|
1736
|
-
}
|
|
1707
|
+
this.timer = globalThis.requestAnimationFrame(() => {
|
|
1708
|
+
this.flushLoop();
|
|
1709
|
+
});
|
|
1737
1710
|
}
|
|
1738
1711
|
clearTimer() {
|
|
1739
1712
|
if (this.timer) {
|
|
1740
|
-
|
|
1741
|
-
self.clearTimeout(this.timer);
|
|
1742
|
-
} else {
|
|
1743
|
-
globalThis.cancelAnimationFrame(this.timer);
|
|
1744
|
-
}
|
|
1713
|
+
globalThis.cancelAnimationFrame(this.timer);
|
|
1745
1714
|
this.timer = null;
|
|
1746
1715
|
}
|
|
1747
1716
|
}
|
|
@@ -1864,12 +1833,8 @@
|
|
|
1864
1833
|
this.isDestroyed = true;
|
|
1865
1834
|
}
|
|
1866
1835
|
};
|
|
1867
|
-
__decorateClass$4([
|
|
1868
|
-
wasmAsyncMethod
|
|
1869
|
-
], PAGFont, "registerFont", 1);
|
|
1870
1836
|
PAGFont = __decorateClass$4([
|
|
1871
|
-
destroyVerify$1
|
|
1872
|
-
wasmAwaitRewind$1
|
|
1837
|
+
destroyVerify$1
|
|
1873
1838
|
], PAGFont);
|
|
1874
1839
|
|
|
1875
1840
|
let eventHandlers = {};
|
|
@@ -1892,117 +1857,13 @@
|
|
|
1892
1857
|
eventHandlers[event] = eventHandlers[event]?.filter(({ node }) => node !== targetNode);
|
|
1893
1858
|
};
|
|
1894
1859
|
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
WorkerMessageType2["PAGView_setRepeatCount"] = "PAGView.setRepeatCount";
|
|
1903
|
-
WorkerMessageType2["PAGView_getProgress"] = "PAGView.getProgress";
|
|
1904
|
-
WorkerMessageType2["PAGView_currentFrame"] = "PAGView.currentFrame";
|
|
1905
|
-
WorkerMessageType2["PAGView_setProgress"] = "PAGView.setProgress";
|
|
1906
|
-
WorkerMessageType2["PAGView_scaleMode"] = "PAGView.scaleMode";
|
|
1907
|
-
WorkerMessageType2["PAGView_setScaleMode"] = "PAGView.setScaleMode";
|
|
1908
|
-
WorkerMessageType2["PAGView_flush"] = "PAGView.flush";
|
|
1909
|
-
WorkerMessageType2["PAGView_getDebugData"] = "PAGView.getDebugData";
|
|
1910
|
-
WorkerMessageType2["PAGView_destroy"] = "PAGView.destroy";
|
|
1911
|
-
WorkerMessageType2["PAGFile_load"] = "PAGFile.load";
|
|
1912
|
-
WorkerMessageType2["PAGFile_getTextData"] = "PAGFile.getTextData";
|
|
1913
|
-
WorkerMessageType2["PAGFile_replaceText"] = "PAGFile.replaceText";
|
|
1914
|
-
WorkerMessageType2["PAGFile_replaceImage"] = "PAGFile.replaceImage";
|
|
1915
|
-
WorkerMessageType2["PAGFile_destroy"] = "PAGFile.destroy";
|
|
1916
|
-
WorkerMessageType2["PAGImage_fromSource"] = "PAGImage.fromSource";
|
|
1917
|
-
WorkerMessageType2["PAGImage_destroy"] = "PAGImage.destroy";
|
|
1918
|
-
WorkerMessageType2["VideoReader_constructor"] = "VideoReader.constructor";
|
|
1919
|
-
WorkerMessageType2["VideoReader_prepare"] = "VideoReader.prepare";
|
|
1920
|
-
WorkerMessageType2["VideoReader_play"] = "VideoReader.play";
|
|
1921
|
-
WorkerMessageType2["VideoReader_pause"] = "VideoReader.pause";
|
|
1922
|
-
WorkerMessageType2["VideoReader_stop"] = "VideoReader.stop";
|
|
1923
|
-
WorkerMessageType2["VideoReader_getError"] = "VideoReader.getError";
|
|
1924
|
-
WorkerMessageType2["PAGModule_linkVideoReader"] = "PAGModule.linkVideoReader";
|
|
1925
|
-
WorkerMessageType2["TextDocument_delete"] = "TextDocument.delete";
|
|
1926
|
-
return WorkerMessageType2;
|
|
1927
|
-
})(WorkerMessageType || {});
|
|
1928
|
-
|
|
1929
|
-
let messageCount = 0;
|
|
1930
|
-
const generateMessageName = (name) => `${name}_${messageCount++}`;
|
|
1931
|
-
const postMessage = (worker, message, callback, transfer = []) => {
|
|
1932
|
-
return new Promise((resolve) => {
|
|
1933
|
-
const name = generateMessageName(message.name);
|
|
1934
|
-
const handle = (event) => {
|
|
1935
|
-
if (event.data.name === name) {
|
|
1936
|
-
worker.removeEventListener("message", handle);
|
|
1937
|
-
resolve(callback(...event.data.args));
|
|
1938
|
-
}
|
|
1939
|
-
};
|
|
1940
|
-
worker.addEventListener("message", handle);
|
|
1941
|
-
worker.postMessage({ name, args: message.args }, transfer);
|
|
1942
|
-
});
|
|
1943
|
-
};
|
|
1944
|
-
|
|
1945
|
-
class BitmapImage {
|
|
1946
|
-
constructor(bitmap) {
|
|
1947
|
-
this.bitmap = bitmap;
|
|
1948
|
-
}
|
|
1949
|
-
setBitmap(bitmap) {
|
|
1950
|
-
if (this.bitmap) {
|
|
1951
|
-
this.bitmap.close();
|
|
1952
|
-
}
|
|
1953
|
-
this.bitmap = bitmap;
|
|
1954
|
-
}
|
|
1955
|
-
}
|
|
1956
|
-
|
|
1957
|
-
class WorkerVideoReader {
|
|
1958
|
-
constructor(proxyId) {
|
|
1959
|
-
this.bitmap = null;
|
|
1960
|
-
this.isSought = false;
|
|
1961
|
-
this.isPlaying = false;
|
|
1962
|
-
this.bitmapImage = new BitmapImage(null);
|
|
1963
|
-
this.proxyId = proxyId;
|
|
1964
|
-
}
|
|
1965
|
-
prepare(targetFrame, playbackRate) {
|
|
1966
|
-
return new Promise((resolve) => {
|
|
1967
|
-
postMessage(
|
|
1968
|
-
self,
|
|
1969
|
-
{ name: WorkerMessageType.VideoReader_prepare, args: [this.proxyId, targetFrame, playbackRate] },
|
|
1970
|
-
(res) => {
|
|
1971
|
-
this.bitmapImage.setBitmap(res);
|
|
1972
|
-
resolve();
|
|
1973
|
-
}
|
|
1974
|
-
);
|
|
1975
|
-
});
|
|
1976
|
-
}
|
|
1977
|
-
getVideo() {
|
|
1978
|
-
return this.bitmapImage;
|
|
1979
|
-
}
|
|
1980
|
-
onDestroy() {
|
|
1981
|
-
self.postMessage({ name: "VideoReader.onDestroy", args: [this.proxyId] });
|
|
1982
|
-
}
|
|
1983
|
-
play() {
|
|
1984
|
-
return new Promise((resolve) => {
|
|
1985
|
-
postMessage(self, { name: WorkerMessageType.VideoReader_play, args: [this.proxyId] }, () => {
|
|
1986
|
-
resolve();
|
|
1987
|
-
});
|
|
1988
|
-
});
|
|
1989
|
-
}
|
|
1990
|
-
pause() {
|
|
1991
|
-
postMessage(self, { name: WorkerMessageType.VideoReader_pause, args: [this.proxyId] }, () => {
|
|
1992
|
-
});
|
|
1993
|
-
}
|
|
1994
|
-
stop() {
|
|
1995
|
-
postMessage(self, { name: WorkerMessageType.VideoReader_stop, args: [this.proxyId] }, () => {
|
|
1996
|
-
});
|
|
1997
|
-
}
|
|
1998
|
-
getError() {
|
|
1999
|
-
return new Promise((resolve) => {
|
|
2000
|
-
postMessage(self, { name: WorkerMessageType.VideoReader_getError, args: [this.proxyId] }, (res) => {
|
|
2001
|
-
resolve(res);
|
|
2002
|
-
});
|
|
2003
|
-
});
|
|
2004
|
-
}
|
|
2005
|
-
}
|
|
1860
|
+
const nav = navigator?.userAgent || "";
|
|
1861
|
+
const ANDROID = /android|adr/i.test(nav);
|
|
1862
|
+
const MOBILE = /(mobile)/i.test(nav) && ANDROID;
|
|
1863
|
+
!(/(mobile)/i.test(nav) || MOBILE) && /Mac OS X/i.test(nav);
|
|
1864
|
+
const IPHONE = /(iphone|ipad|ipod)/i.test(nav);
|
|
1865
|
+
const WECHAT = /MicroMessenger/i.test(nav);
|
|
1866
|
+
const SAFARI_OR_IOS_WEBVIEW = /^((?!chrome|android).)*safari/i.test(nav) || IPHONE;
|
|
2006
1867
|
|
|
2007
1868
|
const UHD_RESOLUTION = 3840;
|
|
2008
1869
|
const getWechatNetwork = () => {
|
|
@@ -2034,7 +1895,7 @@
|
|
|
2034
1895
|
});
|
|
2035
1896
|
};
|
|
2036
1897
|
class VideoReader {
|
|
2037
|
-
constructor(source, width, height, frameRate, staticTimeRanges
|
|
1898
|
+
constructor(source, width, height, frameRate, staticTimeRanges) {
|
|
2038
1899
|
this.isSought = false;
|
|
2039
1900
|
this.isPlaying = false;
|
|
2040
1901
|
this.bitmap = null;
|
|
@@ -2049,6 +1910,7 @@
|
|
|
2049
1910
|
this.height = 0;
|
|
2050
1911
|
this.bitmapCanvas = null;
|
|
2051
1912
|
this.bitmapCtx = null;
|
|
1913
|
+
this.currentFrame = 0;
|
|
2052
1914
|
if (isInstanceOf$1(source, globalThis.HTMLVideoElement)) {
|
|
2053
1915
|
this.videoEl = source;
|
|
2054
1916
|
this.canplay = true;
|
|
@@ -2063,9 +1925,10 @@
|
|
|
2063
1925
|
waitVideoCanPlay(this.videoEl).then(() => {
|
|
2064
1926
|
this.canplay = true;
|
|
2065
1927
|
});
|
|
2066
|
-
const
|
|
1928
|
+
const buffer = source.slice();
|
|
1929
|
+
const blob = new Blob([buffer], { type: "video/mp4" });
|
|
2067
1930
|
this.videoEl.src = URL.createObjectURL(blob);
|
|
2068
|
-
if (IPHONE
|
|
1931
|
+
if (IPHONE) {
|
|
2069
1932
|
this.videoEl.load();
|
|
2070
1933
|
}
|
|
2071
1934
|
}
|
|
@@ -2076,91 +1939,74 @@
|
|
|
2076
1939
|
if (UHD_RESOLUTION < width || UHD_RESOLUTION < height) {
|
|
2077
1940
|
this.disablePlaybackRate = true;
|
|
2078
1941
|
}
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
}
|
|
2082
|
-
}
|
|
2083
|
-
static async create(source, width, height, frameRate, staticTimeRanges) {
|
|
2084
|
-
if (WORKER$1) {
|
|
2085
|
-
const proxyId = await new Promise((resolve) => {
|
|
2086
|
-
const uint8Array = source;
|
|
2087
|
-
const buffer = uint8Array.buffer.slice(uint8Array.byteOffset, uint8Array.byteOffset + uint8Array.byteLength);
|
|
2088
|
-
postMessage(
|
|
2089
|
-
self,
|
|
2090
|
-
{
|
|
2091
|
-
name: WorkerMessageType.VideoReader_constructor,
|
|
2092
|
-
args: [buffer, width, height, frameRate, staticTimeRanges, true]
|
|
2093
|
-
},
|
|
2094
|
-
(res) => {
|
|
2095
|
-
resolve(res);
|
|
2096
|
-
},
|
|
2097
|
-
[buffer]
|
|
2098
|
-
);
|
|
2099
|
-
});
|
|
2100
|
-
const videoReader = new WorkerVideoReader(proxyId);
|
|
2101
|
-
PAGModule.currentPlayer?.linkVideoReader(videoReader);
|
|
2102
|
-
return videoReader;
|
|
2103
|
-
}
|
|
1942
|
+
}
|
|
1943
|
+
static create(source, width, height, frameRate, staticTimeRanges) {
|
|
2104
1944
|
return new VideoReader(source, width, height, frameRate, staticTimeRanges);
|
|
2105
1945
|
}
|
|
2106
1946
|
async prepare(targetFrame, playbackRate) {
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
if (
|
|
2113
|
-
|
|
1947
|
+
const promise = new Promise(async (resolve, reject) => {
|
|
1948
|
+
this.setError(null);
|
|
1949
|
+
this.isSought = false;
|
|
1950
|
+
const { currentTime } = this.videoEl;
|
|
1951
|
+
const targetTime = targetFrame / this.frameRate;
|
|
1952
|
+
if (currentTime === 0 && targetTime === 0) {
|
|
1953
|
+
if (!this.canplay && !SAFARI_OR_IOS_WEBVIEW) {
|
|
1954
|
+
await waitVideoCanPlay(this.videoEl);
|
|
1955
|
+
} else {
|
|
1956
|
+
try {
|
|
1957
|
+
await this.play();
|
|
1958
|
+
} catch (e) {
|
|
1959
|
+
this.setError(e);
|
|
1960
|
+
this.currentFrame = targetFrame;
|
|
1961
|
+
reject(e);
|
|
1962
|
+
return;
|
|
1963
|
+
}
|
|
1964
|
+
await new Promise((resolveInner) => {
|
|
1965
|
+
requestAnimationFrame(() => {
|
|
1966
|
+
this.pause();
|
|
1967
|
+
resolveInner();
|
|
1968
|
+
});
|
|
1969
|
+
});
|
|
1970
|
+
}
|
|
2114
1971
|
} else {
|
|
1972
|
+
if (Math.round(targetTime * this.frameRate) === Math.round(currentTime * this.frameRate)) ; else if (this.staticTimeRanges?.contains(targetFrame)) {
|
|
1973
|
+
await this.seek(targetTime, false);
|
|
1974
|
+
this.currentFrame = targetFrame;
|
|
1975
|
+
resolve();
|
|
1976
|
+
return;
|
|
1977
|
+
} else if (Math.abs(currentTime - targetTime) < 1 / this.frameRate * VIDEO_DECODE_WAIT_FRAME) ; else {
|
|
1978
|
+
this.isSought = true;
|
|
1979
|
+
await this.seek(targetTime);
|
|
1980
|
+
this.currentFrame = targetFrame;
|
|
1981
|
+
resolve();
|
|
1982
|
+
return;
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
const targetPlaybackRate = Math.min(Math.max(playbackRate, VIDEO_PLAYBACK_RATE_MIN), VIDEO_PLAYBACK_RATE_MAX);
|
|
1986
|
+
if (!this.disablePlaybackRate && this.videoEl.playbackRate !== targetPlaybackRate) {
|
|
1987
|
+
this.videoEl.playbackRate = targetPlaybackRate;
|
|
1988
|
+
}
|
|
1989
|
+
if (this.isPlaying && this.videoEl.paused) {
|
|
2115
1990
|
try {
|
|
2116
1991
|
await this.play();
|
|
2117
1992
|
} catch (e) {
|
|
2118
1993
|
this.setError(e);
|
|
1994
|
+
this.currentFrame = targetFrame;
|
|
1995
|
+
reject(e);
|
|
1996
|
+
return;
|
|
2119
1997
|
}
|
|
2120
|
-
await new Promise((resolve) => {
|
|
2121
|
-
requestAnimationFrame(() => {
|
|
2122
|
-
this.pause();
|
|
2123
|
-
resolve();
|
|
2124
|
-
});
|
|
2125
|
-
});
|
|
2126
|
-
}
|
|
2127
|
-
} else {
|
|
2128
|
-
if (Math.round(targetTime * this.frameRate) === Math.round(currentTime * this.frameRate)) ; else if (this.staticTimeRanges?.contains(targetFrame)) {
|
|
2129
|
-
await this.seek(targetTime, false);
|
|
2130
|
-
return;
|
|
2131
|
-
} else if (Math.abs(currentTime - targetTime) < 1 / this.frameRate * VIDEO_DECODE_WAIT_FRAME) ; else {
|
|
2132
|
-
this.isSought = true;
|
|
2133
|
-
await this.seek(targetTime);
|
|
2134
|
-
return;
|
|
2135
1998
|
}
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
await this.play();
|
|
2144
|
-
} catch (e) {
|
|
2145
|
-
this.setError(e);
|
|
2146
|
-
}
|
|
2147
|
-
}
|
|
1999
|
+
this.currentFrame = targetFrame;
|
|
2000
|
+
resolve();
|
|
2001
|
+
});
|
|
2002
|
+
await promise;
|
|
2003
|
+
}
|
|
2004
|
+
getCurrentFrame() {
|
|
2005
|
+
return this.currentFrame;
|
|
2148
2006
|
}
|
|
2149
2007
|
getVideo() {
|
|
2150
2008
|
return this.videoEl;
|
|
2151
2009
|
}
|
|
2152
|
-
async generateBitmap() {
|
|
2153
|
-
if (!this.bitmapCanvas) {
|
|
2154
|
-
this.bitmapCanvas = new OffscreenCanvas(this.width, this.height);
|
|
2155
|
-
this.bitmapCanvas.width = this.width;
|
|
2156
|
-
this.bitmapCanvas.height = this.height;
|
|
2157
|
-
this.bitmapCtx = this.bitmapCanvas.getContext("2d");
|
|
2158
|
-
}
|
|
2159
|
-
this.bitmapCtx?.fillRect(0, 0, this.width, this.height);
|
|
2160
|
-
this.bitmapCtx?.drawImage(this.videoEl, 0, 0, this.width, this.height);
|
|
2161
|
-
this.bitmap = await createImageBitmap(this.bitmapCanvas);
|
|
2162
|
-
return this.bitmap;
|
|
2163
|
-
}
|
|
2164
2010
|
async play() {
|
|
2165
2011
|
if (!this.videoEl.paused)
|
|
2166
2012
|
return;
|
|
@@ -2372,8 +2218,7 @@
|
|
|
2372
2218
|
}
|
|
2373
2219
|
};
|
|
2374
2220
|
PAGTextLayer = __decorateClass$3([
|
|
2375
|
-
destroyVerify$1
|
|
2376
|
-
wasmAwaitRewind$1
|
|
2221
|
+
destroyVerify$1
|
|
2377
2222
|
], PAGTextLayer);
|
|
2378
2223
|
|
|
2379
2224
|
var __defProp$3 = Object.defineProperty;
|
|
@@ -2417,8 +2262,7 @@
|
|
|
2417
2262
|
}
|
|
2418
2263
|
};
|
|
2419
2264
|
PAGImageLayer = __decorateClass$2([
|
|
2420
|
-
destroyVerify$1
|
|
2421
|
-
wasmAwaitRewind$1
|
|
2265
|
+
destroyVerify$1
|
|
2422
2266
|
], PAGImageLayer);
|
|
2423
2267
|
|
|
2424
2268
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -2447,8 +2291,7 @@
|
|
|
2447
2291
|
}
|
|
2448
2292
|
};
|
|
2449
2293
|
PAGSolidLayer = __decorateClass$1([
|
|
2450
|
-
destroyVerify$1
|
|
2451
|
-
wasmAwaitRewind$1
|
|
2294
|
+
destroyVerify$1
|
|
2452
2295
|
], PAGSolidLayer);
|
|
2453
2296
|
|
|
2454
2297
|
const setMixin = (module) => {
|
|
@@ -2467,7 +2310,7 @@
|
|
|
2467
2310
|
module.SDKVersion = function() {
|
|
2468
2311
|
return module._SDKVersion();
|
|
2469
2312
|
};
|
|
2470
|
-
module.isIPhone = () => IPHONE
|
|
2313
|
+
module.isIPhone = () => IPHONE;
|
|
2471
2314
|
};
|
|
2472
2315
|
|
|
2473
2316
|
let TGFXModule;
|
|
@@ -2475,6 +2318,18 @@
|
|
|
2475
2318
|
TGFXModule = module;
|
|
2476
2319
|
};
|
|
2477
2320
|
|
|
2321
|
+
class BitmapImage {
|
|
2322
|
+
constructor(bitmap) {
|
|
2323
|
+
this.bitmap = bitmap;
|
|
2324
|
+
}
|
|
2325
|
+
setBitmap(bitmap) {
|
|
2326
|
+
if (this.bitmap) {
|
|
2327
|
+
this.bitmap.close();
|
|
2328
|
+
}
|
|
2329
|
+
this.bitmap = bitmap;
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2478
2333
|
const createImage = (source) => {
|
|
2479
2334
|
return new Promise((resolve) => {
|
|
2480
2335
|
const image = new Image();
|
|
@@ -2498,7 +2353,7 @@
|
|
|
2498
2353
|
return null;
|
|
2499
2354
|
}
|
|
2500
2355
|
const canvas = getCanvas2D(width, height);
|
|
2501
|
-
const ctx = canvas.getContext("2d");
|
|
2356
|
+
const ctx = canvas.getContext("2d", { willReadFrequently: true });
|
|
2502
2357
|
if (!ctx) {
|
|
2503
2358
|
return null;
|
|
2504
2359
|
}
|
|
@@ -2573,37 +2428,6 @@
|
|
|
2573
2428
|
createCanvas2D: getCanvas2D
|
|
2574
2429
|
});
|
|
2575
2430
|
|
|
2576
|
-
function wasmAwaitRewind(constructor) {
|
|
2577
|
-
const ignoreStaticFunctions = ["length", "name", "prototype", "wasmAsyncMethods"];
|
|
2578
|
-
let staticFunctions = Object.getOwnPropertyNames(constructor).filter(
|
|
2579
|
-
(name) => ignoreStaticFunctions.indexOf(name) === -1
|
|
2580
|
-
);
|
|
2581
|
-
if (constructor.wasmAsyncMethods && constructor.wasmAsyncMethods.length > 0) {
|
|
2582
|
-
staticFunctions = staticFunctions.filter((name) => constructor.wasmAsyncMethods.indexOf(name) === -1);
|
|
2583
|
-
}
|
|
2584
|
-
let functions = Object.getOwnPropertyNames(constructor.prototype).filter(
|
|
2585
|
-
(name) => name !== "constructor" && typeof constructor.prototype[name] === "function"
|
|
2586
|
-
);
|
|
2587
|
-
if (constructor.prototype.wasmAsyncMethods && constructor.prototype.wasmAsyncMethods.length > 0) {
|
|
2588
|
-
functions = functions.filter((name) => constructor.prototype.wasmAsyncMethods.indexOf(name) === -1);
|
|
2589
|
-
}
|
|
2590
|
-
const proxyFn = (target, methodName) => {
|
|
2591
|
-
const fn = target[methodName];
|
|
2592
|
-
target[methodName] = function(...args) {
|
|
2593
|
-
if (TGFXModule.Asyncify.currData !== null) {
|
|
2594
|
-
const currData = TGFXModule.Asyncify.currData;
|
|
2595
|
-
TGFXModule.Asyncify.currData = null;
|
|
2596
|
-
const ret = fn.call(this, ...args);
|
|
2597
|
-
TGFXModule.Asyncify.currData = currData;
|
|
2598
|
-
return ret;
|
|
2599
|
-
} else {
|
|
2600
|
-
return fn.call(this, ...args);
|
|
2601
|
-
}
|
|
2602
|
-
};
|
|
2603
|
-
};
|
|
2604
|
-
staticFunctions.forEach((name) => proxyFn(constructor, name));
|
|
2605
|
-
functions.forEach((name) => proxyFn(constructor.prototype, name));
|
|
2606
|
-
}
|
|
2607
2431
|
function destroyVerify(constructor) {
|
|
2608
2432
|
let functions = Object.getOwnPropertyNames(constructor.prototype).filter(
|
|
2609
2433
|
(name) => name !== "constructor" && typeof constructor.prototype[name] === "function"
|
|
@@ -2694,8 +2518,7 @@
|
|
|
2694
2518
|
}
|
|
2695
2519
|
};
|
|
2696
2520
|
Matrix = __decorateClass([
|
|
2697
|
-
destroyVerify
|
|
2698
|
-
wasmAwaitRewind
|
|
2521
|
+
destroyVerify
|
|
2699
2522
|
], Matrix);
|
|
2700
2523
|
|
|
2701
2524
|
const measureText = (imageData) => {
|
|
@@ -2765,6 +2588,26 @@
|
|
|
2765
2588
|
this.size = size;
|
|
2766
2589
|
this.loadCanvas();
|
|
2767
2590
|
}
|
|
2591
|
+
static getLineCap(cap) {
|
|
2592
|
+
switch (cap) {
|
|
2593
|
+
case TGFXModule.TGFXLineCap.Round:
|
|
2594
|
+
return "round";
|
|
2595
|
+
case TGFXModule.TGFXLineCap.Square:
|
|
2596
|
+
return "square";
|
|
2597
|
+
default:
|
|
2598
|
+
return "butt";
|
|
2599
|
+
}
|
|
2600
|
+
}
|
|
2601
|
+
static getLineJoin(join) {
|
|
2602
|
+
switch (join) {
|
|
2603
|
+
case TGFXModule.TGFXLineJoin.Round:
|
|
2604
|
+
return "round";
|
|
2605
|
+
case TGFXModule.TGFXLineJoin.Bevel:
|
|
2606
|
+
return "bevel";
|
|
2607
|
+
default:
|
|
2608
|
+
return "miter";
|
|
2609
|
+
}
|
|
2610
|
+
}
|
|
2768
2611
|
static setCanvas(canvas) {
|
|
2769
2612
|
_ScalerContext.canvas = canvas;
|
|
2770
2613
|
}
|
|
@@ -2850,12 +2693,28 @@
|
|
|
2850
2693
|
context.font = this.fontString(false, false);
|
|
2851
2694
|
return context.measureText(text).width;
|
|
2852
2695
|
}
|
|
2853
|
-
|
|
2854
|
-
const
|
|
2855
|
-
const
|
|
2856
|
-
|
|
2857
|
-
context.
|
|
2858
|
-
|
|
2696
|
+
readPixels(text, bounds, fauxBold, stroke) {
|
|
2697
|
+
const width = bounds.right - bounds.left;
|
|
2698
|
+
const height = bounds.bottom - bounds.top;
|
|
2699
|
+
const canvas = getCanvas2D(width, height);
|
|
2700
|
+
const context = canvas.getContext("2d", { willReadFrequently: true });
|
|
2701
|
+
context.clearRect(0, 0, width, height);
|
|
2702
|
+
context.font = this.fontString(fauxBold, false);
|
|
2703
|
+
if (stroke) {
|
|
2704
|
+
context.lineJoin = _ScalerContext.getLineJoin(stroke.join);
|
|
2705
|
+
context.miterLimit = stroke.miterLimit;
|
|
2706
|
+
context.lineCap = _ScalerContext.getLineCap(stroke.cap);
|
|
2707
|
+
context.lineWidth = stroke.width;
|
|
2708
|
+
context.strokeText(text, -bounds.left, -bounds.top);
|
|
2709
|
+
} else {
|
|
2710
|
+
context.fillText(text, -bounds.left, -bounds.top);
|
|
2711
|
+
}
|
|
2712
|
+
const { data } = context.getImageData(0, 0, width, height);
|
|
2713
|
+
releaseCanvas2D(canvas);
|
|
2714
|
+
if (data.length === 0) {
|
|
2715
|
+
return null;
|
|
2716
|
+
}
|
|
2717
|
+
return new Uint8Array(data);
|
|
2859
2718
|
}
|
|
2860
2719
|
loadCanvas() {
|
|
2861
2720
|
if (!_ScalerContext.canvas) {
|
|
@@ -2902,75 +2761,26 @@
|
|
|
2902
2761
|
let ScalerContext = _ScalerContext;
|
|
2903
2762
|
ScalerContext.hasMeasureBoundsAPI = void 0;
|
|
2904
2763
|
|
|
2905
|
-
class
|
|
2906
|
-
static
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
switch (cap) {
|
|
2911
|
-
case TGFXModule.TGFXLineCap.Round:
|
|
2912
|
-
return "round";
|
|
2913
|
-
case TGFXModule.TGFXLineCap.Square:
|
|
2914
|
-
return "square";
|
|
2915
|
-
default:
|
|
2916
|
-
return "butt";
|
|
2917
|
-
}
|
|
2918
|
-
}
|
|
2919
|
-
static getLineJoin(join) {
|
|
2920
|
-
switch (join) {
|
|
2921
|
-
case TGFXModule.TGFXLineJoin.Round:
|
|
2922
|
-
return "round";
|
|
2923
|
-
case TGFXModule.TGFXLineJoin.Bevel:
|
|
2924
|
-
return "bevel";
|
|
2925
|
-
default:
|
|
2926
|
-
return "miter";
|
|
2764
|
+
class PathRasterizer {
|
|
2765
|
+
static readPixels(width, height, path, fillType) {
|
|
2766
|
+
let canvas = getCanvas2D(width, height);
|
|
2767
|
+
if (canvas == null) {
|
|
2768
|
+
return null;
|
|
2927
2769
|
}
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
this.canvas = canvas;
|
|
2931
|
-
this.context = this.canvas.getContext("2d");
|
|
2932
|
-
}
|
|
2933
|
-
updateCanvas(canvas) {
|
|
2934
|
-
this.canvas = canvas;
|
|
2935
|
-
}
|
|
2936
|
-
fillPath(path, fillType) {
|
|
2937
|
-
this.context.setTransform(1, 0, 0, 1, 0, 0);
|
|
2770
|
+
let context = canvas.getContext("2d", { willReadFrequently: true });
|
|
2771
|
+
context.setTransform(1, 0, 0, 1, 0, 0);
|
|
2938
2772
|
if (fillType === TGFXModule.TGFXPathFillType.InverseWinding || fillType === TGFXModule.TGFXPathFillType.InverseEvenOdd) {
|
|
2939
|
-
|
|
2940
|
-
|
|
2773
|
+
context.clip(path, fillType === TGFXModule.TGFXPathFillType.InverseEvenOdd ? "evenodd" : "nonzero");
|
|
2774
|
+
context.fillRect(0, 0, width, height);
|
|
2941
2775
|
} else {
|
|
2942
|
-
|
|
2943
|
-
}
|
|
2944
|
-
}
|
|
2945
|
-
fillText(webFont, texts, positions, matrixWasmIns) {
|
|
2946
|
-
const scalerContext = new ScalerContext(webFont.name, webFont.style, webFont.size);
|
|
2947
|
-
const matrix = new Matrix(matrixWasmIns);
|
|
2948
|
-
this.context.setTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.tx, matrix.ty);
|
|
2949
|
-
this.context.font = scalerContext.fontString(webFont.bold, webFont.italic);
|
|
2950
|
-
for (let i = 0; i < texts.size(); i++) {
|
|
2951
|
-
const position = positions.get(i);
|
|
2952
|
-
this.context.fillText(texts.get(i), position.x, position.y);
|
|
2953
|
-
}
|
|
2954
|
-
}
|
|
2955
|
-
strokeText(webFont, stroke, texts, positions, matrixWasmIns) {
|
|
2956
|
-
if (stroke.width < 0.5) {
|
|
2957
|
-
return;
|
|
2776
|
+
context.fill(path, fillType === TGFXModule.TGFXPathFillType.EvenOdd ? "evenodd" : "nonzero");
|
|
2958
2777
|
}
|
|
2959
|
-
const
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
this.context.lineJoin = WebMask.getLineJoin(stroke.join);
|
|
2964
|
-
this.context.miterLimit = stroke.miterLimit;
|
|
2965
|
-
this.context.lineCap = WebMask.getLineCap(stroke.cap);
|
|
2966
|
-
this.context.lineWidth = stroke.width;
|
|
2967
|
-
for (let i = 0; i < texts.size(); i++) {
|
|
2968
|
-
const position = positions.get(i);
|
|
2969
|
-
this.context.strokeText(texts.get(i), position.x, position.y);
|
|
2778
|
+
const { data } = context.getImageData(0, 0, width, height);
|
|
2779
|
+
releaseCanvas2D(canvas);
|
|
2780
|
+
if (data.length === 0) {
|
|
2781
|
+
return null;
|
|
2970
2782
|
}
|
|
2971
|
-
|
|
2972
|
-
clear() {
|
|
2973
|
-
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
2783
|
+
return new Uint8Array(data);
|
|
2974
2784
|
}
|
|
2975
2785
|
}
|
|
2976
2786
|
|
|
@@ -2978,7 +2788,7 @@
|
|
|
2978
2788
|
setTGFXModule(module);
|
|
2979
2789
|
module.module = module;
|
|
2980
2790
|
module.ScalerContext = ScalerContext;
|
|
2981
|
-
module.WebMask =
|
|
2791
|
+
module.WebMask = PathRasterizer;
|
|
2982
2792
|
module.Matrix = Matrix;
|
|
2983
2793
|
module.tgfx = { ...tgfx };
|
|
2984
2794
|
};
|
|
@@ -3026,9 +2836,6 @@
|
|
|
3026
2836
|
var ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope != "undefined";
|
|
3027
2837
|
typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string" && process.type != "renderer";
|
|
3028
2838
|
var moduleOverrides = Object.assign({}, Module);
|
|
3029
|
-
var quit_ = (status, toThrow) => {
|
|
3030
|
-
throw toThrow;
|
|
3031
|
-
};
|
|
3032
2839
|
var scriptDirectory = "";
|
|
3033
2840
|
function locateFile(path) {
|
|
3034
2841
|
if (Module["locateFile"]) {
|
|
@@ -3081,7 +2888,6 @@
|
|
|
3081
2888
|
var wasmBinary = Module["wasmBinary"];
|
|
3082
2889
|
var wasmMemory;
|
|
3083
2890
|
var ABORT = false;
|
|
3084
|
-
var EXITSTATUS;
|
|
3085
2891
|
var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAP64, HEAPU64, HEAPF64;
|
|
3086
2892
|
var dataURIPrefix = "data:application/octet-stream;base64,";
|
|
3087
2893
|
var isDataURI = (filename) => filename.startsWith(dataURIPrefix);
|
|
@@ -3222,11 +3028,10 @@
|
|
|
3222
3028
|
async function createWasm() {
|
|
3223
3029
|
function receiveInstance(instance, module) {
|
|
3224
3030
|
wasmExports = instance.exports;
|
|
3225
|
-
|
|
3226
|
-
wasmMemory = wasmExports["hc"];
|
|
3031
|
+
wasmMemory = wasmExports["Cc"];
|
|
3227
3032
|
updateMemoryViews();
|
|
3228
|
-
wasmExports["
|
|
3229
|
-
addOnInit(wasmExports["
|
|
3033
|
+
wasmTable = wasmExports["Fc"];
|
|
3034
|
+
addOnInit(wasmExports["Dc"]);
|
|
3230
3035
|
removeRunDependency();
|
|
3231
3036
|
return wasmExports;
|
|
3232
3037
|
}
|
|
@@ -3253,19 +3058,12 @@
|
|
|
3253
3058
|
return Promise.reject(e);
|
|
3254
3059
|
}
|
|
3255
3060
|
}
|
|
3256
|
-
class ExitStatus {
|
|
3257
|
-
constructor(status) {
|
|
3258
|
-
__publicField(this, "name", "ExitStatus");
|
|
3259
|
-
this.message = `Program terminated with exit(${status})`;
|
|
3260
|
-
this.status = status;
|
|
3261
|
-
}
|
|
3262
|
-
}
|
|
3263
3061
|
var callRuntimeCallbacks = (callbacks) => {
|
|
3264
3062
|
while (callbacks.length > 0) {
|
|
3265
3063
|
callbacks.shift()(Module);
|
|
3266
3064
|
}
|
|
3267
3065
|
};
|
|
3268
|
-
|
|
3066
|
+
Module["noExitRuntime"] || true;
|
|
3269
3067
|
class ExceptionInfo {
|
|
3270
3068
|
constructor(excPtr) {
|
|
3271
3069
|
this.excPtr = excPtr;
|
|
@@ -3862,7 +3660,6 @@
|
|
|
3862
3660
|
var arrayBuffer = await readAsync(url);
|
|
3863
3661
|
return new Uint8Array(arrayBuffer);
|
|
3864
3662
|
};
|
|
3865
|
-
asyncLoad.isAsync = true;
|
|
3866
3663
|
var FS_createDataFile = (parent, name, fileData, canRead, canWrite, canOwn) => {
|
|
3867
3664
|
FS.createDataFile(parent, name, fileData, canRead, canWrite, canOwn);
|
|
3868
3665
|
};
|
|
@@ -6107,20 +5904,12 @@
|
|
|
6107
5904
|
Module[name].argCount = numArguments;
|
|
6108
5905
|
}
|
|
6109
5906
|
};
|
|
6110
|
-
var
|
|
6111
|
-
|
|
6112
|
-
var f = Module["dynCall_" + sig];
|
|
6113
|
-
return f(ptr, ...args);
|
|
6114
|
-
};
|
|
6115
|
-
var dynCall = (sig, ptr, args = []) => {
|
|
6116
|
-
var rtn = dynCallLegacy(sig, ptr, args);
|
|
6117
|
-
return rtn;
|
|
6118
|
-
};
|
|
6119
|
-
var getDynCaller = (sig, ptr) => (...args) => dynCall(sig, ptr, args);
|
|
5907
|
+
var wasmTable;
|
|
5908
|
+
var getWasmTableEntry = (funcPtr) => wasmTable.get(funcPtr);
|
|
6120
5909
|
var embind__requireFunction = (signature, rawFunction) => {
|
|
6121
5910
|
signature = readLatin1String(signature);
|
|
6122
5911
|
function makeDynCaller() {
|
|
6123
|
-
return
|
|
5912
|
+
return getWasmTableEntry(rawFunction);
|
|
6124
5913
|
}
|
|
6125
5914
|
var fp = makeDynCaller();
|
|
6126
5915
|
if (typeof fp != "function") {
|
|
@@ -6274,10 +6063,6 @@
|
|
|
6274
6063
|
args1.push(`argType${i2}`);
|
|
6275
6064
|
}
|
|
6276
6065
|
invokerFnBody += (returns || isAsync ? "var rv = " : "") + `invoker(${argsListWired});
|
|
6277
|
-
`;
|
|
6278
|
-
var returnVal = returns ? "rv" : "";
|
|
6279
|
-
args1.push("Asyncify");
|
|
6280
|
-
invokerFnBody += `function onDone(${returnVal}) {
|
|
6281
6066
|
`;
|
|
6282
6067
|
if (needsDestructorStack) {
|
|
6283
6068
|
invokerFnBody += "runDestructors(destructors);\n";
|
|
@@ -6294,193 +6079,9 @@
|
|
|
6294
6079
|
if (returns) {
|
|
6295
6080
|
invokerFnBody += "var ret = retType['fromWireType'](rv);\nreturn ret;\n";
|
|
6296
6081
|
}
|
|
6297
|
-
invokerFnBody += "}\n";
|
|
6298
|
-
invokerFnBody += `return Asyncify.currData ? Asyncify.whenDone().then(onDone) : onDone(${returnVal});
|
|
6299
|
-
`;
|
|
6300
6082
|
invokerFnBody += "}\n";
|
|
6301
6083
|
return [args1, invokerFnBody];
|
|
6302
6084
|
}
|
|
6303
|
-
var runAndAbortIfError = (func) => {
|
|
6304
|
-
try {
|
|
6305
|
-
return func();
|
|
6306
|
-
} catch (e) {
|
|
6307
|
-
abort(e);
|
|
6308
|
-
}
|
|
6309
|
-
};
|
|
6310
|
-
var handleException = (e) => {
|
|
6311
|
-
if (e instanceof ExitStatus || e == "unwind") {
|
|
6312
|
-
return EXITSTATUS;
|
|
6313
|
-
}
|
|
6314
|
-
quit_(1, e);
|
|
6315
|
-
};
|
|
6316
|
-
var runtimeKeepaliveCounter = 0;
|
|
6317
|
-
var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
|
|
6318
|
-
var _proc_exit = (code) => {
|
|
6319
|
-
EXITSTATUS = code;
|
|
6320
|
-
if (!keepRuntimeAlive()) {
|
|
6321
|
-
Module["onExit"]?.(code);
|
|
6322
|
-
ABORT = true;
|
|
6323
|
-
}
|
|
6324
|
-
quit_(code, new ExitStatus(code));
|
|
6325
|
-
};
|
|
6326
|
-
var exitJS = (status, implicit) => {
|
|
6327
|
-
EXITSTATUS = status;
|
|
6328
|
-
_proc_exit(status);
|
|
6329
|
-
};
|
|
6330
|
-
var _exit = exitJS;
|
|
6331
|
-
var maybeExit = () => {
|
|
6332
|
-
if (!keepRuntimeAlive()) {
|
|
6333
|
-
try {
|
|
6334
|
-
_exit(EXITSTATUS);
|
|
6335
|
-
} catch (e) {
|
|
6336
|
-
handleException(e);
|
|
6337
|
-
}
|
|
6338
|
-
}
|
|
6339
|
-
};
|
|
6340
|
-
var callUserCallback = (func) => {
|
|
6341
|
-
if (ABORT) {
|
|
6342
|
-
return;
|
|
6343
|
-
}
|
|
6344
|
-
try {
|
|
6345
|
-
func();
|
|
6346
|
-
maybeExit();
|
|
6347
|
-
} catch (e) {
|
|
6348
|
-
handleException(e);
|
|
6349
|
-
}
|
|
6350
|
-
};
|
|
6351
|
-
var Asyncify = { instrumentWasmImports(imports) {
|
|
6352
|
-
var importPattern = /^(invoke_.*|__asyncjs__.*)$/;
|
|
6353
|
-
for (let [x, original] of Object.entries(imports)) {
|
|
6354
|
-
if (typeof original == "function") {
|
|
6355
|
-
original.isAsync || importPattern.test(x);
|
|
6356
|
-
}
|
|
6357
|
-
}
|
|
6358
|
-
}, instrumentWasmExports(exports) {
|
|
6359
|
-
var ret = {};
|
|
6360
|
-
for (let [x, original] of Object.entries(exports)) {
|
|
6361
|
-
if (typeof original == "function") {
|
|
6362
|
-
ret[x] = (...args) => {
|
|
6363
|
-
Asyncify.exportCallStack.push(x);
|
|
6364
|
-
try {
|
|
6365
|
-
return original(...args);
|
|
6366
|
-
} finally {
|
|
6367
|
-
if (!ABORT) {
|
|
6368
|
-
Asyncify.exportCallStack.pop();
|
|
6369
|
-
Asyncify.maybeStopUnwind();
|
|
6370
|
-
}
|
|
6371
|
-
}
|
|
6372
|
-
};
|
|
6373
|
-
} else {
|
|
6374
|
-
ret[x] = original;
|
|
6375
|
-
}
|
|
6376
|
-
}
|
|
6377
|
-
return ret;
|
|
6378
|
-
}, State: { Normal: 0, Unwinding: 1, Rewinding: 2, Disabled: 3 }, state: 0, StackSize: 4096, currData: null, handleSleepReturnValue: 0, exportCallStack: [], callStackNameToId: {}, callStackIdToName: {}, callStackId: 0, asyncPromiseHandlers: null, sleepCallbacks: [], getCallStackId(funcName) {
|
|
6379
|
-
var id = Asyncify.callStackNameToId[funcName];
|
|
6380
|
-
if (id === void 0) {
|
|
6381
|
-
id = Asyncify.callStackId++;
|
|
6382
|
-
Asyncify.callStackNameToId[funcName] = id;
|
|
6383
|
-
Asyncify.callStackIdToName[id] = funcName;
|
|
6384
|
-
}
|
|
6385
|
-
return id;
|
|
6386
|
-
}, maybeStopUnwind() {
|
|
6387
|
-
if (Asyncify.currData && Asyncify.state === Asyncify.State.Unwinding && Asyncify.exportCallStack.length === 0) {
|
|
6388
|
-
Asyncify.state = Asyncify.State.Normal;
|
|
6389
|
-
runAndAbortIfError(_asyncify_stop_unwind);
|
|
6390
|
-
if (typeof Fibers != "undefined") {
|
|
6391
|
-
Fibers.trampoline();
|
|
6392
|
-
}
|
|
6393
|
-
}
|
|
6394
|
-
}, whenDone() {
|
|
6395
|
-
return new Promise((resolve, reject) => {
|
|
6396
|
-
Asyncify.asyncPromiseHandlers = { resolve, reject };
|
|
6397
|
-
});
|
|
6398
|
-
}, allocateData() {
|
|
6399
|
-
var ptr = _malloc(12 + Asyncify.StackSize);
|
|
6400
|
-
Asyncify.setDataHeader(ptr, ptr + 12, Asyncify.StackSize);
|
|
6401
|
-
Asyncify.setDataRewindFunc(ptr);
|
|
6402
|
-
return ptr;
|
|
6403
|
-
}, setDataHeader(ptr, stack, stackSize) {
|
|
6404
|
-
HEAPU32[ptr >> 2] = stack;
|
|
6405
|
-
HEAPU32[ptr + 4 >> 2] = stack + stackSize;
|
|
6406
|
-
}, setDataRewindFunc(ptr) {
|
|
6407
|
-
var bottomOfCallStack = Asyncify.exportCallStack[0];
|
|
6408
|
-
var rewindId = Asyncify.getCallStackId(bottomOfCallStack);
|
|
6409
|
-
HEAP32[ptr + 8 >> 2] = rewindId;
|
|
6410
|
-
}, getDataRewindFuncName(ptr) {
|
|
6411
|
-
var id = HEAP32[ptr + 8 >> 2];
|
|
6412
|
-
var name = Asyncify.callStackIdToName[id];
|
|
6413
|
-
return name;
|
|
6414
|
-
}, getDataRewindFunc(name) {
|
|
6415
|
-
var func = wasmExports[name];
|
|
6416
|
-
return func;
|
|
6417
|
-
}, doRewind(ptr) {
|
|
6418
|
-
var name = Asyncify.getDataRewindFuncName(ptr);
|
|
6419
|
-
var func = Asyncify.getDataRewindFunc(name);
|
|
6420
|
-
return func();
|
|
6421
|
-
}, handleSleep(startAsync) {
|
|
6422
|
-
if (ABORT)
|
|
6423
|
-
return;
|
|
6424
|
-
if (Asyncify.state === Asyncify.State.Normal) {
|
|
6425
|
-
var reachedCallback = false;
|
|
6426
|
-
var reachedAfterCallback = false;
|
|
6427
|
-
startAsync((handleSleepReturnValue = 0) => {
|
|
6428
|
-
if (ABORT)
|
|
6429
|
-
return;
|
|
6430
|
-
Asyncify.handleSleepReturnValue = handleSleepReturnValue;
|
|
6431
|
-
reachedCallback = true;
|
|
6432
|
-
if (!reachedAfterCallback) {
|
|
6433
|
-
return;
|
|
6434
|
-
}
|
|
6435
|
-
Asyncify.state = Asyncify.State.Rewinding;
|
|
6436
|
-
runAndAbortIfError(() => _asyncify_start_rewind(Asyncify.currData));
|
|
6437
|
-
if (typeof MainLoop != "undefined" && MainLoop.func) {
|
|
6438
|
-
MainLoop.resume();
|
|
6439
|
-
}
|
|
6440
|
-
var asyncWasmReturnValue, isError = false;
|
|
6441
|
-
try {
|
|
6442
|
-
asyncWasmReturnValue = Asyncify.doRewind(Asyncify.currData);
|
|
6443
|
-
} catch (err2) {
|
|
6444
|
-
asyncWasmReturnValue = err2;
|
|
6445
|
-
isError = true;
|
|
6446
|
-
}
|
|
6447
|
-
var handled = false;
|
|
6448
|
-
if (!Asyncify.currData) {
|
|
6449
|
-
var asyncPromiseHandlers = Asyncify.asyncPromiseHandlers;
|
|
6450
|
-
if (asyncPromiseHandlers) {
|
|
6451
|
-
Asyncify.asyncPromiseHandlers = null;
|
|
6452
|
-
(isError ? asyncPromiseHandlers.reject : asyncPromiseHandlers.resolve)(asyncWasmReturnValue);
|
|
6453
|
-
handled = true;
|
|
6454
|
-
}
|
|
6455
|
-
}
|
|
6456
|
-
if (isError && !handled) {
|
|
6457
|
-
throw asyncWasmReturnValue;
|
|
6458
|
-
}
|
|
6459
|
-
});
|
|
6460
|
-
reachedAfterCallback = true;
|
|
6461
|
-
if (!reachedCallback) {
|
|
6462
|
-
Asyncify.state = Asyncify.State.Unwinding;
|
|
6463
|
-
Asyncify.currData = Asyncify.allocateData();
|
|
6464
|
-
if (typeof MainLoop != "undefined" && MainLoop.func) {
|
|
6465
|
-
MainLoop.pause();
|
|
6466
|
-
}
|
|
6467
|
-
runAndAbortIfError(() => _asyncify_start_unwind(Asyncify.currData));
|
|
6468
|
-
}
|
|
6469
|
-
} else if (Asyncify.state === Asyncify.State.Rewinding) {
|
|
6470
|
-
Asyncify.state = Asyncify.State.Normal;
|
|
6471
|
-
runAndAbortIfError(_asyncify_stop_rewind);
|
|
6472
|
-
_free(Asyncify.currData);
|
|
6473
|
-
Asyncify.currData = null;
|
|
6474
|
-
Asyncify.sleepCallbacks.forEach(callUserCallback);
|
|
6475
|
-
} else {
|
|
6476
|
-
abort(`invalid state: ${Asyncify.state}`);
|
|
6477
|
-
}
|
|
6478
|
-
return Asyncify.handleSleepReturnValue;
|
|
6479
|
-
}, handleAsync(startAsync) {
|
|
6480
|
-
return Asyncify.handleSleep((wakeUp) => {
|
|
6481
|
-
startAsync().then(wakeUp);
|
|
6482
|
-
});
|
|
6483
|
-
} };
|
|
6484
6085
|
function craftInvokerFunction(humanName, argTypes, classType, cppInvokerFunc, cppTargetFunc, isAsync) {
|
|
6485
6086
|
var argCount = argTypes.length;
|
|
6486
6087
|
if (argCount < 2) {
|
|
@@ -6493,7 +6094,6 @@
|
|
|
6493
6094
|
for (var i2 = 0; i2 < argCount - 2; ++i2) {
|
|
6494
6095
|
closureArgs.push(argTypes[i2 + 2]);
|
|
6495
6096
|
}
|
|
6496
|
-
closureArgs.push(Asyncify);
|
|
6497
6097
|
if (!needsDestructorStack) {
|
|
6498
6098
|
for (var i2 = isClassMethodFunc ? 1 : 2; i2 < argTypes.length; ++i2) {
|
|
6499
6099
|
if (argTypes[i2].destructorFunction !== null) {
|
|
@@ -7075,11 +6675,6 @@
|
|
|
7075
6675
|
returnType = requireRegisteredType(returnType, "emval::as");
|
|
7076
6676
|
return emval_returnValue(returnType, destructorsRef, handle);
|
|
7077
6677
|
};
|
|
7078
|
-
var __emval_await = (promise) => Asyncify.handleAsync(async () => {
|
|
7079
|
-
var value = await Emval.toValue(promise);
|
|
7080
|
-
return Emval.toHandle(value);
|
|
7081
|
-
});
|
|
7082
|
-
__emval_await.isAsync = true;
|
|
7083
6678
|
var emval_methodCallers = [];
|
|
7084
6679
|
var __emval_call = (caller, handle, destructorsRef, args) => {
|
|
7085
6680
|
caller = emval_methodCallers[caller];
|
|
@@ -7476,6 +7071,10 @@
|
|
|
7476
7071
|
GLctx.bindBuffer(target, GL.buffers[buffer]);
|
|
7477
7072
|
};
|
|
7478
7073
|
var _emscripten_glBindBuffer = _glBindBuffer;
|
|
7074
|
+
var _glBindBufferBase = (target, index, buffer) => {
|
|
7075
|
+
GLctx.bindBufferBase(target, index, GL.buffers[buffer]);
|
|
7076
|
+
};
|
|
7077
|
+
var _emscripten_glBindBufferBase = _glBindBufferBase;
|
|
7479
7078
|
var _glBindFramebuffer = (target, framebuffer) => {
|
|
7480
7079
|
GLctx.bindFramebuffer(target, GL.framebuffers[framebuffer]);
|
|
7481
7080
|
};
|
|
@@ -7502,6 +7101,8 @@
|
|
|
7502
7101
|
var _emscripten_glBlendEquationSeparate = _glBlendEquationSeparate;
|
|
7503
7102
|
var _glBlendFunc = (x0, x1) => GLctx.blendFunc(x0, x1);
|
|
7504
7103
|
var _emscripten_glBlendFunc = _glBlendFunc;
|
|
7104
|
+
var _glBlendFuncSeparate = (x0, x1, x2, x3) => GLctx.blendFuncSeparate(x0, x1, x2, x3);
|
|
7105
|
+
var _emscripten_glBlendFuncSeparate = _glBlendFuncSeparate;
|
|
7505
7106
|
var _glBlitFramebuffer = (x0, x1, x2, x3, x4, x5, x6, x7, x8, x9) => GLctx.blitFramebuffer(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9);
|
|
7506
7107
|
var _emscripten_glBlitFramebuffer = _glBlitFramebuffer;
|
|
7507
7108
|
var _glBufferData = (target, size, data, usage) => {
|
|
@@ -7516,12 +7117,22 @@
|
|
|
7516
7117
|
GLctx.bufferData(target, data ? HEAPU8.subarray(data, data + size) : size, usage);
|
|
7517
7118
|
};
|
|
7518
7119
|
var _emscripten_glBufferData = _glBufferData;
|
|
7120
|
+
var _glBufferSubData = (target, offset, size, data) => {
|
|
7121
|
+
if (GL.currentContext.version >= 2) {
|
|
7122
|
+
size && GLctx.bufferSubData(target, offset, HEAPU8, data, size);
|
|
7123
|
+
return;
|
|
7124
|
+
}
|
|
7125
|
+
GLctx.bufferSubData(target, offset, HEAPU8.subarray(data, data + size));
|
|
7126
|
+
};
|
|
7127
|
+
var _emscripten_glBufferSubData = _glBufferSubData;
|
|
7519
7128
|
var _glCheckFramebufferStatus = (x0) => GLctx.checkFramebufferStatus(x0);
|
|
7520
7129
|
var _emscripten_glCheckFramebufferStatus = _glCheckFramebufferStatus;
|
|
7521
7130
|
var _glClear = (x0) => GLctx.clear(x0);
|
|
7522
7131
|
var _emscripten_glClear = _glClear;
|
|
7523
7132
|
var _glClearColor = (x0, x1, x2, x3) => GLctx.clearColor(x0, x1, x2, x3);
|
|
7524
7133
|
var _emscripten_glClearColor = _glClearColor;
|
|
7134
|
+
var _glClearDepthf = (x0) => GLctx.clearDepth(x0);
|
|
7135
|
+
var _emscripten_glClearDepthf = _glClearDepthf;
|
|
7525
7136
|
var _glClearStencil = (x0) => GLctx.clearStencil(x0);
|
|
7526
7137
|
var _emscripten_glClearStencil = _glClearStencil;
|
|
7527
7138
|
var _glColorMask = (red, green, blue, alpha) => {
|
|
@@ -7532,6 +7143,30 @@
|
|
|
7532
7143
|
GLctx.compileShader(GL.shaders[shader]);
|
|
7533
7144
|
};
|
|
7534
7145
|
var _emscripten_glCompileShader = _glCompileShader;
|
|
7146
|
+
var _glCompressedTexImage2D = (target, level, internalFormat, width, height, border, imageSize, data) => {
|
|
7147
|
+
if (GL.currentContext.version >= 2) {
|
|
7148
|
+
if (GLctx.currentPixelUnpackBufferBinding || !imageSize) {
|
|
7149
|
+
GLctx.compressedTexImage2D(target, level, internalFormat, width, height, border, imageSize, data);
|
|
7150
|
+
return;
|
|
7151
|
+
}
|
|
7152
|
+
GLctx.compressedTexImage2D(target, level, internalFormat, width, height, border, HEAPU8, data, imageSize);
|
|
7153
|
+
return;
|
|
7154
|
+
}
|
|
7155
|
+
GLctx.compressedTexImage2D(target, level, internalFormat, width, height, border, HEAPU8.subarray(data, data + imageSize));
|
|
7156
|
+
};
|
|
7157
|
+
var _emscripten_glCompressedTexImage2D = _glCompressedTexImage2D;
|
|
7158
|
+
var _glCompressedTexSubImage2D = (target, level, xoffset, yoffset, width, height, format, imageSize, data) => {
|
|
7159
|
+
if (GL.currentContext.version >= 2) {
|
|
7160
|
+
if (GLctx.currentPixelUnpackBufferBinding || !imageSize) {
|
|
7161
|
+
GLctx.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
|
|
7162
|
+
return;
|
|
7163
|
+
}
|
|
7164
|
+
GLctx.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, HEAPU8, data, imageSize);
|
|
7165
|
+
return;
|
|
7166
|
+
}
|
|
7167
|
+
GLctx.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, HEAPU8.subarray(data, data + imageSize));
|
|
7168
|
+
};
|
|
7169
|
+
var _emscripten_glCompressedTexSubImage2D = _glCompressedTexSubImage2D;
|
|
7535
7170
|
var _glCopyTexSubImage2D = (x0, x1, x2, x3, x4, x5, x6, x7) => GLctx.copyTexSubImage2D(x0, x1, x2, x3, x4, x5, x6, x7);
|
|
7536
7171
|
var _emscripten_glCopyTexSubImage2D = _glCopyTexSubImage2D;
|
|
7537
7172
|
var _glCreateProgram = () => {
|
|
@@ -7550,6 +7185,8 @@
|
|
|
7550
7185
|
return id;
|
|
7551
7186
|
};
|
|
7552
7187
|
var _emscripten_glCreateShader = _glCreateShader;
|
|
7188
|
+
var _glCullFace = (x0) => GLctx.cullFace(x0);
|
|
7189
|
+
var _emscripten_glCullFace = _glCullFace;
|
|
7553
7190
|
var _glDeleteBuffers = (n, buffers) => {
|
|
7554
7191
|
for (var i2 = 0; i2 < n; i2++) {
|
|
7555
7192
|
var id = HEAP32[buffers + i2 * 4 >> 2];
|
|
@@ -7650,6 +7287,8 @@
|
|
|
7650
7287
|
var _emscripten_glDeleteVertexArrays = _glDeleteVertexArrays;
|
|
7651
7288
|
var _glDeleteVertexArraysOES = _glDeleteVertexArrays;
|
|
7652
7289
|
var _emscripten_glDeleteVertexArraysOES = _glDeleteVertexArraysOES;
|
|
7290
|
+
var _glDepthFunc = (x0) => GLctx.depthFunc(x0);
|
|
7291
|
+
var _emscripten_glDepthFunc = _glDepthFunc;
|
|
7653
7292
|
var _glDepthMask = (flag) => {
|
|
7654
7293
|
GLctx.depthMask(!!flag);
|
|
7655
7294
|
};
|
|
@@ -7697,6 +7336,8 @@
|
|
|
7697
7336
|
GLctx.framebufferTexture2D(target, attachment, textarget, GL.textures[texture], level);
|
|
7698
7337
|
};
|
|
7699
7338
|
var _emscripten_glFramebufferTexture2D = _glFramebufferTexture2D;
|
|
7339
|
+
var _glFrontFace = (x0) => GLctx.frontFace(x0);
|
|
7340
|
+
var _emscripten_glFrontFace = _glFrontFace;
|
|
7700
7341
|
var _glGenBuffers = (n, buffers) => {
|
|
7701
7342
|
GL.genObject(n, buffers, "createBuffer", GL.buffers);
|
|
7702
7343
|
};
|
|
@@ -7719,30 +7360,10 @@
|
|
|
7719
7360
|
var _emscripten_glGenVertexArrays = _glGenVertexArrays;
|
|
7720
7361
|
var _glGenVertexArraysOES = _glGenVertexArrays;
|
|
7721
7362
|
var _emscripten_glGenVertexArraysOES = _glGenVertexArraysOES;
|
|
7363
|
+
var _glGenerateMipmap = (x0) => GLctx.generateMipmap(x0);
|
|
7364
|
+
var _emscripten_glGenerateMipmap = _glGenerateMipmap;
|
|
7722
7365
|
var _glGetAttribLocation = (program, name) => GLctx.getAttribLocation(GL.programs[program], UTF8ToString(name));
|
|
7723
7366
|
var _emscripten_glGetAttribLocation = _glGetAttribLocation;
|
|
7724
|
-
var _glGetBufferParameteriv = (target, value, data) => {
|
|
7725
|
-
if (!data) {
|
|
7726
|
-
GL.recordError(1281);
|
|
7727
|
-
return;
|
|
7728
|
-
}
|
|
7729
|
-
HEAP32[data >> 2] = GLctx.getBufferParameter(target, value);
|
|
7730
|
-
};
|
|
7731
|
-
var _emscripten_glGetBufferParameteriv = _glGetBufferParameteriv;
|
|
7732
|
-
var _glGetError = () => {
|
|
7733
|
-
var error = GLctx.getError() || GL.lastError;
|
|
7734
|
-
GL.lastError = 0;
|
|
7735
|
-
return error;
|
|
7736
|
-
};
|
|
7737
|
-
var _emscripten_glGetError = _glGetError;
|
|
7738
|
-
var _glGetFramebufferAttachmentParameteriv = (target, attachment, pname, params) => {
|
|
7739
|
-
var result = GLctx.getFramebufferAttachmentParameter(target, attachment, pname);
|
|
7740
|
-
if (result instanceof WebGLRenderbuffer || result instanceof WebGLTexture) {
|
|
7741
|
-
result = result.name | 0;
|
|
7742
|
-
}
|
|
7743
|
-
HEAP32[params >> 2] = result;
|
|
7744
|
-
};
|
|
7745
|
-
var _emscripten_glGetFramebufferAttachmentParameteriv = _glGetFramebufferAttachmentParameteriv;
|
|
7746
7367
|
var writeI53ToI64 = (ptr, num) => {
|
|
7747
7368
|
HEAPU32[ptr >> 2] = num;
|
|
7748
7369
|
var lower = HEAPU32[ptr >> 2];
|
|
@@ -7880,8 +7501,49 @@
|
|
|
7880
7501
|
break;
|
|
7881
7502
|
}
|
|
7882
7503
|
};
|
|
7504
|
+
var _glGetBooleanv = (name_, p) => emscriptenWebGLGet(name_, p, 4);
|
|
7505
|
+
var _emscripten_glGetBooleanv = _glGetBooleanv;
|
|
7506
|
+
var _glGetBufferParameteriv = (target, value, data) => {
|
|
7507
|
+
if (!data) {
|
|
7508
|
+
GL.recordError(1281);
|
|
7509
|
+
return;
|
|
7510
|
+
}
|
|
7511
|
+
HEAP32[data >> 2] = GLctx.getBufferParameter(target, value);
|
|
7512
|
+
};
|
|
7513
|
+
var _emscripten_glGetBufferParameteriv = _glGetBufferParameteriv;
|
|
7514
|
+
var _glGetError = () => {
|
|
7515
|
+
var error = GLctx.getError() || GL.lastError;
|
|
7516
|
+
GL.lastError = 0;
|
|
7517
|
+
return error;
|
|
7518
|
+
};
|
|
7519
|
+
var _emscripten_glGetError = _glGetError;
|
|
7520
|
+
var _glGetFramebufferAttachmentParameteriv = (target, attachment, pname, params) => {
|
|
7521
|
+
var result = GLctx.getFramebufferAttachmentParameter(target, attachment, pname);
|
|
7522
|
+
if (result instanceof WebGLRenderbuffer || result instanceof WebGLTexture) {
|
|
7523
|
+
result = result.name | 0;
|
|
7524
|
+
}
|
|
7525
|
+
HEAP32[params >> 2] = result;
|
|
7526
|
+
};
|
|
7527
|
+
var _emscripten_glGetFramebufferAttachmentParameteriv = _glGetFramebufferAttachmentParameteriv;
|
|
7883
7528
|
var _glGetIntegerv = (name_, p) => emscriptenWebGLGet(name_, p, 0);
|
|
7884
7529
|
var _emscripten_glGetIntegerv = _glGetIntegerv;
|
|
7530
|
+
var _glGetInternalformativ = (target, internalformat, pname, bufSize, params) => {
|
|
7531
|
+
if (bufSize < 0) {
|
|
7532
|
+
GL.recordError(1281);
|
|
7533
|
+
return;
|
|
7534
|
+
}
|
|
7535
|
+
if (!params) {
|
|
7536
|
+
GL.recordError(1281);
|
|
7537
|
+
return;
|
|
7538
|
+
}
|
|
7539
|
+
var ret = GLctx.getInternalformatParameter(target, internalformat, pname);
|
|
7540
|
+
if (ret === null)
|
|
7541
|
+
return;
|
|
7542
|
+
for (var i2 = 0; i2 < ret.length && i2 < bufSize; ++i2) {
|
|
7543
|
+
HEAP32[params + i2 * 4 >> 2] = ret[i2];
|
|
7544
|
+
}
|
|
7545
|
+
};
|
|
7546
|
+
var _emscripten_glGetInternalformativ = _glGetInternalformativ;
|
|
7885
7547
|
var _glGetProgramInfoLog = (program, maxLength, length, infoLog) => {
|
|
7886
7548
|
var log = GLctx.getProgramInfoLog(GL.programs[program]);
|
|
7887
7549
|
if (log === null)
|
|
@@ -8057,6 +7719,8 @@
|
|
|
8057
7719
|
}
|
|
8058
7720
|
};
|
|
8059
7721
|
var _emscripten_glGetStringi = _glGetStringi;
|
|
7722
|
+
var _glGetUniformBlockIndex = (program, uniformBlockName) => GLctx.getUniformBlockIndex(GL.programs[program], UTF8ToString(uniformBlockName));
|
|
7723
|
+
var _emscripten_glGetUniformBlockIndex = _glGetUniformBlockIndex;
|
|
8060
7724
|
var jstoi_q = (str) => parseInt(str);
|
|
8061
7725
|
var webglGetLeftBracePos = (name) => name.slice(-1) == "]" && name.lastIndexOf("[");
|
|
8062
7726
|
var webglPrepareUniformLocationsBeforeFirstUse = (program) => {
|
|
@@ -8106,6 +7770,54 @@
|
|
|
8106
7770
|
return -1;
|
|
8107
7771
|
};
|
|
8108
7772
|
var _emscripten_glGetUniformLocation = _glGetUniformLocation;
|
|
7773
|
+
var _glGetVertexAttribPointerv = (index, pname, pointer) => {
|
|
7774
|
+
if (!pointer) {
|
|
7775
|
+
GL.recordError(1281);
|
|
7776
|
+
return;
|
|
7777
|
+
}
|
|
7778
|
+
HEAP32[pointer >> 2] = GLctx.getVertexAttribOffset(index, pname);
|
|
7779
|
+
};
|
|
7780
|
+
var _emscripten_glGetVertexAttribPointerv = _glGetVertexAttribPointerv;
|
|
7781
|
+
var emscriptenWebGLGetVertexAttrib = (index, pname, params, type) => {
|
|
7782
|
+
if (!params) {
|
|
7783
|
+
GL.recordError(1281);
|
|
7784
|
+
return;
|
|
7785
|
+
}
|
|
7786
|
+
var data = GLctx.getVertexAttrib(index, pname);
|
|
7787
|
+
if (pname == 34975) {
|
|
7788
|
+
HEAP32[params >> 2] = data && data["name"];
|
|
7789
|
+
} else if (typeof data == "number" || typeof data == "boolean") {
|
|
7790
|
+
switch (type) {
|
|
7791
|
+
case 0:
|
|
7792
|
+
HEAP32[params >> 2] = data;
|
|
7793
|
+
break;
|
|
7794
|
+
case 2:
|
|
7795
|
+
HEAPF32[params >> 2] = data;
|
|
7796
|
+
break;
|
|
7797
|
+
case 5:
|
|
7798
|
+
HEAP32[params >> 2] = Math.fround(data);
|
|
7799
|
+
break;
|
|
7800
|
+
}
|
|
7801
|
+
} else {
|
|
7802
|
+
for (var i2 = 0; i2 < data.length; i2++) {
|
|
7803
|
+
switch (type) {
|
|
7804
|
+
case 0:
|
|
7805
|
+
HEAP32[params + i2 * 4 >> 2] = data[i2];
|
|
7806
|
+
break;
|
|
7807
|
+
case 2:
|
|
7808
|
+
HEAPF32[params + i2 * 4 >> 2] = data[i2];
|
|
7809
|
+
break;
|
|
7810
|
+
case 5:
|
|
7811
|
+
HEAP32[params + i2 * 4 >> 2] = Math.fround(data[i2]);
|
|
7812
|
+
break;
|
|
7813
|
+
}
|
|
7814
|
+
}
|
|
7815
|
+
}
|
|
7816
|
+
};
|
|
7817
|
+
var _glGetVertexAttribiv = (index, pname, params) => {
|
|
7818
|
+
emscriptenWebGLGetVertexAttrib(index, pname, params, 5);
|
|
7819
|
+
};
|
|
7820
|
+
var _emscripten_glGetVertexAttribiv = _glGetVertexAttribiv;
|
|
8109
7821
|
var _glIsEnabled = (x0) => GLctx.isEnabled(x0);
|
|
8110
7822
|
var _emscripten_glIsEnabled = _glIsEnabled;
|
|
8111
7823
|
var _glIsTexture = (id) => {
|
|
@@ -8198,6 +7910,18 @@
|
|
|
8198
7910
|
GLctx.shaderSource(GL.shaders[shader], source);
|
|
8199
7911
|
};
|
|
8200
7912
|
var _emscripten_glShaderSource = _glShaderSource;
|
|
7913
|
+
var _glStencilFunc = (x0, x1, x2) => GLctx.stencilFunc(x0, x1, x2);
|
|
7914
|
+
var _emscripten_glStencilFunc = _glStencilFunc;
|
|
7915
|
+
var _glStencilFuncSeparate = (x0, x1, x2, x3) => GLctx.stencilFuncSeparate(x0, x1, x2, x3);
|
|
7916
|
+
var _emscripten_glStencilFuncSeparate = _glStencilFuncSeparate;
|
|
7917
|
+
var _glStencilMask = (x0) => GLctx.stencilMask(x0);
|
|
7918
|
+
var _emscripten_glStencilMask = _glStencilMask;
|
|
7919
|
+
var _glStencilMaskSeparate = (x0, x1) => GLctx.stencilMaskSeparate(x0, x1);
|
|
7920
|
+
var _emscripten_glStencilMaskSeparate = _glStencilMaskSeparate;
|
|
7921
|
+
var _glStencilOp = (x0, x1, x2) => GLctx.stencilOp(x0, x1, x2);
|
|
7922
|
+
var _emscripten_glStencilOp = _glStencilOp;
|
|
7923
|
+
var _glStencilOpSeparate = (x0, x1, x2, x3) => GLctx.stencilOpSeparate(x0, x1, x2, x3);
|
|
7924
|
+
var _emscripten_glStencilOpSeparate = _glStencilOpSeparate;
|
|
8201
7925
|
var _glTexImage2D = (target, level, internalFormat, width, height, border, format, type, pixels) => {
|
|
8202
7926
|
if (GL.currentContext.version >= 2) {
|
|
8203
7927
|
if (GLctx.currentPixelUnpackBufferBinding) {
|
|
@@ -8440,6 +8164,11 @@
|
|
|
8440
8164
|
GLctx.uniform4iv(webglGetUniformLocation(location), view);
|
|
8441
8165
|
};
|
|
8442
8166
|
var _emscripten_glUniform4iv = _glUniform4iv;
|
|
8167
|
+
var _glUniformBlockBinding = (program, uniformBlockIndex, uniformBlockBinding) => {
|
|
8168
|
+
program = GL.programs[program];
|
|
8169
|
+
GLctx.uniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
|
|
8170
|
+
};
|
|
8171
|
+
var _emscripten_glUniformBlockBinding = _glUniformBlockBinding;
|
|
8443
8172
|
var _glUniformMatrix2fv = (location, count, transpose, value) => {
|
|
8444
8173
|
if (GL.currentContext.version >= 2) {
|
|
8445
8174
|
count && GLctx.uniformMatrix2fv(webglGetUniformLocation(location), !!transpose, HEAPF32, value >> 2, count * 4);
|
|
@@ -8725,92 +8454,13 @@
|
|
|
8725
8454
|
for (var i = 0; i <= 288; ++i) {
|
|
8726
8455
|
miniTempWebGLIntBuffers[i] = miniTempWebGLIntBuffersStorage.subarray(0, i);
|
|
8727
8456
|
}
|
|
8728
|
-
var wasmImports = {
|
|
8457
|
+
var wasmImports = { z: ___cxa_throw, N: ___syscall_fcntl64, hb: ___syscall_getdents64, ob: ___syscall_ioctl, fb: ___syscall_mkdirat, O: ___syscall_openat, kb: ___syscall_rmdir, gb: ___syscall_stat64, lb: ___syscall_unlinkat, pb: __abort_js, w: __embind_finalize_value_object, L: __embind_register_bigint, db: __embind_register_bool, i: __embind_register_class, h: __embind_register_class_class_function, y: __embind_register_class_constructor, a: __embind_register_class_function, f: __embind_register_class_property, bb: __embind_register_emval, E: __embind_register_enum, r: __embind_register_enum_value, K: __embind_register_float, J: __embind_register_function, s: __embind_register_integer, j: __embind_register_memory_view, A: __embind_register_optional, p: __embind_register_smart_ptr, cb: __embind_register_std_string, G: __embind_register_std_wstring, v: __embind_register_value_object, n: __embind_register_value_object_field, eb: __embind_register_void, k: __emval_as, q: __emval_call, e: __emval_call_method, b: __emval_decref, I: __emval_equals, B: __emval_get_global, c: __emval_get_method_caller, m: __emval_get_module_property, t: __emval_get_property, g: __emval_incref, _a: __emval_instanceof, ab: __emval_new_array, u: __emval_new_cstring, $a: __emval_new_object, d: __emval_run_destructors, F: __emval_set_property, l: __emval_take_value, ib: _clock_time_get, P: _emscripten_get_canvas_element_size, Za: _emscripten_glActiveTexture, Ya: _emscripten_glAttachShader, Wa: _emscripten_glBindAttribLocation, Va: _emscripten_glBindBuffer, uc: _emscripten_glBindBufferBase, Ua: _emscripten_glBindFramebuffer, Ta: _emscripten_glBindRenderbuffer, Sa: _emscripten_glBindTexture, zb: _emscripten_glBindVertexArray, xb: _emscripten_glBindVertexArrayOES, Ra: _emscripten_glBlendColor, Qa: _emscripten_glBlendEquation, Ab: _emscripten_glBlendEquationSeparate, Pa: _emscripten_glBlendFunc, Oa: _emscripten_glBlendFuncSeparate, sb: _emscripten_glBlitFramebuffer, Na: _emscripten_glBufferData, Ma: _emscripten_glBufferSubData, La: _emscripten_glCheckFramebufferStatus, Ka: _emscripten_glClear, Ja: _emscripten_glClearColor, Ia: _emscripten_glClearDepthf, Ha: _emscripten_glClearStencil, Ga: _emscripten_glColorMask, Fa: _emscripten_glCompileShader, Ea: _emscripten_glCompressedTexImage2D, Da: _emscripten_glCompressedTexSubImage2D, Ca: _emscripten_glCopyTexSubImage2D, Ba: _emscripten_glCreateProgram, Aa: _emscripten_glCreateShader, za: _emscripten_glCullFace, ya: _emscripten_glDeleteBuffers, xa: _emscripten_glDeleteFramebuffers, wa: _emscripten_glDeleteProgram, va: _emscripten_glDeleteRenderbuffers, ua: _emscripten_glDeleteShader, tb: _emscripten_glDeleteSync, ta: _emscripten_glDeleteTextures, sa: _emscripten_glDeleteVertexArrays, wb: _emscripten_glDeleteVertexArraysOES, ra: _emscripten_glDepthFunc, qa: _emscripten_glDepthMask, pa: _emscripten_glDisable, oa: _emscripten_glDisableVertexAttribArray, na: _emscripten_glDrawArrays, ma: _emscripten_glDrawElements, la: _emscripten_glEnable, ka: _emscripten_glEnableVertexAttribArray, ub: _emscripten_glFenceSync, ja: _emscripten_glFinish, ia: _emscripten_glFlush, ha: _emscripten_glFramebufferRenderbuffer, ga: _emscripten_glFramebufferTexture2D, fa: _emscripten_glFrontFace, ea: _emscripten_glGenBuffers, da: _emscripten_glGenFramebuffers, ba: _emscripten_glGenRenderbuffers, aa: _emscripten_glGenTextures, yb: _emscripten_glGenVertexArrays, vb: _emscripten_glGenVertexArraysOES, ca: _emscripten_glGenerateMipmap, Bb: _emscripten_glGetAttribLocation, W: _emscripten_glGetBooleanv, $: _emscripten_glGetBufferParameteriv, _: _emscripten_glGetError, Z: _emscripten_glGetFramebufferAttachmentParameteriv, Y: _emscripten_glGetIntegerv, X: _emscripten_glGetInternalformativ, V: _emscripten_glGetProgramInfoLog, U: _emscripten_glGetProgramiv, T: _emscripten_glGetRenderbufferParameteriv, S: _emscripten_glGetShaderInfoLog, R: _emscripten_glGetShaderPrecisionFormat, Q: _emscripten_glGetShaderiv, Bc: _emscripten_glGetString, Ac: _emscripten_glGetStringi, wc: _emscripten_glGetUniformBlockIndex, xc: _emscripten_glGetUniformLocation, yc: _emscripten_glGetVertexAttribPointerv, zc: _emscripten_glGetVertexAttribiv, Xa: _emscripten_glIsEnabled, tc: _emscripten_glIsTexture, sc: _emscripten_glLineWidth, rc: _emscripten_glLinkProgram, qc: _emscripten_glPixelStorei, pc: _emscripten_glReadPixels, oc: _emscripten_glRenderbufferStorage, rb: _emscripten_glRenderbufferStorageMultisample, nc: _emscripten_glScissor, mc: _emscripten_glShaderSource, lc: _emscripten_glStencilFunc, kc: _emscripten_glStencilFuncSeparate, jc: _emscripten_glStencilMask, ic: _emscripten_glStencilMaskSeparate, hc: _emscripten_glStencilOp, gc: _emscripten_glStencilOpSeparate, fc: _emscripten_glTexImage2D, ec: _emscripten_glTexParameterf, dc: _emscripten_glTexParameterfv, cc: _emscripten_glTexParameteri, bc: _emscripten_glTexParameteriv, ac: _emscripten_glTexSubImage2D, $b: _emscripten_glUniform1f, _b: _emscripten_glUniform1fv, Zb: _emscripten_glUniform1i, Yb: _emscripten_glUniform1iv, Xb: _emscripten_glUniform2f, Wb: _emscripten_glUniform2fv, Vb: _emscripten_glUniform2i, Ub: _emscripten_glUniform2iv, Tb: _emscripten_glUniform3f, Sb: _emscripten_glUniform3fv, Rb: _emscripten_glUniform3i, Qb: _emscripten_glUniform3iv, Pb: _emscripten_glUniform4f, Ob: _emscripten_glUniform4fv, Nb: _emscripten_glUniform4i, Mb: _emscripten_glUniform4iv, vc: _emscripten_glUniformBlockBinding, Lb: _emscripten_glUniformMatrix2fv, Kb: _emscripten_glUniformMatrix3fv, Jb: _emscripten_glUniformMatrix4fv, Ib: _emscripten_glUseProgram, Hb: _emscripten_glVertexAttrib1f, Gb: _emscripten_glVertexAttrib2fv, Fb: _emscripten_glVertexAttrib3fv, Eb: _emscripten_glVertexAttrib4fv, Db: _emscripten_glVertexAttribPointer, Cb: _emscripten_glViewport, qb: _emscripten_glWaitSync, jb: _emscripten_resize_heap, H: _emscripten_webgl_create_context, D: _emscripten_webgl_destroy_context, x: _emscripten_webgl_get_current_context, o: _emscripten_webgl_make_context_current, C: _fd_close, nb: _fd_read, mb: _fd_seek, M: _fd_write };
|
|
8729
8458
|
var wasmExports = await createWasm();
|
|
8730
|
-
wasmExports["
|
|
8731
|
-
var ___getTypeName = wasmExports["
|
|
8732
|
-
var _malloc = wasmExports["
|
|
8733
|
-
var _free = wasmExports["
|
|
8734
|
-
Module["dynCall_ii"] = wasmExports["nc"];
|
|
8735
|
-
Module["dynCall_vi"] = wasmExports["oc"];
|
|
8736
|
-
Module["dynCall_ji"] = wasmExports["pc"];
|
|
8737
|
-
Module["dynCall_iii"] = wasmExports["qc"];
|
|
8738
|
-
Module["dynCall_vii"] = wasmExports["rc"];
|
|
8739
|
-
Module["dynCall_v"] = wasmExports["sc"];
|
|
8740
|
-
Module["dynCall_viij"] = wasmExports["tc"];
|
|
8741
|
-
Module["dynCall_fij"] = wasmExports["uc"];
|
|
8742
|
-
Module["dynCall_iij"] = wasmExports["vc"];
|
|
8743
|
-
Module["dynCall_viiij"] = wasmExports["wc"];
|
|
8744
|
-
Module["dynCall_viii"] = wasmExports["xc"];
|
|
8745
|
-
Module["dynCall_fif"] = wasmExports["yc"];
|
|
8746
|
-
Module["dynCall_viiii"] = wasmExports["zc"];
|
|
8747
|
-
Module["dynCall_fii"] = wasmExports["Ac"];
|
|
8748
|
-
Module["dynCall_iiii"] = wasmExports["Bc"];
|
|
8749
|
-
Module["dynCall_jii"] = wasmExports["Cc"];
|
|
8750
|
-
Module["dynCall_jij"] = wasmExports["Dc"];
|
|
8751
|
-
Module["dynCall_vij"] = wasmExports["Ec"];
|
|
8752
|
-
Module["dynCall_iiiiii"] = wasmExports["Fc"];
|
|
8753
|
-
Module["dynCall_viiiii"] = wasmExports["Gc"];
|
|
8754
|
-
Module["dynCall_iiiff"] = wasmExports["Hc"];
|
|
8755
|
-
Module["dynCall_vijii"] = wasmExports["Ic"];
|
|
8756
|
-
Module["dynCall_iiifi"] = wasmExports["Jc"];
|
|
8757
|
-
Module["dynCall_fi"] = wasmExports["Kc"];
|
|
8758
|
-
Module["dynCall_jijf"] = wasmExports["Lc"];
|
|
8759
|
-
Module["dynCall_fiii"] = wasmExports["Mc"];
|
|
8760
|
-
Module["dynCall_viiiji"] = wasmExports["Nc"];
|
|
8761
|
-
Module["dynCall_iijj"] = wasmExports["Oc"];
|
|
8762
|
-
Module["dynCall_iiiij"] = wasmExports["Pc"];
|
|
8763
|
-
Module["dynCall_diiii"] = wasmExports["Qc"];
|
|
8764
|
-
Module["dynCall_i"] = wasmExports["Rc"];
|
|
8765
|
-
Module["dynCall_vif"] = wasmExports["Sc"];
|
|
8766
|
-
Module["dynCall_di"] = wasmExports["Tc"];
|
|
8767
|
-
Module["dynCall_vid"] = wasmExports["Uc"];
|
|
8768
|
-
Module["dynCall_iiiiiii"] = wasmExports["Vc"];
|
|
8769
|
-
Module["dynCall_viiiiii"] = wasmExports["Wc"];
|
|
8770
|
-
Module["dynCall_iiiii"] = wasmExports["Xc"];
|
|
8771
|
-
Module["dynCall_iiiifii"] = wasmExports["Yc"];
|
|
8772
|
-
Module["dynCall_viiifii"] = wasmExports["Zc"];
|
|
8773
|
-
Module["dynCall_viiff"] = wasmExports["_c"];
|
|
8774
|
-
Module["dynCall_iiiiiiii"] = wasmExports["$c"];
|
|
8775
|
-
Module["dynCall_viiiiiii"] = wasmExports["ad"];
|
|
8776
|
-
Module["dynCall_iiiffi"] = wasmExports["bd"];
|
|
8777
|
-
Module["dynCall_iifffffffff"] = wasmExports["cd"];
|
|
8778
|
-
Module["dynCall_vifffffffff"] = wasmExports["dd"];
|
|
8779
|
-
Module["dynCall_iiff"] = wasmExports["ed"];
|
|
8780
|
-
Module["dynCall_viff"] = wasmExports["fd"];
|
|
8781
|
-
Module["dynCall_iif"] = wasmExports["gd"];
|
|
8782
|
-
Module["dynCall_viif"] = wasmExports["hd"];
|
|
8783
|
-
Module["dynCall_viffffff"] = wasmExports["id"];
|
|
8784
|
-
Module["dynCall_viffff"] = wasmExports["jd"];
|
|
8785
|
-
Module["dynCall_vifff"] = wasmExports["kd"];
|
|
8786
|
-
Module["dynCall_dii"] = wasmExports["ld"];
|
|
8787
|
-
Module["dynCall_viid"] = wasmExports["md"];
|
|
8788
|
-
Module["dynCall_iiiiffi"] = wasmExports["nd"];
|
|
8789
|
-
Module["dynCall_viiif"] = wasmExports["od"];
|
|
8790
|
-
Module["dynCall_viifffffffff"] = wasmExports["pd"];
|
|
8791
|
-
Module["dynCall_viiffffff"] = wasmExports["qd"];
|
|
8792
|
-
Module["dynCall_viiffff"] = wasmExports["rd"];
|
|
8793
|
-
Module["dynCall_viifff"] = wasmExports["sd"];
|
|
8794
|
-
Module["dynCall_viifi"] = wasmExports["td"];
|
|
8795
|
-
Module["dynCall_viddi"] = wasmExports["ud"];
|
|
8796
|
-
Module["dynCall_vifii"] = wasmExports["vd"];
|
|
8797
|
-
Module["dynCall_viifd"] = wasmExports["wd"];
|
|
8798
|
-
Module["dynCall_iiffi"] = wasmExports["xd"];
|
|
8799
|
-
Module["dynCall_viiiiiffii"] = wasmExports["yd"];
|
|
8800
|
-
Module["dynCall_iifii"] = wasmExports["zd"];
|
|
8801
|
-
Module["dynCall_vffff"] = wasmExports["Ad"];
|
|
8802
|
-
Module["dynCall_viiiiiiii"] = wasmExports["Bd"];
|
|
8803
|
-
Module["dynCall_vf"] = wasmExports["Cd"];
|
|
8804
|
-
Module["dynCall_viiiiiiiii"] = wasmExports["Dd"];
|
|
8805
|
-
Module["dynCall_viiiiiiiiii"] = wasmExports["Ed"];
|
|
8806
|
-
Module["dynCall_jiji"] = wasmExports["Fd"];
|
|
8807
|
-
Module["dynCall_iidiiii"] = wasmExports["Gd"];
|
|
8808
|
-
var _asyncify_start_unwind = wasmExports["Hd"];
|
|
8809
|
-
var _asyncify_stop_unwind = wasmExports["Id"];
|
|
8810
|
-
var _asyncify_start_rewind = wasmExports["Jd"];
|
|
8811
|
-
var _asyncify_stop_rewind = wasmExports["Kd"];
|
|
8459
|
+
wasmExports["Dc"];
|
|
8460
|
+
var ___getTypeName = wasmExports["Ec"];
|
|
8461
|
+
var _malloc = wasmExports["Gc"];
|
|
8462
|
+
var _free = wasmExports["Hc"];
|
|
8812
8463
|
Module["GL"] = GL;
|
|
8813
|
-
Module["Asyncify"] = Asyncify;
|
|
8814
8464
|
function run() {
|
|
8815
8465
|
if (runDependencies > 0) {
|
|
8816
8466
|
dependenciesFulfilled = run;
|
|
@@ -8893,151 +8543,6 @@
|
|
|
8893
8543
|
}
|
|
8894
8544
|
}
|
|
8895
8545
|
|
|
8896
|
-
const pagFiles = [];
|
|
8897
|
-
const registerPAGFile = (pagFile) => {
|
|
8898
|
-
pagFiles.push(pagFile);
|
|
8899
|
-
return pagFiles.length - 1;
|
|
8900
|
-
};
|
|
8901
|
-
const deletePAGFile = (key) => {
|
|
8902
|
-
pagFiles[key] = null;
|
|
8903
|
-
};
|
|
8904
|
-
const pagViews = [];
|
|
8905
|
-
const registerPAGView = (pagView) => {
|
|
8906
|
-
pagViews.push(pagView);
|
|
8907
|
-
return pagViews.length - 1;
|
|
8908
|
-
};
|
|
8909
|
-
const deletePAGView = (key) => {
|
|
8910
|
-
pagViews[key] = null;
|
|
8911
|
-
};
|
|
8912
|
-
const pagImages = [];
|
|
8913
|
-
const registerPAGImage = (pagImage) => {
|
|
8914
|
-
pagImages.push(pagImage);
|
|
8915
|
-
return pagImages.length - 1;
|
|
8916
|
-
};
|
|
8917
|
-
const deletePAGImage = (key) => {
|
|
8918
|
-
pagImages[key] = null;
|
|
8919
|
-
};
|
|
8920
|
-
const textDataMap = [];
|
|
8921
|
-
const registerTextData = (textData) => {
|
|
8922
|
-
textDataMap.push(textData);
|
|
8923
|
-
return textDataMap.length - 1;
|
|
8924
|
-
};
|
|
8925
|
-
const deleteTextData = (key) => {
|
|
8926
|
-
textDataMap[key] = null;
|
|
8927
|
-
};
|
|
8928
|
-
const workerInit = (init) => {
|
|
8929
|
-
onmessage = async (event) => {
|
|
8930
|
-
const messageHandles = {
|
|
8931
|
-
[WorkerMessageType.PAGInit]: (event2) => {
|
|
8932
|
-
const option = {};
|
|
8933
|
-
if (event2.data.args[0]) {
|
|
8934
|
-
option.locateFile = () => event2.data.args[0].fileUrl;
|
|
8935
|
-
}
|
|
8936
|
-
init(option).then((module) => {
|
|
8937
|
-
self.PAG = module;
|
|
8938
|
-
self.postMessage({ name: event2.data.name, args: [] });
|
|
8939
|
-
});
|
|
8940
|
-
},
|
|
8941
|
-
[WorkerMessageType.PAGFile_load]: async (event2) => {
|
|
8942
|
-
const key2 = registerPAGFile(await self.PAG.PAGFile.load(event2.data.args[0]));
|
|
8943
|
-
self.postMessage({ name: event2.data.name, args: [key2] });
|
|
8944
|
-
},
|
|
8945
|
-
[WorkerMessageType.PAGView_init]: async (event2) => {
|
|
8946
|
-
const [pagFileKey, canvas, option] = event2.data.args;
|
|
8947
|
-
const key2 = registerPAGView(await self.PAG.PAGView.init(pagFiles[pagFileKey], canvas, option));
|
|
8948
|
-
self.postMessage({ name: event2.data.name, args: [key2] });
|
|
8949
|
-
},
|
|
8950
|
-
[WorkerMessageType.PAGView_destroy]: async (event2) => {
|
|
8951
|
-
const [pagViewKey] = event2.data.args;
|
|
8952
|
-
pagViews[pagViewKey].destroy();
|
|
8953
|
-
deletePAGView(pagViewKey);
|
|
8954
|
-
self.postMessage({ name: event2.data.name, args: [] });
|
|
8955
|
-
},
|
|
8956
|
-
[WorkerMessageType.PAGFile_getTextData]: async (event2) => {
|
|
8957
|
-
const [pagFileKey, editableTextIndex] = event2.data.args;
|
|
8958
|
-
const textData = pagFiles[pagFileKey].getTextData(editableTextIndex);
|
|
8959
|
-
let virtualTextData = {};
|
|
8960
|
-
for (const key2 in textData) {
|
|
8961
|
-
if (typeof textData[key2] !== "function") {
|
|
8962
|
-
virtualTextData[key2] = textData[key2];
|
|
8963
|
-
}
|
|
8964
|
-
}
|
|
8965
|
-
virtualTextData.key = registerTextData(textData);
|
|
8966
|
-
self.postMessage({ name: event2.data.name, args: [virtualTextData] });
|
|
8967
|
-
},
|
|
8968
|
-
[WorkerMessageType.PAGFile_replaceText]: async (event2) => {
|
|
8969
|
-
const [pagFileKey, editableTextIndex, virtualTextData] = event2.data.args;
|
|
8970
|
-
const textData = textDataMap[virtualTextData.key];
|
|
8971
|
-
for (const key2 in virtualTextData) {
|
|
8972
|
-
if (key2 !== "key") {
|
|
8973
|
-
textData[key2] = virtualTextData[key2];
|
|
8974
|
-
}
|
|
8975
|
-
}
|
|
8976
|
-
pagFiles[pagFileKey].replaceText(editableTextIndex, textData);
|
|
8977
|
-
self.postMessage({ name: event2.data.name, args: [] });
|
|
8978
|
-
},
|
|
8979
|
-
[WorkerMessageType.PAGFile_replaceImage]: async (event2) => {
|
|
8980
|
-
const [pagFileKey, editableImageIndex, pagImageKey] = event2.data.args;
|
|
8981
|
-
const pagImage = pagImages[pagImageKey];
|
|
8982
|
-
pagFiles[pagFileKey].replaceImage(editableImageIndex, pagImage);
|
|
8983
|
-
self.postMessage({ name: event2.data.name, args: [] });
|
|
8984
|
-
},
|
|
8985
|
-
[WorkerMessageType.PAGFile_destroy]: async (event2) => {
|
|
8986
|
-
const [pagFileKey] = event2.data.args;
|
|
8987
|
-
pagFiles[pagFileKey].destroy();
|
|
8988
|
-
deletePAGFile(pagFileKey);
|
|
8989
|
-
self.postMessage({ name: event2.data.name, args: [] });
|
|
8990
|
-
},
|
|
8991
|
-
[WorkerMessageType.PAGImage_fromSource]: async (event2) => {
|
|
8992
|
-
const [bitmap] = event2.data.args;
|
|
8993
|
-
const key2 = registerPAGImage(self.PAG.PAGImage.fromSource(bitmap));
|
|
8994
|
-
self.postMessage({ name: event2.data.name, args: [key2] });
|
|
8995
|
-
},
|
|
8996
|
-
[WorkerMessageType.PAGImage_destroy]: async (event2) => {
|
|
8997
|
-
const [pagImageKey] = event2.data.args;
|
|
8998
|
-
pagImages[pagImageKey].destroy();
|
|
8999
|
-
deletePAGImage(pagImageKey);
|
|
9000
|
-
self.postMessage({ name: event2.data.name, args: [] });
|
|
9001
|
-
},
|
|
9002
|
-
[WorkerMessageType.TextDocument_delete]: async (event2) => {
|
|
9003
|
-
const [textDataKey] = event2.data.args;
|
|
9004
|
-
textDataMap[textDataKey].delete();
|
|
9005
|
-
deleteTextData(textDataKey);
|
|
9006
|
-
self.postMessage({ name: event2.data.name, args: [] });
|
|
9007
|
-
}
|
|
9008
|
-
};
|
|
9009
|
-
const name = event.data.name.split("_")[0];
|
|
9010
|
-
if (messageHandles[name]) {
|
|
9011
|
-
messageHandles[name](event);
|
|
9012
|
-
return;
|
|
9013
|
-
}
|
|
9014
|
-
const [type, fnName] = name.split(".");
|
|
9015
|
-
const key = event.data.args[0];
|
|
9016
|
-
if (type === "PAGFile") {
|
|
9017
|
-
const pagFile = pagFiles[key];
|
|
9018
|
-
if (!pagFile)
|
|
9019
|
-
throw new Error("pagFile doesn't exist");
|
|
9020
|
-
const fn = pagFile[fnName];
|
|
9021
|
-
if (!fn)
|
|
9022
|
-
throw new Error(`PAGFile.${fnName} doesn't exist`);
|
|
9023
|
-
const res = await fn.call(pagFile, ...event.data.args.slice(1));
|
|
9024
|
-
self.postMessage({ name: event.data.name, args: [res] });
|
|
9025
|
-
return;
|
|
9026
|
-
}
|
|
9027
|
-
if (type === "PAGView") {
|
|
9028
|
-
const pagView = pagViews[key];
|
|
9029
|
-
if (!pagView)
|
|
9030
|
-
throw new Error("pagView doesn't exist");
|
|
9031
|
-
const fn = pagView[fnName];
|
|
9032
|
-
if (!fn)
|
|
9033
|
-
throw new Error(`PAGView.${fnName} doesn't exist`);
|
|
9034
|
-
const res = await fn.call(pagView, ...event.data.args.slice(1));
|
|
9035
|
-
self.postMessage({ name: event.data.name, args: [res] });
|
|
9036
|
-
return;
|
|
9037
|
-
}
|
|
9038
|
-
};
|
|
9039
|
-
};
|
|
9040
|
-
|
|
9041
8546
|
const PAGInit = (moduleOption = {}) => PAGInit$1(moduleOption).then((module) => {
|
|
9042
8547
|
PAGBind(module);
|
|
9043
8548
|
module.webAssemblyQueue = new WebAssemblyQueue();
|
|
@@ -9048,9 +8553,6 @@
|
|
|
9048
8553
|
console.error(error);
|
|
9049
8554
|
throw new Error("PAGInit fail! Please check .wasm file path valid.");
|
|
9050
8555
|
});
|
|
9051
|
-
if (WORKER$1) {
|
|
9052
|
-
workerInit(PAGInit);
|
|
9053
|
-
}
|
|
9054
8556
|
|
|
9055
8557
|
exports.PAGInit = PAGInit;
|
|
9056
8558
|
exports.types = types;
|