@next2d/display 3.0.5 → 3.1.0
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/package.json +9 -9
- package/src/DisplayObject/usecase/DisplayObjectHitTestPointUseCase.js +16 -2
- package/src/DisplayObject.d.ts +40 -1
- package/src/DisplayObject.js +73 -2
- package/src/DisplayObjectContainer/usecase/DisplayObjectContainerCalcBoundsMatrixUseCase.js +20 -2
- package/src/DisplayObjectContainer/usecase/DisplayObjectContainerGenerateRenderQueueUseCase.js +227 -96
- package/src/DisplayObjectContainer/usecase/DisplayObjectContainerMouseHitUseCase.js +20 -2
- package/src/Loader/usecase/LoaderLoadJsonUseCase.js +8 -1
- package/src/Loader/worker/ZlibInflateWorker.js +378 -9
- package/src/Loader/worker/unzip.worker.inline.js +1 -1
- package/src/Shape/usecase/ShapeCalcBoundsMatrixUseCase.js +20 -2
- package/src/Shape/usecase/ShapeGenerateRenderQueueUseCase.js +50 -12
- package/src/Shape/usecase/ShapeHitTestUseCase.js +20 -1
- package/src/TextField/usecase/TextFieldCalcBoundsMatrixUseCase.js +20 -2
- package/src/TextField/usecase/TextFieldGenerateRenderQueueUseCase.js +52 -13
- package/src/TextField/usecase/TextFieldHitTestUseCase.js +20 -1
|
@@ -1,20 +1,389 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import { decompressSync } from "fflate";
|
|
3
2
|
/**
|
|
4
|
-
* @description
|
|
5
|
-
*
|
|
3
|
+
* @description fflate非依存の高速 zlib/DEFLATE 解凍ワーカー (RFC 1950 / RFC 1951)
|
|
4
|
+
* High-performance zlib/DEFLATE decompression worker without fflate dependency.
|
|
5
|
+
*/
|
|
6
|
+
const _$LEN_BASE = new Uint16Array([
|
|
7
|
+
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
|
|
8
|
+
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258
|
|
9
|
+
]);
|
|
10
|
+
const _$LEN_EXTRA = new Uint8Array([
|
|
11
|
+
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
|
|
12
|
+
3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0
|
|
13
|
+
]);
|
|
14
|
+
const _$DIST_BASE = new Uint16Array([
|
|
15
|
+
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
|
16
|
+
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577
|
|
17
|
+
]);
|
|
18
|
+
const _$DIST_EXTRA = new Uint8Array([
|
|
19
|
+
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
|
|
20
|
+
7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13
|
|
21
|
+
]);
|
|
22
|
+
const _$CL_ORDER = new Uint8Array([
|
|
23
|
+
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
|
|
24
|
+
]);
|
|
25
|
+
const _$MASK = new Uint32Array(17);
|
|
26
|
+
for (let i = 1; i < 17; i++) {
|
|
27
|
+
_$MASK[i] = (1 << i) - 1;
|
|
28
|
+
}
|
|
29
|
+
const _$FIXED_LIT_CL = new Uint8Array(288);
|
|
30
|
+
for (let i = 0; i <= 143; i++) {
|
|
31
|
+
_$FIXED_LIT_CL[i] = 8;
|
|
32
|
+
}
|
|
33
|
+
for (let i = 144; i <= 255; i++) {
|
|
34
|
+
_$FIXED_LIT_CL[i] = 9;
|
|
35
|
+
}
|
|
36
|
+
for (let i = 256; i <= 279; i++) {
|
|
37
|
+
_$FIXED_LIT_CL[i] = 7;
|
|
38
|
+
}
|
|
39
|
+
for (let i = 280; i <= 287; i++) {
|
|
40
|
+
_$FIXED_LIT_CL[i] = 8;
|
|
41
|
+
}
|
|
42
|
+
const _$FIXED_DIST_CL = new Uint8Array(32).fill(5);
|
|
43
|
+
const _$decoder = new TextDecoder();
|
|
44
|
+
let _$outBuf = new Uint8Array(65536);
|
|
45
|
+
const _$blCount = new Uint16Array(16);
|
|
46
|
+
const _$nextCode = new Uint16Array(16);
|
|
47
|
+
const _$clLens = new Uint8Array(19);
|
|
48
|
+
const _$codeLens = new Uint8Array(320);
|
|
49
|
+
let _$dynClTbl = new Uint32Array(128);
|
|
50
|
+
let _$dynLitTbl = new Uint32Array(2048);
|
|
51
|
+
let _$dynDistTbl = new Uint32Array(1024);
|
|
52
|
+
/**
|
|
53
|
+
* @description canonical Huffmanルックアップテーブルを構築する。
|
|
54
|
+
* 各エントリは (symbol << 4) | codeLength の形式で格納される。
|
|
55
|
+
* Builds a canonical Huffman lookup table. Each entry stores (symbol << 4) | codeLength.
|
|
56
|
+
*
|
|
57
|
+
* @param {Uint8Array} codeLens - シンボルごとのコード長配列
|
|
58
|
+
* @param {number} n - codeLensの有効要素数
|
|
59
|
+
* @param {Uint32Array<ArrayBuffer>} [reuse] - 再利用するテーブルバッファ(GC回避用)
|
|
60
|
+
* @return {[Uint32Array<ArrayBuffer>, number]} [テーブル, 最大コード長]
|
|
61
|
+
* @method
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
const _$buildTable = (codeLens, n, reuse) => {
|
|
65
|
+
let max = 0;
|
|
66
|
+
_$blCount.fill(0);
|
|
67
|
+
for (let i = 0; i < n; i++) {
|
|
68
|
+
const l = codeLens[i];
|
|
69
|
+
if (l) {
|
|
70
|
+
_$blCount[l]++;
|
|
71
|
+
if (l > max) {
|
|
72
|
+
max = l;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (!max) {
|
|
77
|
+
if (reuse) {
|
|
78
|
+
reuse[0] = 0;
|
|
79
|
+
return [reuse, 1];
|
|
80
|
+
}
|
|
81
|
+
return [new Uint32Array(2), 1];
|
|
82
|
+
}
|
|
83
|
+
_$nextCode.fill(0);
|
|
84
|
+
for (let b = 1, c = 0; b <= max; b++) {
|
|
85
|
+
c = c + _$blCount[b - 1] << 1;
|
|
86
|
+
_$nextCode[b] = c;
|
|
87
|
+
}
|
|
88
|
+
const size = 1 << max;
|
|
89
|
+
let tbl;
|
|
90
|
+
if (reuse && reuse.length >= size) {
|
|
91
|
+
tbl = reuse;
|
|
92
|
+
tbl.fill(0, 0, size);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
tbl = new Uint32Array(size);
|
|
96
|
+
}
|
|
97
|
+
for (let s = 0; s < n; s++) {
|
|
98
|
+
const l = codeLens[s];
|
|
99
|
+
if (!l) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
let c = _$nextCode[l]++;
|
|
103
|
+
let r = 0;
|
|
104
|
+
for (let i = 0; i < l; i++) {
|
|
105
|
+
r = r << 1 | c & 1;
|
|
106
|
+
c >>= 1;
|
|
107
|
+
}
|
|
108
|
+
const entry = s << 4 | l;
|
|
109
|
+
for (let j = r; j < size; j += 1 << l) {
|
|
110
|
+
tbl[j] = entry;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return [tbl, max];
|
|
114
|
+
};
|
|
115
|
+
const [_$FIXED_LIT_TBL, _$FIXED_LIT_BITS] = _$buildTable(_$FIXED_LIT_CL, 288);
|
|
116
|
+
const [_$FIXED_DIST_TBL, _$FIXED_DIST_BITS] = _$buildTable(_$FIXED_DIST_CL, 32);
|
|
117
|
+
const _$FIXED_LIT_MASK = _$MASK[_$FIXED_LIT_BITS];
|
|
118
|
+
const _$FIXED_DIST_MASK = _$MASK[_$FIXED_DIST_BITS];
|
|
119
|
+
let _$src;
|
|
120
|
+
let _$pos;
|
|
121
|
+
let _$buf;
|
|
122
|
+
let _$cnt;
|
|
123
|
+
/**
|
|
124
|
+
* @description ビットストリームからnビットを読み取って返す。
|
|
125
|
+
* Reads n bits from the bit stream and returns the value.
|
|
126
|
+
*
|
|
127
|
+
* @param {number} n - 読み取るビット数
|
|
128
|
+
* @return {number} 読み取った値
|
|
129
|
+
* @method
|
|
130
|
+
* @private
|
|
131
|
+
*/
|
|
132
|
+
const _$bits = (n) => {
|
|
133
|
+
while (_$cnt < n) {
|
|
134
|
+
_$buf |= _$src[_$pos++] << _$cnt;
|
|
135
|
+
_$cnt += 8;
|
|
136
|
+
}
|
|
137
|
+
const v = _$buf & _$MASK[n];
|
|
138
|
+
_$buf >>>= n;
|
|
139
|
+
_$cnt -= n;
|
|
140
|
+
return v;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* @description Huffmanルックアップテーブルから1シンボルをデコードする。
|
|
144
|
+
* Decodes one symbol from the Huffman lookup table.
|
|
6
145
|
*
|
|
7
|
-
* @param {
|
|
146
|
+
* @param {Uint32Array} tbl - Huffmanルックアップテーブル
|
|
147
|
+
* @param {number} maxBits - テーブルの最大コード長
|
|
148
|
+
* @param {number} mask - ビットマスク ((1 << maxBits) - 1)
|
|
149
|
+
* @return {number} デコードされたシンボル値
|
|
150
|
+
* @method
|
|
151
|
+
* @private
|
|
152
|
+
*/
|
|
153
|
+
const _$huf = (tbl, maxBits, mask) => {
|
|
154
|
+
while (_$cnt < maxBits) {
|
|
155
|
+
_$buf |= _$src[_$pos++] << _$cnt;
|
|
156
|
+
_$cnt += 8;
|
|
157
|
+
}
|
|
158
|
+
const e = tbl[_$buf & mask];
|
|
159
|
+
_$buf >>>= e & 0xF;
|
|
160
|
+
_$cnt -= e & 0xF;
|
|
161
|
+
return e >> 4;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* @description DEFLATEストリームを解凍する (RFC 1951)。
|
|
165
|
+
* stored / fixed Huffman / dynamic Huffman の全ブロックタイプに対応。
|
|
166
|
+
* Decompresses a DEFLATE stream. Supports all block types: stored, fixed and dynamic Huffman.
|
|
167
|
+
*
|
|
168
|
+
* @param {Uint8Array} data - 圧縮データ
|
|
169
|
+
* @param {number} offset - DEFLATEストリームの開始オフセット
|
|
170
|
+
* @return {Uint8Array} 解凍されたバイト列
|
|
171
|
+
* @method
|
|
172
|
+
* @private
|
|
173
|
+
*/
|
|
174
|
+
const _$inflate = (data, offset) => {
|
|
175
|
+
_$src = data;
|
|
176
|
+
_$pos = offset;
|
|
177
|
+
_$buf = 0;
|
|
178
|
+
_$cnt = 0;
|
|
179
|
+
const estimatedSize = Math.max(data.length * 6, 4096);
|
|
180
|
+
if (_$outBuf.length < estimatedSize) {
|
|
181
|
+
_$outBuf = new Uint8Array(estimatedSize);
|
|
182
|
+
}
|
|
183
|
+
let out = _$outBuf;
|
|
184
|
+
let op = 0;
|
|
185
|
+
let fin = 0;
|
|
186
|
+
while (!fin) {
|
|
187
|
+
fin = _$bits(1);
|
|
188
|
+
const bt = _$bits(2);
|
|
189
|
+
if (bt === 0) {
|
|
190
|
+
const skip = _$cnt & 7;
|
|
191
|
+
_$buf >>>= skip;
|
|
192
|
+
_$cnt -= skip;
|
|
193
|
+
const len = _$bits(16);
|
|
194
|
+
_$bits(16);
|
|
195
|
+
if (op + len > out.length) {
|
|
196
|
+
let sz = out.length;
|
|
197
|
+
while (sz < op + len) {
|
|
198
|
+
sz <<= 1;
|
|
199
|
+
}
|
|
200
|
+
const nb = new Uint8Array(sz);
|
|
201
|
+
nb.set(out);
|
|
202
|
+
out = nb;
|
|
203
|
+
}
|
|
204
|
+
out.set(_$src.subarray(_$pos, _$pos + len), op);
|
|
205
|
+
_$pos += len;
|
|
206
|
+
op += len;
|
|
207
|
+
}
|
|
208
|
+
else if (bt === 3) {
|
|
209
|
+
throw new Error("Invalid DEFLATE block type");
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
let lt, lm, lb;
|
|
213
|
+
let dt, dm, db;
|
|
214
|
+
if (bt === 1) {
|
|
215
|
+
lt = _$FIXED_LIT_TBL;
|
|
216
|
+
lb = _$FIXED_LIT_BITS;
|
|
217
|
+
lm = _$FIXED_LIT_MASK;
|
|
218
|
+
dt = _$FIXED_DIST_TBL;
|
|
219
|
+
db = _$FIXED_DIST_BITS;
|
|
220
|
+
dm = _$FIXED_DIST_MASK;
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
const hlit = _$bits(5) + 257;
|
|
224
|
+
const hdist = _$bits(5) + 1;
|
|
225
|
+
const hclen = _$bits(4) + 4;
|
|
226
|
+
_$clLens.fill(0);
|
|
227
|
+
for (let i = 0; i < hclen; i++) {
|
|
228
|
+
_$clLens[_$CL_ORDER[i]] = _$bits(3);
|
|
229
|
+
}
|
|
230
|
+
let clb;
|
|
231
|
+
[_$dynClTbl, clb] = _$buildTable(_$clLens, 19, _$dynClTbl);
|
|
232
|
+
const clm = _$MASK[clb];
|
|
233
|
+
const total = hlit + hdist;
|
|
234
|
+
_$codeLens.fill(0, 0, total);
|
|
235
|
+
for (let i = 0; i < total;) {
|
|
236
|
+
const s = _$huf(_$dynClTbl, clb, clm);
|
|
237
|
+
if (s < 16) {
|
|
238
|
+
_$codeLens[i++] = s;
|
|
239
|
+
}
|
|
240
|
+
else if (s === 16) {
|
|
241
|
+
const p = _$codeLens[i - 1];
|
|
242
|
+
for (let r = _$bits(2) + 3; r > 0; r--) {
|
|
243
|
+
_$codeLens[i++] = p;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else if (s === 17) {
|
|
247
|
+
i += _$bits(3) + 3;
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
i += _$bits(7) + 11;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
[_$dynLitTbl, lb] = _$buildTable(_$codeLens.subarray(0, hlit), hlit, _$dynLitTbl);
|
|
254
|
+
lm = _$MASK[lb];
|
|
255
|
+
lt = _$dynLitTbl;
|
|
256
|
+
[_$dynDistTbl, db] = _$buildTable(_$codeLens.subarray(hlit, total), hdist, _$dynDistTbl);
|
|
257
|
+
dm = _$MASK[db];
|
|
258
|
+
dt = _$dynDistTbl;
|
|
259
|
+
}
|
|
260
|
+
for (;;) {
|
|
261
|
+
while (_$cnt < lb) {
|
|
262
|
+
_$buf |= _$src[_$pos++] << _$cnt;
|
|
263
|
+
_$cnt += 8;
|
|
264
|
+
}
|
|
265
|
+
const le = lt[_$buf & lm];
|
|
266
|
+
const sl = le & 0xF;
|
|
267
|
+
_$buf >>>= sl;
|
|
268
|
+
_$cnt -= sl;
|
|
269
|
+
const sym = le >> 4;
|
|
270
|
+
if (sym < 256) {
|
|
271
|
+
if (op >= out.length) {
|
|
272
|
+
const nb = new Uint8Array(out.length << 1);
|
|
273
|
+
nb.set(out);
|
|
274
|
+
out = nb;
|
|
275
|
+
}
|
|
276
|
+
out[op++] = sym;
|
|
277
|
+
}
|
|
278
|
+
else if (sym === 256) {
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
const li = sym - 257;
|
|
283
|
+
let length = _$LEN_BASE[li];
|
|
284
|
+
const le2 = _$LEN_EXTRA[li];
|
|
285
|
+
if (le2) {
|
|
286
|
+
while (_$cnt < le2) {
|
|
287
|
+
_$buf |= _$src[_$pos++] << _$cnt;
|
|
288
|
+
_$cnt += 8;
|
|
289
|
+
}
|
|
290
|
+
length += _$buf & _$MASK[le2];
|
|
291
|
+
_$buf >>>= le2;
|
|
292
|
+
_$cnt -= le2;
|
|
293
|
+
}
|
|
294
|
+
while (_$cnt < db) {
|
|
295
|
+
_$buf |= _$src[_$pos++] << _$cnt;
|
|
296
|
+
_$cnt += 8;
|
|
297
|
+
}
|
|
298
|
+
const de = dt[_$buf & dm];
|
|
299
|
+
const dl = de & 0xF;
|
|
300
|
+
_$buf >>>= dl;
|
|
301
|
+
_$cnt -= dl;
|
|
302
|
+
const di = de >> 4;
|
|
303
|
+
let dist = _$DIST_BASE[di];
|
|
304
|
+
const de2 = _$DIST_EXTRA[di];
|
|
305
|
+
if (de2) {
|
|
306
|
+
while (_$cnt < de2) {
|
|
307
|
+
_$buf |= _$src[_$pos++] << _$cnt;
|
|
308
|
+
_$cnt += 8;
|
|
309
|
+
}
|
|
310
|
+
dist += _$buf & _$MASK[de2];
|
|
311
|
+
_$buf >>>= de2;
|
|
312
|
+
_$cnt -= de2;
|
|
313
|
+
}
|
|
314
|
+
if (op + length > out.length) {
|
|
315
|
+
let sz = out.length;
|
|
316
|
+
while (sz < op + length) {
|
|
317
|
+
sz <<= 1;
|
|
318
|
+
}
|
|
319
|
+
const nb = new Uint8Array(sz);
|
|
320
|
+
nb.set(out);
|
|
321
|
+
out = nb;
|
|
322
|
+
}
|
|
323
|
+
const sp = op - dist;
|
|
324
|
+
if (dist === 1) {
|
|
325
|
+
out.fill(out[sp], op, op + length);
|
|
326
|
+
op += length;
|
|
327
|
+
}
|
|
328
|
+
else if (dist >= length) {
|
|
329
|
+
out.copyWithin(op, sp, sp + length);
|
|
330
|
+
op += length;
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
out.copyWithin(op, sp, sp + dist);
|
|
334
|
+
let copied = dist;
|
|
335
|
+
while (copied < length) {
|
|
336
|
+
const chunk = Math.min(copied, length - copied);
|
|
337
|
+
out.copyWithin(op + copied, op, op + chunk);
|
|
338
|
+
copied += chunk;
|
|
339
|
+
}
|
|
340
|
+
op += length;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
_$outBuf = out;
|
|
347
|
+
return out.subarray(0, op);
|
|
348
|
+
};
|
|
349
|
+
/**
|
|
350
|
+
* @description zlibラッパー付きデータを解凍する (RFC 1950)。
|
|
351
|
+
* zlibヘッダーを検出した場合は2バイトスキップし、それ以外は生DEFLATEとして処理する。
|
|
352
|
+
* Decompresses zlib-wrapped data. Skips the 2-byte zlib header if detected,
|
|
353
|
+
* otherwise treats input as raw DEFLATE.
|
|
354
|
+
*
|
|
355
|
+
* @param {Uint8Array} input - zlib圧縮データまたは生DEFLATEストリーム
|
|
356
|
+
* @return {Uint8Array} 解凍されたバイト列
|
|
357
|
+
* @method
|
|
358
|
+
* @private
|
|
359
|
+
*/
|
|
360
|
+
const _$zlibDecompress = (input) => {
|
|
361
|
+
const cmf = input[0];
|
|
362
|
+
const flg = input[1];
|
|
363
|
+
const isZlib = (cmf & 0x0F) === 8
|
|
364
|
+
&& (cmf * 256 + flg) % 31 === 0
|
|
365
|
+
&& !(flg & 0x20);
|
|
366
|
+
return _$inflate(input, isZlib ? 2 : 0);
|
|
367
|
+
};
|
|
368
|
+
/**
|
|
369
|
+
* @description zlibの圧縮されたデータを解凍し、JSONとしてパースして返すワーカーエントリポイント。
|
|
370
|
+
* Worker entry point that decompresses zlib data, decodes as URI-encoded string,
|
|
371
|
+
* parses as JSON and posts the result back.
|
|
372
|
+
*
|
|
373
|
+
* @param {MessageEvent} event - 圧縮データ (Uint8Array) を含むメッセージイベント
|
|
8
374
|
* @return {void}
|
|
9
375
|
* @method
|
|
10
376
|
* @public
|
|
11
377
|
*/
|
|
12
378
|
self.addEventListener("message", (event) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
379
|
+
try {
|
|
380
|
+
const buffer = _$zlibDecompress(event.data);
|
|
381
|
+
self.postMessage(JSON.parse(decodeURIComponent(_$decoder.decode(buffer))));
|
|
382
|
+
}
|
|
383
|
+
catch (e) {
|
|
384
|
+
self.postMessage({
|
|
385
|
+
"error": e instanceof Error ? e.message : "Unknown decompression error"
|
|
386
|
+
});
|
|
17
387
|
}
|
|
18
|
-
self.postMessage(JSON.parse(decodeURIComponent(json)));
|
|
19
388
|
});
|
|
20
389
|
export default {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const workerInlineUrl = 'data:application/javascript;base64,
|
|
1
|
+
export const workerInlineUrl = 'data:application/javascript;base64,dmFyIFVuemlwV29ya2VyPWZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IHQ9bmV3IFVpbnQxNkFycmF5KFszLDQsNSw2LDcsOCw5LDEwLDExLDEzLDE1LDE3LDE5LDIzLDI3LDMxLDM1LDQzLDUxLDU5LDY3LDgzLDk5LDExNSwxMzEsMTY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b25lbnQoZi5kZWNvZGUoZSkpKSl9Y2F0Y2godCl7c2VsZi5wb3N0TWVzc2FnZSh7ZXJyb3I6dCBpbnN0YW5jZW9mIEVycm9yP3QubWVzc2FnZToiVW5rbm93biBkZWNvbXByZXNzaW9uIGVycm9yIn0pfX0pO3JldHVybnt9fSgpOwo=';
|
|
@@ -2,7 +2,7 @@ import { Matrix } from "@next2d/geom";
|
|
|
2
2
|
import { execute as displayObjectCalcBoundsMatrixService } from "../../DisplayObject/service/DisplayObjectCalcBoundsMatrixService";
|
|
3
3
|
import { execute as shapeGetRawBoundsService } from "../service/ShapeGetRawBoundsService";
|
|
4
4
|
import { execute as displayObjectGetRawMatrixUseCase } from "../../DisplayObject/usecase/DisplayObjectGetRawMatrixUseCase";
|
|
5
|
-
import { $poolBoundsArray } from "../../DisplayObjectUtil";
|
|
5
|
+
import { $poolBoundsArray, $getFloat32Array6, $poolFloat32Array6 } from "../../DisplayObjectUtil";
|
|
6
6
|
/**
|
|
7
7
|
* @description Shapeの描画範囲を計算します。
|
|
8
8
|
* Calculate the drawing area of Shape.
|
|
@@ -15,7 +15,22 @@ import { $poolBoundsArray } from "../../DisplayObjectUtil";
|
|
|
15
15
|
*/
|
|
16
16
|
export const execute = (shape, matrix = null) => {
|
|
17
17
|
const rawBounds = shapeGetRawBoundsService(shape);
|
|
18
|
-
|
|
18
|
+
let rawMatrix = displayObjectGetRawMatrixUseCase(shape);
|
|
19
|
+
// cacheAsBitmap倍率をrawMatrixに適用
|
|
20
|
+
const cacheMatrix = shape.cacheAsBitmap;
|
|
21
|
+
let scaledMatrix = null;
|
|
22
|
+
if (cacheMatrix) {
|
|
23
|
+
const m = cacheMatrix.rawData;
|
|
24
|
+
const csx = Math.sqrt(m[0] * m[0] + m[1] * m[1]);
|
|
25
|
+
const csy = Math.sqrt(m[2] * m[2] + m[3] * m[3]);
|
|
26
|
+
if (rawMatrix) {
|
|
27
|
+
scaledMatrix = $getFloat32Array6(rawMatrix[0] * csx, rawMatrix[1] * csx, rawMatrix[2] * csy, rawMatrix[3] * csy, rawMatrix[4], rawMatrix[5]);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
scaledMatrix = $getFloat32Array6(csx, 0, 0, csy, 0, 0);
|
|
31
|
+
}
|
|
32
|
+
rawMatrix = scaledMatrix;
|
|
33
|
+
}
|
|
19
34
|
if (!rawMatrix) {
|
|
20
35
|
if (matrix) {
|
|
21
36
|
const calcBounds = displayObjectCalcBoundsMatrixService(rawBounds[0], rawBounds[1], rawBounds[2], rawBounds[3], matrix);
|
|
@@ -25,6 +40,9 @@ export const execute = (shape, matrix = null) => {
|
|
|
25
40
|
return rawBounds;
|
|
26
41
|
}
|
|
27
42
|
const calcBounds = displayObjectCalcBoundsMatrixService(rawBounds[0], rawBounds[1], rawBounds[2], rawBounds[3], matrix ? Matrix.multiply(matrix, rawMatrix) : rawMatrix);
|
|
43
|
+
if (scaledMatrix) {
|
|
44
|
+
$poolFloat32Array6(scaledMatrix);
|
|
45
|
+
}
|
|
28
46
|
$poolBoundsArray(rawBounds);
|
|
29
47
|
return calcBounds;
|
|
30
48
|
};
|
|
@@ -58,10 +58,10 @@ export const execute = (shape, matrix, color_transform, renderer_width, renderer
|
|
|
58
58
|
? Matrix.multiply(matrix, rawMatrix)
|
|
59
59
|
: matrix;
|
|
60
60
|
const bounds = displayObjectCalcBoundsMatrixService(graphics.xMin, graphics.yMin, graphics.xMax, graphics.yMax, tMatrix);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
let xMin = bounds[0];
|
|
62
|
+
let yMin = bounds[1];
|
|
63
|
+
let xMax = bounds[2];
|
|
64
|
+
let yMax = bounds[3];
|
|
65
65
|
$poolBoundsArray(bounds);
|
|
66
66
|
const width = Math.ceil(Math.abs(xMax - xMin));
|
|
67
67
|
const height = Math.ceil(Math.abs(yMax - yMin));
|
|
@@ -111,13 +111,51 @@ export const execute = (shape, matrix, color_transform, renderer_width, renderer
|
|
|
111
111
|
: `${displayObjectGenerateHashService(graphics.buffer)}`;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
// cacheAsBitmap: 指定Matrix × 自身のスケール × stageのrendererScaleでキャッシュ品質を決定
|
|
115
|
+
// 1.0基準: Matrix(1,0,0,1)はdisplayObjectの等倍スケールを意味する
|
|
116
|
+
const cacheMatrix = shape.cacheAsBitmap;
|
|
117
|
+
let renderXScale;
|
|
118
|
+
let renderYScale;
|
|
119
|
+
let cacheScaleX = 1;
|
|
120
|
+
let cacheScaleY = 1;
|
|
121
|
+
if (cacheMatrix) {
|
|
122
|
+
const m = cacheMatrix.rawData;
|
|
123
|
+
cacheScaleX = Math.sqrt(m[0] * m[0] + m[1] * m[1]);
|
|
124
|
+
cacheScaleY = Math.sqrt(m[2] * m[2] + m[3] * m[3]);
|
|
125
|
+
const ownScaleX = rawMatrix
|
|
126
|
+
? Math.sqrt(rawMatrix[0] * rawMatrix[0] + rawMatrix[1] * rawMatrix[1])
|
|
127
|
+
: 1;
|
|
128
|
+
const ownScaleY = rawMatrix
|
|
129
|
+
? Math.sqrt(rawMatrix[2] * rawMatrix[2] + rawMatrix[3] * rawMatrix[3])
|
|
130
|
+
: 1;
|
|
131
|
+
renderXScale = cacheScaleX * ownScaleX * stage.rendererScale;
|
|
132
|
+
renderYScale = cacheScaleY * ownScaleY * stage.rendererScale;
|
|
133
|
+
// cacheMatrix倍率をスクリーン座標のboundsにも反映
|
|
134
|
+
if (cacheScaleX !== 1 || cacheScaleY !== 1) {
|
|
135
|
+
const modMatrix = $getFloat32Array6(tMatrix[0] * cacheScaleX, tMatrix[1] * cacheScaleX, tMatrix[2] * cacheScaleY, tMatrix[3] * cacheScaleY, tMatrix[4], tMatrix[5]);
|
|
136
|
+
const modBounds = displayObjectCalcBoundsMatrixService(graphics.xMin, graphics.yMin, graphics.xMax, graphics.yMax, modMatrix);
|
|
137
|
+
xMin = modBounds[0];
|
|
138
|
+
yMin = modBounds[1];
|
|
139
|
+
xMax = modBounds[2];
|
|
140
|
+
yMax = modBounds[3];
|
|
141
|
+
$poolBoundsArray(modBounds);
|
|
142
|
+
$poolFloat32Array6(modMatrix);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
renderXScale = Math.sqrt(tMatrix[0] * tMatrix[0]
|
|
147
|
+
+ tMatrix[1] * tMatrix[1]);
|
|
148
|
+
renderYScale = Math.sqrt(tMatrix[2] * tMatrix[2]
|
|
149
|
+
+ tMatrix[3] * tMatrix[3]);
|
|
150
|
+
}
|
|
151
|
+
const xScaleRounded = Math.round(renderXScale * 100) / 100;
|
|
152
|
+
const yScaleRounded = Math.round(renderYScale * 100) / 100;
|
|
153
|
+
if (cacheMatrix && shape.cacheKey
|
|
154
|
+
&& shape.cacheParams[0] === xScaleRounded
|
|
155
|
+
&& shape.cacheParams[1] === yScaleRounded) {
|
|
156
|
+
// cacheAsBitmap: スケール未変更のためキャッシュキーを維持
|
|
157
|
+
}
|
|
158
|
+
else if (!shape.isBitmap
|
|
121
159
|
&& !shape.cacheKey
|
|
122
160
|
|| shape.cacheParams[0] !== xScaleRounded
|
|
123
161
|
|| shape.cacheParams[1] !== yScaleRounded
|
|
@@ -131,7 +169,7 @@ export const execute = (shape, matrix, color_transform, renderer_width, renderer
|
|
|
131
169
|
? 0
|
|
132
170
|
: shape.cacheKey;
|
|
133
171
|
// rennder on
|
|
134
|
-
renderQueue.pushShapeBuffer(1, $RENDERER_SHAPE_TYPE, tMatrix[0], tMatrix[1], tMatrix[2], tMatrix[3], tMatrix[4], tMatrix[5], tColorTransform[0], tColorTransform[1], tColorTransform[2], tColorTransform[3], tColorTransform[4], tColorTransform[5], tColorTransform[6], tColorTransform[7], xMin, yMin, xMax, yMax, graphics.xMin, graphics.yMin, graphics.xMax, graphics.yMax, +isGridEnabled, +isDrawable,
|
|
172
|
+
renderQueue.pushShapeBuffer(1, $RENDERER_SHAPE_TYPE, tMatrix[0] * cacheScaleX, tMatrix[1] * cacheScaleX, tMatrix[2] * cacheScaleY, tMatrix[3] * cacheScaleY, tMatrix[4], tMatrix[5], tColorTransform[0], tColorTransform[1], tColorTransform[2], tColorTransform[3], tColorTransform[4], tColorTransform[5], tColorTransform[6], tColorTransform[7], xMin, yMin, xMax, yMax, graphics.xMin, graphics.yMin, graphics.xMax, graphics.yMax, +isGridEnabled, +isDrawable, shape.isBitmap ? 1 : cacheMatrix ? 2 : 0, +shape.uniqueKey, cacheKey, renderXScale, renderYScale, shape.instanceId // フィルターキャッシュ用のユニークキー
|
|
135
173
|
);
|
|
136
174
|
if (shape.$cache && !shape.$cache.has(shape.uniqueKey)) {
|
|
137
175
|
shape.$cache = null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Matrix } from "@next2d/geom";
|
|
2
2
|
import { execute as displayObjectGetRawMatrixUseCase } from "../../DisplayObject/usecase/DisplayObjectGetRawMatrixUseCase";
|
|
3
3
|
import { execute as graphicsHitTestService } from "../../Graphics/service/GraphicsHitTestService";
|
|
4
|
+
import { $getFloat32Array6, $poolFloat32Array6 } from "../../DisplayObjectUtil";
|
|
4
5
|
/**
|
|
5
6
|
* @description Shape のヒット判定
|
|
6
7
|
* Hit judgment of Shape
|
|
@@ -20,10 +21,28 @@ export const execute = (shape, hit_context, matrix, hit_object) => {
|
|
|
20
21
|
if (width <= 0 || height <= 0) {
|
|
21
22
|
return false;
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
+
let rawMatrix = displayObjectGetRawMatrixUseCase(shape);
|
|
25
|
+
// cacheAsBitmap倍率をrawMatrixに適用
|
|
26
|
+
const cacheMatrix = shape.cacheAsBitmap;
|
|
27
|
+
let scaledMatrix = null;
|
|
28
|
+
if (cacheMatrix) {
|
|
29
|
+
const m = cacheMatrix.rawData;
|
|
30
|
+
const csx = Math.sqrt(m[0] * m[0] + m[1] * m[1]);
|
|
31
|
+
const csy = Math.sqrt(m[2] * m[2] + m[3] * m[3]);
|
|
32
|
+
if (rawMatrix) {
|
|
33
|
+
scaledMatrix = $getFloat32Array6(rawMatrix[0] * csx, rawMatrix[1] * csx, rawMatrix[2] * csy, rawMatrix[3] * csy, rawMatrix[4], rawMatrix[5]);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
scaledMatrix = $getFloat32Array6(csx, 0, 0, csy, 0, 0);
|
|
37
|
+
}
|
|
38
|
+
rawMatrix = scaledMatrix;
|
|
39
|
+
}
|
|
24
40
|
const tMatrix = rawMatrix
|
|
25
41
|
? Matrix.multiply(matrix, rawMatrix)
|
|
26
42
|
: matrix;
|
|
43
|
+
if (scaledMatrix) {
|
|
44
|
+
$poolFloat32Array6(scaledMatrix);
|
|
45
|
+
}
|
|
27
46
|
hit_context.beginPath();
|
|
28
47
|
hit_context.setTransform(tMatrix[0], tMatrix[1], tMatrix[2], tMatrix[3], tMatrix[4], tMatrix[5]);
|
|
29
48
|
let hit = false;
|
|
@@ -2,7 +2,7 @@ import { Matrix } from "@next2d/geom";
|
|
|
2
2
|
import { execute as displayObjectCalcBoundsMatrixService } from "../../DisplayObject/service/DisplayObjectCalcBoundsMatrixService";
|
|
3
3
|
import { execute as textFieldGetRawBoundsService } from "../service/TextFieldGetRawBoundsService";
|
|
4
4
|
import { execute as displayObjectGetRawMatrixUseCase } from "../../DisplayObject/usecase/DisplayObjectGetRawMatrixUseCase";
|
|
5
|
-
import { $poolBoundsArray } from "../../DisplayObjectUtil";
|
|
5
|
+
import { $poolBoundsArray, $getFloat32Array6, $poolFloat32Array6 } from "../../DisplayObjectUtil";
|
|
6
6
|
/**
|
|
7
7
|
* @description TextFieldの描画範囲を計算します。
|
|
8
8
|
* Calculate the drawing area of Shape.
|
|
@@ -15,7 +15,22 @@ import { $poolBoundsArray } from "../../DisplayObjectUtil";
|
|
|
15
15
|
*/
|
|
16
16
|
export const execute = (text_field, matrix = null) => {
|
|
17
17
|
const rawBounds = textFieldGetRawBoundsService(text_field);
|
|
18
|
-
|
|
18
|
+
let rawMatrix = displayObjectGetRawMatrixUseCase(text_field);
|
|
19
|
+
// cacheAsBitmap倍率をrawMatrixに適用
|
|
20
|
+
const cacheMatrix = text_field.cacheAsBitmap;
|
|
21
|
+
let scaledMatrix = null;
|
|
22
|
+
if (cacheMatrix) {
|
|
23
|
+
const m = cacheMatrix.rawData;
|
|
24
|
+
const csx = Math.sqrt(m[0] * m[0] + m[1] * m[1]);
|
|
25
|
+
const csy = Math.sqrt(m[2] * m[2] + m[3] * m[3]);
|
|
26
|
+
if (rawMatrix) {
|
|
27
|
+
scaledMatrix = $getFloat32Array6(rawMatrix[0] * csx, rawMatrix[1] * csx, rawMatrix[2] * csy, rawMatrix[3] * csy, rawMatrix[4], rawMatrix[5]);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
scaledMatrix = $getFloat32Array6(csx, 0, 0, csy, 0, 0);
|
|
31
|
+
}
|
|
32
|
+
rawMatrix = scaledMatrix;
|
|
33
|
+
}
|
|
19
34
|
if (!rawMatrix) {
|
|
20
35
|
if (matrix) {
|
|
21
36
|
const calcBounds = displayObjectCalcBoundsMatrixService(rawBounds[0], rawBounds[1], rawBounds[2], rawBounds[3], matrix);
|
|
@@ -25,6 +40,9 @@ export const execute = (text_field, matrix = null) => {
|
|
|
25
40
|
return rawBounds;
|
|
26
41
|
}
|
|
27
42
|
const calcBounds = displayObjectCalcBoundsMatrixService(rawBounds[0], rawBounds[1], rawBounds[2], rawBounds[3], matrix ? Matrix.multiply(matrix, rawMatrix) : rawMatrix);
|
|
43
|
+
if (scaledMatrix) {
|
|
44
|
+
$poolFloat32Array6(scaledMatrix);
|
|
45
|
+
}
|
|
28
46
|
$poolBoundsArray(rawBounds);
|
|
29
47
|
return calcBounds;
|
|
30
48
|
};
|