@taole/giftstage 0.1.10 → 0.1.11

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.
@@ -1760,7 +1760,12 @@ const uA = class _A {
1760
1760
  else if (typeof VideoFrame != "undefined" && A instanceof VideoFrame) {
1761
1761
  const r = A;
1762
1762
  I.bindTexture(I.TEXTURE_2D, B), I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL, 1), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, n ? 1 : 0), I.texImage2D(I.TEXTURE_2D, 0, I.RGBA, I.RGBA, I.UNSIGNED_BYTE, r), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL, 0), C = r.displayWidth || r.codedWidth || C, Q = r.displayHeight || r.codedHeight || Q;
1763
- } else A instanceof HTMLVideoElement ? (I.bindTexture(I.TEXTURE_2D, B), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, n ? 1 : 0), this.uploadVideoFrameToTexture(B, A), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), C = A.videoWidth || C, Q = A.videoHeight || Q) : (I.bindTexture(I.TEXTURE_2D, B), I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL, 0), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, n ? 1 : 0), I.texImage2D(I.TEXTURE_2D, 0, I.RGBA, I.RGBA, I.UNSIGNED_BYTE, A), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL, 0), "width" in A && (C = A.width, Q = A.height));
1763
+ } else if (A instanceof HTMLVideoElement)
1764
+ I.bindTexture(I.TEXTURE_2D, B), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, n ? 1 : 0), this.uploadVideoFrameToTexture(B, A), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), C = A.videoWidth || C, Q = A.videoHeight || Q;
1765
+ else {
1766
+ const r = n, E = t.sourcePremultiplied === !0, o = r && !E ? 1 : 0;
1767
+ I.bindTexture(I.TEXTURE_2D, B), I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL, 0), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, o), I.texImage2D(I.TEXTURE_2D, 0, I.RGBA, I.RGBA, I.UNSIGNED_BYTE, A), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL, 0), "width" in A && (C = A.width, Q = A.height);
1768
+ }
1764
1769
  const a = this.nextId++;
1765
1770
  return this.textures.set(a, { texture: B, width: C, height: Q }), { id: a, width: C, height: Q };
1766
1771
  }
@@ -2229,17 +2234,26 @@ class mn {
2229
2234
  var e, g;
2230
2235
  const I = this.gl, s = t.filter === "nearest" ? I.NEAREST : I.LINEAR, B = pn(I, s), n = t.premultiplyAlpha === !0;
2231
2236
  let C = (e = t.width) != null ? e : 1, Q = (g = t.height) != null ? g : 1;
2232
- A instanceof ArrayBuffer ? I.texImage2D(
2233
- I.TEXTURE_2D,
2234
- 0,
2235
- I.RGBA,
2236
- C,
2237
- Q,
2238
- 0,
2239
- I.RGBA,
2240
- I.UNSIGNED_BYTE,
2241
- new Uint8Array(A)
2242
- ) : typeof VideoFrame != "undefined" && A instanceof VideoFrame ? (I.bindTexture(I.TEXTURE_2D, B), I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL, 1), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, n ? 1 : 0), I.texImage2D(I.TEXTURE_2D, 0, I.RGBA, I.RGBA, I.UNSIGNED_BYTE, A), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL, 0), C = A.displayWidth || A.codedWidth || C, Q = A.displayHeight || A.codedHeight || Q) : A instanceof HTMLVideoElement ? (I.bindTexture(I.TEXTURE_2D, B), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, n ? 1 : 0), this.uploadVideoFrameToTexture(B, A), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), C = A.videoWidth || C, Q = A.videoHeight || Q) : (I.bindTexture(I.TEXTURE_2D, B), I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL, 0), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, n ? 1 : 0), I.texImage2D(I.TEXTURE_2D, 0, I.RGBA, I.RGBA, I.UNSIGNED_BYTE, A), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL, 0), "width" in A && (C = A.width, Q = A.height));
2237
+ if (A instanceof ArrayBuffer)
2238
+ I.texImage2D(
2239
+ I.TEXTURE_2D,
2240
+ 0,
2241
+ I.RGBA,
2242
+ C,
2243
+ Q,
2244
+ 0,
2245
+ I.RGBA,
2246
+ I.UNSIGNED_BYTE,
2247
+ new Uint8Array(A)
2248
+ );
2249
+ else if (typeof VideoFrame != "undefined" && A instanceof VideoFrame)
2250
+ I.bindTexture(I.TEXTURE_2D, B), I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL, 1), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, n ? 1 : 0), I.texImage2D(I.TEXTURE_2D, 0, I.RGBA, I.RGBA, I.UNSIGNED_BYTE, A), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL, 0), C = A.displayWidth || A.codedWidth || C, Q = A.displayHeight || A.codedHeight || Q;
2251
+ else if (A instanceof HTMLVideoElement)
2252
+ I.bindTexture(I.TEXTURE_2D, B), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, n ? 1 : 0), this.uploadVideoFrameToTexture(B, A), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), C = A.videoWidth || C, Q = A.videoHeight || Q;
2253
+ else {
2254
+ const r = n, E = t.sourcePremultiplied === !0, o = r && !E ? 1 : 0;
2255
+ I.bindTexture(I.TEXTURE_2D, B), I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL, 0), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, o), I.texImage2D(I.TEXTURE_2D, 0, I.RGBA, I.RGBA, I.UNSIGNED_BYTE, A), I.pixelStorei(I.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0), I.pixelStorei(I.UNPACK_FLIP_Y_WEBGL, 0), "width" in A && (C = A.width, Q = A.height);
2256
+ }
2243
2257
  const a = this.nextId++;
2244
2258
  return this.textures.set(a, { texture: B, width: C, height: Q }), { id: a, width: C, height: Q };
2245
2259
  }
@@ -22082,12 +22096,13 @@ const Qs = class ZA {
22082
22096
  for (const e of A) {
22083
22097
  const g = await createImageBitmap(
22084
22098
  new Blob([e.imageBytes], { type: "image/png" }),
22085
- { premultiplyAlpha: "none" }
22099
+ { premultiplyAlpha: "premultiply" }
22086
22100
  ), I = this.backend.createTexture(g, {
22087
22101
  width: e.width,
22088
22102
  height: e.height,
22089
22103
  filter: "linear",
22090
- premultiplyAlpha: !0
22104
+ premultiplyAlpha: !0,
22105
+ sourcePremultiplied: !0
22091
22106
  });
22092
22107
  g.close(), t.push(I);
22093
22108
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taole/giftstage",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "High-performance WebGPU/WebGL2 gift animation player unifying SVGA, VAP, and AlphaVideo",
5
5
  "type": "module",
6
6
  "main": "dist/gift-stage.cjs.js",