@next2d/display 3.17.0 → 3.18.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/Graphics/service/GraphicsToBufferService.d.ts +24 -0
- package/src/Graphics/service/GraphicsToBufferService.js +32 -0
- package/src/Graphics/service/GraphicsToNumberArrayService.d.ts +11 -0
- package/src/Graphics/service/GraphicsToNumberArrayService.js +21 -8
- package/src/Graphics.js +2 -4
- package/src/Shape/usecase/ShapeBuildFromCharacterUseCase.js +4 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next2d/display",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.18.0",
|
|
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.18.0",
|
|
28
|
+
"@next2d/text": "3.18.0",
|
|
29
|
+
"@next2d/geom": "3.18.0",
|
|
30
|
+
"@next2d/media": "3.18.0",
|
|
31
|
+
"@next2d/net": "3.18.0",
|
|
32
|
+
"@next2d/events": "3.18.0",
|
|
33
|
+
"@next2d/filters": "3.18.0",
|
|
34
|
+
"@next2d/render-queue": "3.18.0"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Graphicsのrecodesを解析して、描画用の Float32Array を生成します。
|
|
3
|
+
* 内容は、GraphicsToNumberArrayService の結果を Float32Array にしたものと同じ。
|
|
4
|
+
*
|
|
5
|
+
* 数値は、この呼び出しのために作った配列へ集める。共有のプールから取った配列
|
|
6
|
+
* ($getArray) は、文字列やオブジェクトを入れたことがあると、数値専用の持ち方に
|
|
7
|
+
* 戻らない。その配列へ小数を追加すると 1 つずつ別の領域が確保され、Float32Array への
|
|
8
|
+
* 変換も 1 要素ずつになる (図形を作るたびに呼ばれる処理で、JIT が無い環境では
|
|
9
|
+
* 約 1.5 倍の時間がかかった)。
|
|
10
|
+
*
|
|
11
|
+
* Parses Graphics recodes and generates the Float32Array used for rendering.
|
|
12
|
+
* The content equals the result of GraphicsToNumberArrayService converted to a
|
|
13
|
+
* Float32Array. The numbers are collected in an array created for this call: an
|
|
14
|
+
* array taken from the shared pool ($getArray) that has ever held a string or an
|
|
15
|
+
* object never returns to a number-only representation, so every fraction pushed
|
|
16
|
+
* to it is allocated separately and the conversion to a Float32Array goes element
|
|
17
|
+
* by element (about 1.5x the time without a JIT, in a path run for every shape built).
|
|
18
|
+
*
|
|
19
|
+
* @param {array} recodes
|
|
20
|
+
* @return {Float32Array}
|
|
21
|
+
* @method
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
export declare const execute: (recodes: any[] | null) => Float32Array;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { write } from "./GraphicsToNumberArrayService";
|
|
2
|
+
/**
|
|
3
|
+
* @description Graphicsのrecodesを解析して、描画用の Float32Array を生成します。
|
|
4
|
+
* 内容は、GraphicsToNumberArrayService の結果を Float32Array にしたものと同じ。
|
|
5
|
+
*
|
|
6
|
+
* 数値は、この呼び出しのために作った配列へ集める。共有のプールから取った配列
|
|
7
|
+
* ($getArray) は、文字列やオブジェクトを入れたことがあると、数値専用の持ち方に
|
|
8
|
+
* 戻らない。その配列へ小数を追加すると 1 つずつ別の領域が確保され、Float32Array への
|
|
9
|
+
* 変換も 1 要素ずつになる (図形を作るたびに呼ばれる処理で、JIT が無い環境では
|
|
10
|
+
* 約 1.5 倍の時間がかかった)。
|
|
11
|
+
*
|
|
12
|
+
* Parses Graphics recodes and generates the Float32Array used for rendering.
|
|
13
|
+
* The content equals the result of GraphicsToNumberArrayService converted to a
|
|
14
|
+
* Float32Array. The numbers are collected in an array created for this call: an
|
|
15
|
+
* array taken from the shared pool ($getArray) that has ever held a string or an
|
|
16
|
+
* object never returns to a number-only representation, so every fraction pushed
|
|
17
|
+
* to it is allocated separately and the conversion to a Float32Array goes element
|
|
18
|
+
* by element (about 1.5x the time without a JIT, in a path run for every shape built).
|
|
19
|
+
*
|
|
20
|
+
* @param {array} recodes
|
|
21
|
+
* @return {Float32Array}
|
|
22
|
+
* @method
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
25
|
+
export const execute = (recodes) => {
|
|
26
|
+
if (!recodes) {
|
|
27
|
+
return new Float32Array(0);
|
|
28
|
+
}
|
|
29
|
+
const array = [];
|
|
30
|
+
write(recodes, array);
|
|
31
|
+
return new Float32Array(array);
|
|
32
|
+
};
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Graphicsのrecodesを解析して、数値を array へ追加します。
|
|
3
|
+
* Parses Graphics recodes and appends the numbers to the array.
|
|
4
|
+
*
|
|
5
|
+
* @param {array} recodes
|
|
6
|
+
* @param {number[]} array
|
|
7
|
+
* @return {void}
|
|
8
|
+
* @method
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
export declare const write: (recodes: any[], array: number[]) => void;
|
|
1
12
|
/**
|
|
2
13
|
* @description Graphicsのrecodesを解析して数値配列を生成します。
|
|
3
14
|
* Parses Graphics recodes and generates a numerical array.
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
import { $getArray } from "../../DisplayObjectUtil";
|
|
2
2
|
import { $MOVE_TO, $CURVE_TO, $LINE_TO, $CUBIC, $ARC, $FILL_STYLE, $STROKE_STYLE, $END_FILL, $END_STROKE, $BEGIN_PATH, $GRADIENT_FILL, $GRADIENT_STROKE, $CLOSE_PATH, $BITMAP_FILL, $BITMAP_STROKE } from "../GraphicsCommand";
|
|
3
3
|
/**
|
|
4
|
-
* @description Graphicsのrecodes
|
|
5
|
-
* Parses Graphics recodes and
|
|
4
|
+
* @description Graphicsのrecodesを解析して、数値を array へ追加します。
|
|
5
|
+
* Parses Graphics recodes and appends the numbers to the array.
|
|
6
6
|
*
|
|
7
7
|
* @param {array} recodes
|
|
8
|
-
* @
|
|
8
|
+
* @param {number[]} array
|
|
9
|
+
* @return {void}
|
|
9
10
|
* @method
|
|
10
11
|
* @public
|
|
11
12
|
*/
|
|
12
|
-
export const
|
|
13
|
-
if (!recodes) {
|
|
14
|
-
return [];
|
|
15
|
-
}
|
|
16
|
-
const array = $getArray();
|
|
13
|
+
export const write = (recodes, array) => {
|
|
17
14
|
for (let idx = 0; idx < recodes.length;) {
|
|
18
15
|
const type = recodes[idx++];
|
|
19
16
|
array.push(type);
|
|
@@ -266,5 +263,21 @@ export const execute = (recodes) => {
|
|
|
266
263
|
break;
|
|
267
264
|
}
|
|
268
265
|
}
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* @description Graphicsのrecodesを解析して数値配列を生成します。
|
|
269
|
+
* Parses Graphics recodes and generates a numerical array.
|
|
270
|
+
*
|
|
271
|
+
* @param {array} recodes
|
|
272
|
+
* @return {any[]}
|
|
273
|
+
* @method
|
|
274
|
+
* @public
|
|
275
|
+
*/
|
|
276
|
+
export const execute = (recodes) => {
|
|
277
|
+
if (!recodes) {
|
|
278
|
+
return [];
|
|
279
|
+
}
|
|
280
|
+
const array = $getArray();
|
|
281
|
+
write(recodes, array);
|
|
269
282
|
return array;
|
|
270
283
|
};
|
package/src/Graphics.js
CHANGED
|
@@ -6,7 +6,7 @@ import { execute as graphicsMargePathService } from "./Graphics/service/Graphics
|
|
|
6
6
|
import { execute as graphicsDrawEllipseService } from "./Graphics/service/GraphicsDrawEllipseService";
|
|
7
7
|
import { execute as graphicsDrawRectService } from "./Graphics/service/GraphicsDrawRectService";
|
|
8
8
|
import { execute as graphicsDrawRoundRectService } from "./Graphics/service/GraphicsDrawRoundRectService";
|
|
9
|
-
import { execute as
|
|
9
|
+
import { execute as graphicsToBufferService } from "./Graphics/service/GraphicsToBufferService";
|
|
10
10
|
import { execute as graphicsInvalidateOwnerCacheUseCase } from "./Graphics/usecase/GraphicsInvalidateOwnerCacheUseCase";
|
|
11
11
|
import { $getArray, $poolArray, $clamp, $convertColorStringToNumber } from "./DisplayObjectUtil";
|
|
12
12
|
/**
|
|
@@ -1037,9 +1037,7 @@ export class Graphics {
|
|
|
1037
1037
|
if (this._$hasFillEnabled) {
|
|
1038
1038
|
this.endFill();
|
|
1039
1039
|
}
|
|
1040
|
-
|
|
1041
|
-
this._$buffer = new Float32Array(array);
|
|
1042
|
-
$poolArray(array);
|
|
1040
|
+
this._$buffer = graphicsToBufferService(this.$recodes);
|
|
1043
1041
|
// レコードの確定フラグを更新
|
|
1044
1042
|
this.isConfirmed = true;
|
|
1045
1043
|
return this._$buffer;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { execute as
|
|
1
|
+
import { execute as graphicsToBufferService } from "../../Graphics/service/GraphicsToBufferService";
|
|
2
2
|
import { $poolArray } from "../../DisplayObjectUtil";
|
|
3
3
|
import { BitmapData } from "../../BitmapData";
|
|
4
4
|
import { Graphics } from "../../Graphics";
|
|
@@ -40,10 +40,8 @@ export const execute = (shape, character) => {
|
|
|
40
40
|
const bitmapData = new BitmapData(bitmapWidth, bitmapHeight);
|
|
41
41
|
bitmapData.buffer = bitmap.imageBuffer;
|
|
42
42
|
recodes.push(Graphics.BITMAP_FILL, bitmapData, null, true, false, 9);
|
|
43
|
-
|
|
44
|
-
graphics.buffer = new Float32Array(numberArray);
|
|
43
|
+
graphics.buffer = graphicsToBufferService(recodes);
|
|
45
44
|
$poolArray(recodes);
|
|
46
|
-
$poolArray(numberArray);
|
|
47
45
|
}
|
|
48
46
|
}
|
|
49
47
|
else {
|
|
@@ -60,10 +58,8 @@ export const execute = (shape, character) => {
|
|
|
60
58
|
const recodes = character.recodes.slice(0);
|
|
61
59
|
recodes.splice(-5, 5);
|
|
62
60
|
recodes.push(bitmapData, null, true, false);
|
|
63
|
-
|
|
64
|
-
graphics.buffer = new Float32Array(numberArray);
|
|
61
|
+
graphics.buffer = graphicsToBufferService(recodes);
|
|
65
62
|
$poolArray(recodes);
|
|
66
|
-
$poolArray(numberArray);
|
|
67
63
|
}
|
|
68
64
|
else {
|
|
69
65
|
graphics
|
|
@@ -101,7 +97,7 @@ export const execute = (shape, character) => {
|
|
|
101
97
|
break;
|
|
102
98
|
default: // normal shape
|
|
103
99
|
if (character.recodes) {
|
|
104
|
-
character.recodeBuffer =
|
|
100
|
+
character.recodeBuffer = graphicsToBufferService(character.recodes);
|
|
105
101
|
$poolArray(character.recodes);
|
|
106
102
|
character.recodes = null;
|
|
107
103
|
}
|