@next2d/display 3.11.1 → 3.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/src/DisplayObject/service/DisplayObjectCalcBoundsMatrixService.d.ts +2 -1
- package/src/DisplayObject/service/DisplayObjectCalcBoundsMatrixService.js +9 -1
- package/src/DisplayObject/usecase/DisplayObjectSetRotationUseCase.js +5 -2
- package/src/Shape/usecase/ShapeGenerateRenderQueueUseCase.js +67 -5
- package/src/TextField/usecase/TextFieldGenerateRenderQueueUseCase.js +10 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next2d/display",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.1",
|
|
4
4
|
"description": "Next2D Display Package",
|
|
5
5
|
"author": "Toshiyuki Ienaga<ienaga@next2d.app> (https://github.com/ienaga/)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"url": "git+https://github.com/Next2D/Player.git"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@next2d/ui": "3.
|
|
28
|
-
"@next2d/text": "3.
|
|
29
|
-
"@next2d/geom": "3.
|
|
30
|
-
"@next2d/media": "3.
|
|
31
|
-
"@next2d/net": "3.
|
|
32
|
-
"@next2d/events": "3.
|
|
33
|
-
"@next2d/filters": "3.
|
|
34
|
-
"@next2d/render-queue": "3.
|
|
27
|
+
"@next2d/ui": "3.12.1",
|
|
28
|
+
"@next2d/text": "3.12.1",
|
|
29
|
+
"@next2d/geom": "3.12.1",
|
|
30
|
+
"@next2d/media": "3.12.1",
|
|
31
|
+
"@next2d/net": "3.12.1",
|
|
32
|
+
"@next2d/events": "3.12.1",
|
|
33
|
+
"@next2d/filters": "3.12.1",
|
|
34
|
+
"@next2d/render-queue": "3.12.1"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
* @param {number} x_max
|
|
8
8
|
* @param {number} y_max
|
|
9
9
|
* @param {Float32Array} matrix
|
|
10
|
+
* @param {Float32Array} [output] 呼び出し元所有の出力先 / Caller-owned output
|
|
10
11
|
* @return {array}
|
|
11
12
|
* @method
|
|
12
13
|
* @protected
|
|
13
14
|
*/
|
|
14
|
-
export declare const execute: (x_min: number, y_min: number, x_max: number, y_max: number, matrix: Float32Array) => Float32Array;
|
|
15
|
+
export declare const execute: (x_min: number, y_min: number, x_max: number, y_max: number, matrix: Float32Array, output?: Float32Array) => Float32Array;
|
|
@@ -8,11 +8,12 @@ import { $getBoundsArray } from "../../DisplayObjectUtil";
|
|
|
8
8
|
* @param {number} x_max
|
|
9
9
|
* @param {number} y_max
|
|
10
10
|
* @param {Float32Array} matrix
|
|
11
|
+
* @param {Float32Array} [output] 呼び出し元所有の出力先 / Caller-owned output
|
|
11
12
|
* @return {array}
|
|
12
13
|
* @method
|
|
13
14
|
* @protected
|
|
14
15
|
*/
|
|
15
|
-
export const execute = (x_min, y_min, x_max, y_max, matrix) => {
|
|
16
|
+
export const execute = (x_min, y_min, x_max, y_max, matrix, output) => {
|
|
16
17
|
const m0 = matrix[0];
|
|
17
18
|
const m1 = matrix[1];
|
|
18
19
|
const m2 = matrix[2];
|
|
@@ -27,5 +28,12 @@ export const execute = (x_min, y_min, x_max, y_max, matrix) => {
|
|
|
27
28
|
const y1 = x_max * m1 + y_min * m3 + m5;
|
|
28
29
|
const y2 = x_min * m1 + y_max * m3 + m5;
|
|
29
30
|
const y3 = x_min * m1 + y_min * m3 + m5;
|
|
31
|
+
if (output) {
|
|
32
|
+
output[0] = Math.min(x0, x1, x2, x3);
|
|
33
|
+
output[1] = Math.min(y0, y1, y2, y3);
|
|
34
|
+
output[2] = Math.max(x0, x1, x2, x3);
|
|
35
|
+
output[3] = Math.max(y0, y1, y2, y3);
|
|
36
|
+
return output;
|
|
37
|
+
}
|
|
30
38
|
return $getBoundsArray(Math.min(x0, x1, x2, x3), Math.min(y0, y1, y2, y3), Math.max(x0, x1, x2, x3), Math.max(y0, y1, y2, y3));
|
|
31
39
|
};
|
|
@@ -51,8 +51,11 @@ export const execute = (display_object, rotation) => {
|
|
|
51
51
|
const cosX = Math.cos(radianX);
|
|
52
52
|
matrix.b = scaleX * sinX;
|
|
53
53
|
matrix.a = Math.abs(sinX) === 1 ? 0 : scaleX * cosX;
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
// 角度が完全一致する場合だけ再利用する。符号付きゼロも区別する。
|
|
55
|
+
// Reuse only for identical angles, including the sign of zero.
|
|
56
|
+
const sameRadian = Object.is(radianY, radianX);
|
|
57
|
+
const sinY = sameRadian ? sinX : Math.sin(radianY);
|
|
58
|
+
const cosY = sameRadian ? cosX : Math.cos(radianY);
|
|
56
59
|
matrix.c = -scaleY * sinY;
|
|
57
60
|
matrix.d = Math.abs(sinY) === 1 ? 0 : scaleY * cosY;
|
|
58
61
|
}
|
|
@@ -8,6 +8,9 @@ import { stage } from "../../Stage";
|
|
|
8
8
|
import { $cacheStore } from "@next2d/cache";
|
|
9
9
|
import { $clamp, $RENDERER_SHAPE_TYPE, $getArray, $poolArray, $poolBoundsArray, $MATRIX_ARRAY_IDENTITY, $getFloat32Array6, $poolFloat32Array6, $getBoundsArray, $prepareFilterBuffers, $pushFilterBuffers, $getFilterUpdated } from "../../DisplayObjectUtil";
|
|
10
10
|
import { ColorTransform, Matrix } from "@next2d/geom";
|
|
11
|
+
// 同期的な境界計算の直後に4値をローカルへ取り出す。プールには返却しない。
|
|
12
|
+
// Copy all four values immediately after the synchronous calculation; never pool this buffer.
|
|
13
|
+
const $shapeBounds = new Float32Array(4);
|
|
11
14
|
/**
|
|
12
15
|
* @description renderer workerに渡すShapeの描画データを生成
|
|
13
16
|
* Generate drawing data of Shape to pass to renderer
|
|
@@ -57,12 +60,11 @@ export const execute = (shape, matrix, color_transform, renderer_width, renderer
|
|
|
57
60
|
|| rawMatrix[4] !== 0 || rawMatrix[5] !== 0)
|
|
58
61
|
? Matrix.multiply(matrix, rawMatrix)
|
|
59
62
|
: matrix;
|
|
60
|
-
const bounds = displayObjectCalcBoundsMatrixService(graphics.xMin, graphics.yMin, graphics.xMax, graphics.yMax, tMatrix);
|
|
63
|
+
const bounds = displayObjectCalcBoundsMatrixService(graphics.xMin, graphics.yMin, graphics.xMax, graphics.yMax, tMatrix, $shapeBounds);
|
|
61
64
|
let xMin = bounds[0];
|
|
62
65
|
let yMin = bounds[1];
|
|
63
66
|
let xMax = bounds[2];
|
|
64
67
|
let yMax = bounds[3];
|
|
65
|
-
$poolBoundsArray(bounds);
|
|
66
68
|
const width = Math.ceil(Math.abs(xMax - xMin));
|
|
67
69
|
const height = Math.ceil(Math.abs(yMax - yMin));
|
|
68
70
|
switch (true) {
|
|
@@ -168,9 +170,69 @@ export const execute = (shape, matrix, color_transform, renderer_width, renderer
|
|
|
168
170
|
const cacheKey = shape.isBitmap
|
|
169
171
|
? 0
|
|
170
172
|
: shape.cacheKey;
|
|
171
|
-
//
|
|
172
|
-
|
|
173
|
-
|
|
173
|
+
// 引数の評価順を維持し、getterから再入する前に行列・色を保存する。
|
|
174
|
+
// Preserve argument evaluation order; snapshot transforms before getters can re-enter.
|
|
175
|
+
const a = tMatrix[0] * cacheScaleX;
|
|
176
|
+
const b = tMatrix[1] * cacheScaleX;
|
|
177
|
+
const c = tMatrix[2] * cacheScaleY;
|
|
178
|
+
const d = tMatrix[3] * cacheScaleY;
|
|
179
|
+
const tx = tMatrix[4];
|
|
180
|
+
const ty = tMatrix[5];
|
|
181
|
+
const redMultiplier = tColorTransform[0];
|
|
182
|
+
const greenMultiplier = tColorTransform[1];
|
|
183
|
+
const blueMultiplier = tColorTransform[2];
|
|
184
|
+
const alphaMultiplier = tColorTransform[3];
|
|
185
|
+
const redOffset = tColorTransform[4];
|
|
186
|
+
const greenOffset = tColorTransform[5];
|
|
187
|
+
const blueOffset = tColorTransform[6];
|
|
188
|
+
const alphaOffset = tColorTransform[7];
|
|
189
|
+
const graphicsXMin = graphics.xMin;
|
|
190
|
+
const graphicsYMin = graphics.yMin;
|
|
191
|
+
const graphicsXMax = graphics.xMax;
|
|
192
|
+
const graphicsYMax = graphics.yMax;
|
|
193
|
+
const bitmapMode = shape.isBitmap ? 1 : cacheMatrix ? 2 : 0;
|
|
194
|
+
const uniqueKey = +shape.uniqueKey;
|
|
195
|
+
const instanceId = shape.instanceId;
|
|
196
|
+
// 32引数の呼び出しを省き、同じ32要素のレコードへ直接書き込む。
|
|
197
|
+
// Write the same 32-float record without the 32-argument call.
|
|
198
|
+
if (renderQueue.buffer.length < renderQueue.offset + 32) {
|
|
199
|
+
renderQueue.resize(32);
|
|
200
|
+
}
|
|
201
|
+
const queueBuffer = renderQueue.buffer;
|
|
202
|
+
const queueOffset = renderQueue.offset;
|
|
203
|
+
queueBuffer[queueOffset] = 1;
|
|
204
|
+
queueBuffer[queueOffset + 1] = $RENDERER_SHAPE_TYPE;
|
|
205
|
+
queueBuffer[queueOffset + 2] = a;
|
|
206
|
+
queueBuffer[queueOffset + 3] = b;
|
|
207
|
+
queueBuffer[queueOffset + 4] = c;
|
|
208
|
+
queueBuffer[queueOffset + 5] = d;
|
|
209
|
+
queueBuffer[queueOffset + 6] = tx;
|
|
210
|
+
queueBuffer[queueOffset + 7] = ty;
|
|
211
|
+
queueBuffer[queueOffset + 8] = redMultiplier;
|
|
212
|
+
queueBuffer[queueOffset + 9] = greenMultiplier;
|
|
213
|
+
queueBuffer[queueOffset + 10] = blueMultiplier;
|
|
214
|
+
queueBuffer[queueOffset + 11] = alphaMultiplier;
|
|
215
|
+
queueBuffer[queueOffset + 12] = redOffset;
|
|
216
|
+
queueBuffer[queueOffset + 13] = greenOffset;
|
|
217
|
+
queueBuffer[queueOffset + 14] = blueOffset;
|
|
218
|
+
queueBuffer[queueOffset + 15] = alphaOffset;
|
|
219
|
+
queueBuffer[queueOffset + 16] = xMin;
|
|
220
|
+
queueBuffer[queueOffset + 17] = yMin;
|
|
221
|
+
queueBuffer[queueOffset + 18] = xMax;
|
|
222
|
+
queueBuffer[queueOffset + 19] = yMax;
|
|
223
|
+
queueBuffer[queueOffset + 20] = graphicsXMin;
|
|
224
|
+
queueBuffer[queueOffset + 21] = graphicsYMin;
|
|
225
|
+
queueBuffer[queueOffset + 22] = graphicsXMax;
|
|
226
|
+
queueBuffer[queueOffset + 23] = graphicsYMax;
|
|
227
|
+
queueBuffer[queueOffset + 24] = +isGridEnabled;
|
|
228
|
+
queueBuffer[queueOffset + 25] = +isDrawable;
|
|
229
|
+
queueBuffer[queueOffset + 26] = bitmapMode;
|
|
230
|
+
queueBuffer[queueOffset + 27] = uniqueKey;
|
|
231
|
+
queueBuffer[queueOffset + 28] = cacheKey;
|
|
232
|
+
queueBuffer[queueOffset + 29] = renderXScale;
|
|
233
|
+
queueBuffer[queueOffset + 30] = renderYScale;
|
|
234
|
+
queueBuffer[queueOffset + 31] = instanceId;
|
|
235
|
+
renderQueue.offset = queueOffset + 32;
|
|
174
236
|
if (shape.$cache && !shape.$cache.has(shape.uniqueKey)) {
|
|
175
237
|
shape.$cache = null;
|
|
176
238
|
}
|
|
@@ -4,7 +4,7 @@ import { execute as displayObjectCalcBoundsMatrixService } from "../../DisplayOb
|
|
|
4
4
|
import { execute as displayObjectBlendToNumberService } from "../../DisplayObject/service/DisplayObjectBlendToNumberService";
|
|
5
5
|
import { execute as displayObjectGenerateHashService } from "../../DisplayObject/service/DisplayObjectGenerateHashService";
|
|
6
6
|
import { $cacheStore } from "@next2d/cache";
|
|
7
|
-
import { renderQueue } from "@next2d/render-queue";
|
|
7
|
+
import { renderQueue, encodeTextData } from "@next2d/render-queue";
|
|
8
8
|
import { stage } from "../../Stage";
|
|
9
9
|
import { $clamp, $RENDERER_TEXT_TYPE, $getArray, $poolArray, $poolBoundsArray, $getBoundsArray, $getFloat32Array6, $poolFloat32Array6, $prepareFilterBuffers, $pushFilterBuffers, $getFilterUpdated } from "../../DisplayObjectUtil";
|
|
10
10
|
import { ColorTransform, Matrix } from "@next2d/geom";
|
|
@@ -169,10 +169,15 @@ export const execute = (text_field, matrix, color_transform, renderer_width, ren
|
|
|
169
169
|
const cache = text_field.$cache
|
|
170
170
|
? text_field.$cache.get(`${cacheKey}`)
|
|
171
171
|
: $cacheStore.get(text_field.uniqueKey, `${cacheKey}`);
|
|
172
|
-
|
|
172
|
+
// Timeline characters can share a raster across instances. Keep their
|
|
173
|
+
// existing invalidation rule; instance-owned text uses per-entry revisions.
|
|
174
|
+
const rasterChanged = text_field.characterId && text_field.loaderInfo
|
|
175
|
+
? text_field.changed
|
|
176
|
+
: cache !== text_field.$rasterRevision;
|
|
177
|
+
if (!cache || rasterChanged) {
|
|
173
178
|
// cache none
|
|
174
|
-
renderQueue.push2(0, +cache);
|
|
175
|
-
const buffer = $textEncoder.encode(
|
|
179
|
+
renderQueue.push2(0, +Boolean(cache));
|
|
180
|
+
const buffer = $textEncoder.encode(encodeTextData(text_field.$textData));
|
|
176
181
|
// バイト数をヘッダに書き、本体は4バイト/floatでパックして転送量を1/4にする
|
|
177
182
|
renderQueue.push1(buffer.length);
|
|
178
183
|
renderQueue.setUint8(buffer);
|
|
@@ -192,9 +197,7 @@ export const execute = (text_field, matrix, color_transform, renderer_width, ren
|
|
|
192
197
|
break;
|
|
193
198
|
}
|
|
194
199
|
renderQueue.push19(text_field.stopIndex, text_field.scrollX, text_field.scrollY, text_field.textWidth, text_field.textHeight, Math.abs(text_field.xMax - text_field.xMin), Math.abs(text_field.yMax - text_field.yMin), text_field.focusIndex, text_field.selectIndex, +text_field.focusVisible, text_field.thickness, text_field.thicknessColor, +text_field.wordWrap, +text_field.border, text_field.borderColor, +text_field.background, text_field.backgroundColor, text_field.defaultTextFormat.color || 0, text_field.defaultTextFormat.size || 0);
|
|
195
|
-
|
|
196
|
-
$cacheStore.set(text_field.uniqueKey, `${cacheKey}`, true);
|
|
197
|
-
}
|
|
200
|
+
$cacheStore.set(text_field.uniqueKey, `${cacheKey}`, text_field.$rasterRevision);
|
|
198
201
|
if (text_field.$cache) {
|
|
199
202
|
text_field.$cache = null;
|
|
200
203
|
}
|