@esotericsoftware/spine-pixi-v8 4.2.93 → 4.2.94
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.
|
@@ -5806,7 +5806,7 @@ var spine = (() => {
|
|
|
5806
5806
|
return blob ? createImageBitmap(blob, { premultiplyAlpha: "none", colorSpaceConversion: "none" }) : null;
|
|
5807
5807
|
}).then((bitmap) => {
|
|
5808
5808
|
if (bitmap) {
|
|
5809
|
-
const texture = this.
|
|
5809
|
+
const texture = this.createTexture(path2, bitmap);
|
|
5810
5810
|
this.success(success, path2, texture);
|
|
5811
5811
|
resolve(texture);
|
|
5812
5812
|
}
|
|
@@ -5816,7 +5816,7 @@ var spine = (() => {
|
|
|
5816
5816
|
let image = new Image();
|
|
5817
5817
|
image.crossOrigin = "anonymous";
|
|
5818
5818
|
image.onload = () => {
|
|
5819
|
-
const texture = this.
|
|
5819
|
+
const texture = this.createTexture(path2, image);
|
|
5820
5820
|
this.success(success, path2, texture);
|
|
5821
5821
|
resolve(texture);
|
|
5822
5822
|
};
|
|
@@ -5840,7 +5840,7 @@ var spine = (() => {
|
|
|
5840
5840
|
this.cache.assetsLoaded[path2] = new Promise((resolve, reject) => {
|
|
5841
5841
|
this.downloader.downloadText(path2, (atlasText) => {
|
|
5842
5842
|
try {
|
|
5843
|
-
|
|
5843
|
+
const atlas = this.createTextureAtlas(path2, atlasText);
|
|
5844
5844
|
let toLoad = atlas.pages.length, abort = false;
|
|
5845
5845
|
for (let page of atlas.pages) {
|
|
5846
5846
|
this.loadTexture(
|
|
@@ -5884,7 +5884,7 @@ var spine = (() => {
|
|
|
5884
5884
|
this.cache.assetsLoaded[path2] = new Promise((resolve, reject) => {
|
|
5885
5885
|
this.downloader.downloadText(path2, (atlasText) => {
|
|
5886
5886
|
try {
|
|
5887
|
-
const atlas =
|
|
5887
|
+
const atlas = this.createTextureAtlas(path2, atlasText);
|
|
5888
5888
|
this.success(success, path2, atlas);
|
|
5889
5889
|
resolve(atlas);
|
|
5890
5890
|
} catch (e) {
|
|
@@ -5990,9 +5990,12 @@ var spine = (() => {
|
|
|
5990
5990
|
}
|
|
5991
5991
|
// dispose asset only if it's not used by others
|
|
5992
5992
|
disposeAsset(path2) {
|
|
5993
|
-
|
|
5994
|
-
|
|
5993
|
+
const asset = this.cache.assets[path2];
|
|
5994
|
+
if (asset instanceof TextureAtlas) {
|
|
5995
|
+
asset.dispose();
|
|
5996
|
+
return;
|
|
5995
5997
|
}
|
|
5998
|
+
this.disposeAssetInternal(path2);
|
|
5996
5999
|
}
|
|
5997
6000
|
hasErrors() {
|
|
5998
6001
|
return Object.keys(this.errors).length > 0;
|
|
@@ -6000,6 +6003,30 @@ var spine = (() => {
|
|
|
6000
6003
|
getErrors() {
|
|
6001
6004
|
return this.errors;
|
|
6002
6005
|
}
|
|
6006
|
+
disposeAssetInternal(path2) {
|
|
6007
|
+
if (this.cache.assetsRefCount[path2] > 0 && --this.cache.assetsRefCount[path2] === 0) {
|
|
6008
|
+
return this.remove(path2);
|
|
6009
|
+
}
|
|
6010
|
+
}
|
|
6011
|
+
createTextureAtlas(path2, atlasText) {
|
|
6012
|
+
const atlas = new TextureAtlas(atlasText);
|
|
6013
|
+
atlas.dispose = () => {
|
|
6014
|
+
if (this.cache.assetsRefCount[path2] <= 0) return;
|
|
6015
|
+
this.disposeAssetInternal(path2);
|
|
6016
|
+
for (const page of atlas.pages) {
|
|
6017
|
+
page.texture?.dispose();
|
|
6018
|
+
}
|
|
6019
|
+
};
|
|
6020
|
+
return atlas;
|
|
6021
|
+
}
|
|
6022
|
+
createTexture(path2, image) {
|
|
6023
|
+
const texture = this.textureLoader(image);
|
|
6024
|
+
const textureDispose = texture.dispose.bind(texture);
|
|
6025
|
+
texture.dispose = () => {
|
|
6026
|
+
if (this.disposeAssetInternal(path2)) textureDispose();
|
|
6027
|
+
};
|
|
6028
|
+
return texture;
|
|
6029
|
+
}
|
|
6003
6030
|
};
|
|
6004
6031
|
var AssetCache = class _AssetCache {
|
|
6005
6032
|
assets = {};
|