pixi.js 7.2.3 → 7.2.4
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/dist/pixi.js +148 -86
- package/dist/pixi.js.map +1 -1
- package/dist/pixi.min.js +36 -36
- package/dist/pixi.min.js.map +1 -1
- package/dist/pixi.min.mjs +41 -41
- package/dist/pixi.min.mjs.map +1 -1
- package/dist/pixi.mjs +148 -86
- package/dist/pixi.mjs.map +1 -1
- package/package.json +31 -31
package/dist/pixi.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* pixi.js - v7.2.
|
|
3
|
-
* Compiled
|
|
2
|
+
* pixi.js - v7.2.4
|
|
3
|
+
* Compiled Thu, 06 Apr 2023 19:36:45 UTC
|
|
4
4
|
*
|
|
5
5
|
* pixi.js is licensed under the MIT License.
|
|
6
6
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -3452,19 +3452,21 @@ Deprecated since v${version}`);
|
|
|
3452
3452
|
this._value = null;
|
|
3453
3453
|
return this;
|
|
3454
3454
|
}
|
|
3455
|
-
toPremultiplied(alpha) {
|
|
3455
|
+
toPremultiplied(alpha, applyToRGB = true) {
|
|
3456
3456
|
if (alpha === 1) {
|
|
3457
|
-
return (
|
|
3457
|
+
return (255 << 24) + this._int;
|
|
3458
3458
|
}
|
|
3459
3459
|
if (alpha === 0) {
|
|
3460
|
-
return 0;
|
|
3460
|
+
return applyToRGB ? 0 : this._int;
|
|
3461
3461
|
}
|
|
3462
3462
|
let r = this._int >> 16 & 255;
|
|
3463
3463
|
let g = this._int >> 8 & 255;
|
|
3464
3464
|
let b = this._int & 255;
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3465
|
+
if (applyToRGB) {
|
|
3466
|
+
r = r * alpha + 0.5 | 0;
|
|
3467
|
+
g = g * alpha + 0.5 | 0;
|
|
3468
|
+
b = b * alpha + 0.5 | 0;
|
|
3469
|
+
}
|
|
3468
3470
|
return (alpha * 255 << 24) + (r << 16) + (g << 8) + b;
|
|
3469
3471
|
}
|
|
3470
3472
|
toHex() {
|
|
@@ -3499,23 +3501,26 @@ Deprecated since v${version}`);
|
|
|
3499
3501
|
return out;
|
|
3500
3502
|
}
|
|
3501
3503
|
normalize(value) {
|
|
3502
|
-
let
|
|
3504
|
+
let r;
|
|
3505
|
+
let g;
|
|
3506
|
+
let b;
|
|
3507
|
+
let a;
|
|
3503
3508
|
if ((typeof value === "number" || value instanceof Number) && value >= 0 && value <= 16777215) {
|
|
3504
3509
|
const int = value;
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
1
|
|
3510
|
-
];
|
|
3510
|
+
r = (int >> 16 & 255) / 255;
|
|
3511
|
+
g = (int >> 8 & 255) / 255;
|
|
3512
|
+
b = (int & 255) / 255;
|
|
3513
|
+
a = 1;
|
|
3511
3514
|
} else if ((Array.isArray(value) || value instanceof Float32Array) && value.length >= 3 && value.length <= 4) {
|
|
3512
3515
|
value = this._clamp(value);
|
|
3513
|
-
|
|
3514
|
-
components = [r, g, b, a];
|
|
3516
|
+
[r, g, b, a = 1] = value;
|
|
3515
3517
|
} else if ((value instanceof Uint8Array || value instanceof Uint8ClampedArray) && value.length >= 3 && value.length <= 4) {
|
|
3516
3518
|
value = this._clamp(value, 0, 255);
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
+
[r, g, b, a = 255] = value;
|
|
3520
|
+
r /= 255;
|
|
3521
|
+
g /= 255;
|
|
3522
|
+
b /= 255;
|
|
3523
|
+
a /= 255;
|
|
3519
3524
|
} else if (typeof value === "string" || typeof value === "object") {
|
|
3520
3525
|
if (typeof value === "string") {
|
|
3521
3526
|
const match = _Color.HEX_PATTERN.exec(value);
|
|
@@ -3525,12 +3530,17 @@ Deprecated since v${version}`);
|
|
|
3525
3530
|
}
|
|
3526
3531
|
const color = w(value);
|
|
3527
3532
|
if (color.isValid()) {
|
|
3528
|
-
|
|
3529
|
-
|
|
3533
|
+
({ r, g, b, a } = color.rgba);
|
|
3534
|
+
r /= 255;
|
|
3535
|
+
g /= 255;
|
|
3536
|
+
b /= 255;
|
|
3530
3537
|
}
|
|
3531
3538
|
}
|
|
3532
|
-
if (
|
|
3533
|
-
this._components
|
|
3539
|
+
if (r !== void 0) {
|
|
3540
|
+
this._components[0] = r;
|
|
3541
|
+
this._components[1] = g;
|
|
3542
|
+
this._components[2] = b;
|
|
3543
|
+
this._components[3] = a;
|
|
3534
3544
|
this.refreshInt();
|
|
3535
3545
|
} else {
|
|
3536
3546
|
throw new Error(`Unable to convert color ${value}`);
|
|
@@ -4658,7 +4668,7 @@ Deprecated since v${version}`);
|
|
|
4658
4668
|
buffer = buffer || new Float32Array(width * height * 4);
|
|
4659
4669
|
const resource = new BufferResource(buffer, { width, height });
|
|
4660
4670
|
const type = buffer instanceof Float32Array ? TYPES.FLOAT : TYPES.UNSIGNED_BYTE;
|
|
4661
|
-
return new _BaseTexture(resource, Object.assign({}, defaultBufferOptions,
|
|
4671
|
+
return new _BaseTexture(resource, Object.assign({}, defaultBufferOptions, { type }, options));
|
|
4662
4672
|
}
|
|
4663
4673
|
static addToCache(baseTexture, id) {
|
|
4664
4674
|
if (id) {
|
|
@@ -7027,7 +7037,7 @@ ${this.fragmentSrc}`;
|
|
|
7027
7037
|
const vertexData = element.vertexData;
|
|
7028
7038
|
const textureId = element._texture.baseTexture._batchLocation;
|
|
7029
7039
|
const alpha = Math.min(element.worldAlpha, 1);
|
|
7030
|
-
const argb = Color.shared.setValue(element._tintRGB).toPremultiplied(alpha);
|
|
7040
|
+
const argb = Color.shared.setValue(element._tintRGB).toPremultiplied(alpha, element._texture.baseTexture.alphaMode > 0);
|
|
7031
7041
|
for (let i = 0; i < vertexData.length; i += 2) {
|
|
7032
7042
|
float32View[aIndex++] = vertexData[i];
|
|
7033
7043
|
float32View[aIndex++] = vertexData[i + 1];
|
|
@@ -8840,6 +8850,7 @@ ${this.fragmentSrc}`;
|
|
|
8840
8850
|
this.bind(framebuffer);
|
|
8841
8851
|
gl.bindFramebuffer(gl.READ_FRAMEBUFFER, fbo.framebuffer);
|
|
8842
8852
|
gl.blitFramebuffer(sourcePixels.left, sourcePixels.top, sourcePixels.right, sourcePixels.bottom, destPixels.left, destPixels.top, destPixels.right, destPixels.bottom, gl.COLOR_BUFFER_BIT, sameSize ? gl.NEAREST : gl.LINEAR);
|
|
8853
|
+
gl.bindFramebuffer(gl.READ_FRAMEBUFFER, framebuffer.glFramebuffers[this.CONTEXT_UID].framebuffer);
|
|
8843
8854
|
}
|
|
8844
8855
|
disposeFramebuffer(framebuffer, contextLost) {
|
|
8845
8856
|
const fbo = framebuffer.glFramebuffers[this.CONTEXT_UID];
|
|
@@ -9875,6 +9886,10 @@ ${this.fragmentSrc}`;
|
|
|
9875
9886
|
this.destinationFrame = new Rectangle();
|
|
9876
9887
|
this.viewportFrame = new Rectangle();
|
|
9877
9888
|
}
|
|
9889
|
+
contextChange() {
|
|
9890
|
+
const attributes = this.renderer?.gl.getContextAttributes();
|
|
9891
|
+
this._rendererPremultipliedAlpha = !!(attributes && attributes.alpha && attributes.premultipliedAlpha);
|
|
9892
|
+
}
|
|
9878
9893
|
bind(renderTexture = null, sourceFrame, destinationFrame) {
|
|
9879
9894
|
const renderer = this.renderer;
|
|
9880
9895
|
this.current = renderTexture;
|
|
@@ -9931,7 +9946,10 @@ ${this.fragmentSrc}`;
|
|
|
9931
9946
|
}
|
|
9932
9947
|
clear(clearColor, mask) {
|
|
9933
9948
|
const fallbackColor = this.current ? this.current.baseTexture.clear : this.renderer.background.backgroundColor;
|
|
9934
|
-
const color =
|
|
9949
|
+
const color = Color.shared.setValue(clearColor ? clearColor : fallbackColor);
|
|
9950
|
+
if (this.current && this.current.baseTexture.alphaMode > 0 || !this.current && this._rendererPremultipliedAlpha) {
|
|
9951
|
+
color.premultiply(color.alpha);
|
|
9952
|
+
}
|
|
9935
9953
|
const destinationFrame = this.destinationFrame;
|
|
9936
9954
|
const baseFrame = this.current ? this.current.baseTexture : this.renderer._view.screen;
|
|
9937
9955
|
const clearMask = destinationFrame.width !== baseFrame.width || destinationFrame.height !== baseFrame.height;
|
|
@@ -10400,7 +10418,7 @@ ${this.fragmentSrc}`;
|
|
|
10400
10418
|
const { renderer } = this;
|
|
10401
10419
|
renderer.runners.init.emit(renderer.options);
|
|
10402
10420
|
if (options.hello) {
|
|
10403
|
-
console.log(`PixiJS ${"7.2.
|
|
10421
|
+
console.log(`PixiJS ${"7.2.4"} - ${renderer.rendererLogId} - https://pixijs.com`);
|
|
10404
10422
|
}
|
|
10405
10423
|
renderer.resize(renderer.screen.width, renderer.screen.height);
|
|
10406
10424
|
}
|
|
@@ -12586,7 +12604,7 @@ ${this.fragmentSrc}`;
|
|
|
12586
12604
|
}
|
|
12587
12605
|
}
|
|
12588
12606
|
|
|
12589
|
-
const VERSION = "7.2.
|
|
12607
|
+
const VERSION = "7.2.4";
|
|
12590
12608
|
|
|
12591
12609
|
class Bounds {
|
|
12592
12610
|
constructor() {
|
|
@@ -15285,6 +15303,7 @@ ${this.fragmentSrc}`;
|
|
|
15285
15303
|
return propagationPath;
|
|
15286
15304
|
}
|
|
15287
15305
|
hitTestMoveRecursive(currentTarget, eventMode, location, testFn, pruneFn, ignore = false) {
|
|
15306
|
+
let shouldReturn = false;
|
|
15288
15307
|
if (this._interactivePrune(currentTarget))
|
|
15289
15308
|
return null;
|
|
15290
15309
|
if (currentTarget.eventMode === "dynamic" || eventMode === "dynamic") {
|
|
@@ -15294,7 +15313,7 @@ ${this.fragmentSrc}`;
|
|
|
15294
15313
|
const children = currentTarget.children;
|
|
15295
15314
|
for (let i = children.length - 1; i >= 0; i--) {
|
|
15296
15315
|
const child = children[i];
|
|
15297
|
-
const nestedHit = this.hitTestMoveRecursive(child, this._isInteractive(eventMode) ? eventMode : child.eventMode, location, testFn, pruneFn, pruneFn(currentTarget, location));
|
|
15316
|
+
const nestedHit = this.hitTestMoveRecursive(child, this._isInteractive(eventMode) ? eventMode : child.eventMode, location, testFn, pruneFn, ignore || pruneFn(currentTarget, location));
|
|
15298
15317
|
if (nestedHit) {
|
|
15299
15318
|
if (nestedHit.length > 0 && !nestedHit[nestedHit.length - 1].parent) {
|
|
15300
15319
|
continue;
|
|
@@ -15307,6 +15326,7 @@ ${this.fragmentSrc}`;
|
|
|
15307
15326
|
}
|
|
15308
15327
|
if (this._hitElements.length === 0)
|
|
15309
15328
|
this._hitElements = nestedHit;
|
|
15329
|
+
shouldReturn = true;
|
|
15310
15330
|
}
|
|
15311
15331
|
}
|
|
15312
15332
|
}
|
|
@@ -15316,6 +15336,8 @@ ${this.fragmentSrc}`;
|
|
|
15316
15336
|
this._allInteractiveElements.push(currentTarget);
|
|
15317
15337
|
if (ignore || this._hitElements.length > 0)
|
|
15318
15338
|
return null;
|
|
15339
|
+
if (shouldReturn)
|
|
15340
|
+
return this._hitElements;
|
|
15319
15341
|
if (isInteractiveMode && (!pruneFn(currentTarget, location) && testFn(currentTarget, location))) {
|
|
15320
15342
|
return isInteractiveTarget ? [currentTarget] : [];
|
|
15321
15343
|
}
|
|
@@ -17081,12 +17103,24 @@ ${e}`);
|
|
|
17081
17103
|
"font/woff",
|
|
17082
17104
|
"font/woff2"
|
|
17083
17105
|
];
|
|
17106
|
+
const CSS_IDENT_TOKEN_REGEX = /^(--|-?[A-Z_])[0-9A-Z_-]*$/i;
|
|
17084
17107
|
function getFontFamilyName(url) {
|
|
17085
17108
|
const ext = path.extname(url);
|
|
17086
17109
|
const name = path.basename(url, ext);
|
|
17087
17110
|
const nameWithSpaces = name.replace(/(-|_)/g, " ");
|
|
17088
|
-
const
|
|
17089
|
-
|
|
17111
|
+
const nameTokens = nameWithSpaces.toLowerCase().split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1));
|
|
17112
|
+
let valid = nameTokens.length > 0;
|
|
17113
|
+
for (const token of nameTokens) {
|
|
17114
|
+
if (!token.match(CSS_IDENT_TOKEN_REGEX)) {
|
|
17115
|
+
valid = false;
|
|
17116
|
+
break;
|
|
17117
|
+
}
|
|
17118
|
+
}
|
|
17119
|
+
let fontFamilyName = nameTokens.join(" ");
|
|
17120
|
+
if (!valid) {
|
|
17121
|
+
fontFamilyName = `"${fontFamilyName.replace(/[\\"]/g, "\\$&")}"`;
|
|
17122
|
+
}
|
|
17123
|
+
return fontFamilyName;
|
|
17090
17124
|
}
|
|
17091
17125
|
const loadWebFont = {
|
|
17092
17126
|
extension: {
|
|
@@ -17368,15 +17402,13 @@ ${e}`);
|
|
|
17368
17402
|
},
|
|
17369
17403
|
async parse(asset, data, loader) {
|
|
17370
17404
|
const src = new SVGResource(asset, data?.data?.resourceOptions);
|
|
17405
|
+
await src.load();
|
|
17371
17406
|
const base = new BaseTexture(src, {
|
|
17372
17407
|
resolution: getResolutionOfUrl(asset),
|
|
17373
17408
|
...data?.data
|
|
17374
17409
|
});
|
|
17375
17410
|
base.resource.src = asset;
|
|
17376
17411
|
const texture = createTexture(base, loader, asset);
|
|
17377
|
-
if (!data?.data?.resourceOptions?.autoLoad) {
|
|
17378
|
-
await src.load();
|
|
17379
|
-
}
|
|
17380
17412
|
return texture;
|
|
17381
17413
|
},
|
|
17382
17414
|
async load(url, _options) {
|
|
@@ -18039,26 +18071,32 @@ ${e}`);
|
|
|
18039
18071
|
super(data, options);
|
|
18040
18072
|
this.origin = origin;
|
|
18041
18073
|
this.buffer = data ? new ViewableBuffer(data) : null;
|
|
18042
|
-
|
|
18074
|
+
this._load = null;
|
|
18075
|
+
this.loaded = false;
|
|
18076
|
+
if (this.origin !== null && options.autoLoad !== false) {
|
|
18043
18077
|
this.load();
|
|
18044
18078
|
}
|
|
18045
|
-
if (
|
|
18079
|
+
if (this.origin === null && this.buffer) {
|
|
18080
|
+
this._load = Promise.resolve(this);
|
|
18046
18081
|
this.loaded = true;
|
|
18047
18082
|
this.onBlobLoaded(this.buffer.rawBinaryData);
|
|
18048
18083
|
}
|
|
18049
18084
|
}
|
|
18050
18085
|
onBlobLoaded(_data) {
|
|
18051
18086
|
}
|
|
18052
|
-
|
|
18053
|
-
|
|
18054
|
-
|
|
18055
|
-
|
|
18056
|
-
this.
|
|
18057
|
-
|
|
18058
|
-
|
|
18059
|
-
|
|
18060
|
-
|
|
18061
|
-
|
|
18087
|
+
load() {
|
|
18088
|
+
if (this._load) {
|
|
18089
|
+
return this._load;
|
|
18090
|
+
}
|
|
18091
|
+
this._load = fetch(this.origin).then((response) => response.blob()).then((blob) => blob.arrayBuffer()).then((arrayBuffer) => {
|
|
18092
|
+
this.data = new Uint32Array(arrayBuffer);
|
|
18093
|
+
this.buffer = new ViewableBuffer(arrayBuffer);
|
|
18094
|
+
this.loaded = true;
|
|
18095
|
+
this.onBlobLoaded(arrayBuffer);
|
|
18096
|
+
this.update();
|
|
18097
|
+
return this;
|
|
18098
|
+
});
|
|
18099
|
+
return this._load;
|
|
18062
18100
|
}
|
|
18063
18101
|
}
|
|
18064
18102
|
|
|
@@ -18743,37 +18781,51 @@ ${e}`);
|
|
|
18743
18781
|
}
|
|
18744
18782
|
async base64(target, format, quality) {
|
|
18745
18783
|
const canvas = this.canvas(target);
|
|
18784
|
+
if (canvas.toBlob !== void 0) {
|
|
18785
|
+
return new Promise((resolve, reject) => {
|
|
18786
|
+
canvas.toBlob((blob) => {
|
|
18787
|
+
if (!blob) {
|
|
18788
|
+
reject(new Error("ICanvas.toBlob failed!"));
|
|
18789
|
+
return;
|
|
18790
|
+
}
|
|
18791
|
+
const reader = new FileReader();
|
|
18792
|
+
reader.onload = () => resolve(reader.result);
|
|
18793
|
+
reader.onerror = reject;
|
|
18794
|
+
reader.readAsDataURL(blob);
|
|
18795
|
+
}, format, quality);
|
|
18796
|
+
});
|
|
18797
|
+
}
|
|
18746
18798
|
if (canvas.toDataURL !== void 0) {
|
|
18747
18799
|
return canvas.toDataURL(format, quality);
|
|
18748
18800
|
}
|
|
18749
18801
|
if (canvas.convertToBlob !== void 0) {
|
|
18750
18802
|
const blob = await canvas.convertToBlob({ type: format, quality });
|
|
18751
|
-
return
|
|
18803
|
+
return new Promise((resolve, reject) => {
|
|
18752
18804
|
const reader = new FileReader();
|
|
18753
18805
|
reader.onload = () => resolve(reader.result);
|
|
18806
|
+
reader.onerror = reject;
|
|
18754
18807
|
reader.readAsDataURL(blob);
|
|
18755
18808
|
});
|
|
18756
18809
|
}
|
|
18757
|
-
throw new Error("Extract.base64() requires ICanvas.toDataURL or ICanvas.convertToBlob to be implemented");
|
|
18810
|
+
throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented");
|
|
18758
18811
|
}
|
|
18759
18812
|
canvas(target, frame) {
|
|
18760
18813
|
const { pixels, width, height, flipY } = this._rawPixels(target, frame);
|
|
18761
|
-
let canvasBuffer = new CanvasRenderTarget(width, height, 1);
|
|
18762
|
-
const canvasData = canvasBuffer.context.getImageData(0, 0, width, height);
|
|
18763
|
-
_Extract.arrayPostDivide(pixels, canvasData.data);
|
|
18764
|
-
canvasBuffer.context.putImageData(canvasData, 0, 0);
|
|
18765
18814
|
if (flipY) {
|
|
18766
|
-
|
|
18767
|
-
target2.context.scale(1, -1);
|
|
18768
|
-
target2.context.drawImage(canvasBuffer.canvas, 0, -height);
|
|
18769
|
-
canvasBuffer.destroy();
|
|
18770
|
-
canvasBuffer = target2;
|
|
18815
|
+
_Extract._flipY(pixels, width, height);
|
|
18771
18816
|
}
|
|
18817
|
+
_Extract._unpremultiplyAlpha(pixels);
|
|
18818
|
+
const canvasBuffer = new CanvasRenderTarget(width, height, 1);
|
|
18819
|
+
const imageData = new ImageData(new Uint8ClampedArray(pixels.buffer), width, height);
|
|
18820
|
+
canvasBuffer.context.putImageData(imageData, 0, 0);
|
|
18772
18821
|
return canvasBuffer.canvas;
|
|
18773
18822
|
}
|
|
18774
18823
|
pixels(target, frame) {
|
|
18775
|
-
const { pixels } = this._rawPixels(target, frame);
|
|
18776
|
-
|
|
18824
|
+
const { pixels, width, height, flipY } = this._rawPixels(target, frame);
|
|
18825
|
+
if (flipY) {
|
|
18826
|
+
_Extract._flipY(pixels, width, height);
|
|
18827
|
+
}
|
|
18828
|
+
_Extract._unpremultiplyAlpha(pixels);
|
|
18777
18829
|
return pixels;
|
|
18778
18830
|
}
|
|
18779
18831
|
_rawPixels(target, frame) {
|
|
@@ -18789,19 +18841,10 @@ ${e}`);
|
|
|
18789
18841
|
if (target instanceof RenderTexture) {
|
|
18790
18842
|
renderTexture = target;
|
|
18791
18843
|
} else {
|
|
18792
|
-
|
|
18793
|
-
|
|
18794
|
-
|
|
18795
|
-
|
|
18796
|
-
width: renderTexture.width,
|
|
18797
|
-
height: renderTexture.height
|
|
18798
|
-
});
|
|
18799
|
-
renderer.framebuffer.bind(renderTexture.framebuffer);
|
|
18800
|
-
renderer.framebuffer.blit(resolvedTexture.framebuffer);
|
|
18801
|
-
renderer.framebuffer.bind();
|
|
18802
|
-
renderTexture.destroy(true);
|
|
18803
|
-
renderTexture = resolvedTexture;
|
|
18804
|
-
}
|
|
18844
|
+
renderTexture = renderer.generateTexture(target, {
|
|
18845
|
+
resolution: renderer.resolution,
|
|
18846
|
+
multisample: renderer.multisample
|
|
18847
|
+
});
|
|
18805
18848
|
generated = true;
|
|
18806
18849
|
}
|
|
18807
18850
|
}
|
|
@@ -18809,13 +18852,19 @@ ${e}`);
|
|
|
18809
18852
|
resolution = renderTexture.baseTexture.resolution;
|
|
18810
18853
|
frame = frame ?? renderTexture.frame;
|
|
18811
18854
|
flipY = false;
|
|
18812
|
-
|
|
18855
|
+
if (!generated) {
|
|
18856
|
+
renderer.renderTexture.bind(renderTexture);
|
|
18857
|
+
const fbo = renderTexture.framebuffer.glFramebuffers[renderer.CONTEXT_UID];
|
|
18858
|
+
if (fbo.blitFramebuffer) {
|
|
18859
|
+
renderer.framebuffer.bind(fbo.blitFramebuffer);
|
|
18860
|
+
}
|
|
18861
|
+
}
|
|
18813
18862
|
} else {
|
|
18814
18863
|
resolution = renderer.resolution;
|
|
18815
18864
|
if (!frame) {
|
|
18816
18865
|
frame = TEMP_RECT;
|
|
18817
|
-
frame.width = renderer.width;
|
|
18818
|
-
frame.height = renderer.height;
|
|
18866
|
+
frame.width = renderer.width / resolution;
|
|
18867
|
+
frame.height = renderer.height / resolution;
|
|
18819
18868
|
}
|
|
18820
18869
|
flipY = true;
|
|
18821
18870
|
renderer.renderTexture.bind();
|
|
@@ -18833,17 +18882,30 @@ ${e}`);
|
|
|
18833
18882
|
destroy() {
|
|
18834
18883
|
this.renderer = null;
|
|
18835
18884
|
}
|
|
18836
|
-
static
|
|
18837
|
-
|
|
18838
|
-
|
|
18885
|
+
static _flipY(pixels, width, height) {
|
|
18886
|
+
const w = width << 2;
|
|
18887
|
+
const h = height >> 1;
|
|
18888
|
+
const temp = new Uint8Array(w);
|
|
18889
|
+
for (let y = 0; y < h; y++) {
|
|
18890
|
+
const t = y * w;
|
|
18891
|
+
const b = (height - y - 1) * w;
|
|
18892
|
+
temp.set(pixels.subarray(t, t + w));
|
|
18893
|
+
pixels.copyWithin(t, b, b + w);
|
|
18894
|
+
pixels.set(temp, b);
|
|
18895
|
+
}
|
|
18896
|
+
}
|
|
18897
|
+
static _unpremultiplyAlpha(pixels) {
|
|
18898
|
+
if (pixels instanceof Uint8ClampedArray) {
|
|
18899
|
+
pixels = new Uint8Array(pixels.buffer);
|
|
18900
|
+
}
|
|
18901
|
+
const n = pixels.length;
|
|
18902
|
+
for (let i = 0; i < n; i += 4) {
|
|
18903
|
+
const alpha = pixels[i + 3];
|
|
18839
18904
|
if (alpha !== 0) {
|
|
18840
|
-
|
|
18841
|
-
|
|
18842
|
-
|
|
18843
|
-
|
|
18844
|
-
out[i] = pixels[i];
|
|
18845
|
-
out[i + 1] = pixels[i + 1];
|
|
18846
|
-
out[i + 2] = pixels[i + 2];
|
|
18905
|
+
const a = 255.001 / alpha;
|
|
18906
|
+
pixels[i] = pixels[i] * a + 0.5;
|
|
18907
|
+
pixels[i + 1] = pixels[i + 1] * a + 0.5;
|
|
18908
|
+
pixels[i + 2] = pixels[i + 2] * a + 0.5;
|
|
18847
18909
|
}
|
|
18848
18910
|
}
|
|
18849
18911
|
}
|
|
@@ -21674,7 +21736,7 @@ ${e}`);
|
|
|
21674
21736
|
uploadTint(children, startIndex, amount, array, stride, offset) {
|
|
21675
21737
|
for (let i = 0; i < amount; ++i) {
|
|
21676
21738
|
const sprite = children[startIndex + i];
|
|
21677
|
-
const result = Color.shared.setValue(sprite._tintRGB).toPremultiplied(sprite.alpha);
|
|
21739
|
+
const result = Color.shared.setValue(sprite._tintRGB).toPremultiplied(sprite.alpha, sprite.texture.baseTexture.alphaMode > 0);
|
|
21678
21740
|
array[offset] = result;
|
|
21679
21741
|
array[offset + stride] = result;
|
|
21680
21742
|
array[offset + stride * 2] = result;
|