@esotericsoftware/spine-canvaskit 4.2.86 → 4.2.87

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.
@@ -11590,7 +11590,7 @@ var spine = (() => {
11590
11590
  let numVertices = 0;
11591
11591
  if (attachment instanceof RegionAttachment) {
11592
11592
  let region = attachment;
11593
- positions = positions.length < 8 ? Utils.newFloatArray(8) : positions;
11593
+ if (positions.length < 8) this.scratchPositions = positions = Utils.newFloatArray(8);
11594
11594
  numVertices = 4;
11595
11595
  region.computeWorldVertices(slot, positions, 0, 2);
11596
11596
  triangles = _SkeletonRenderer.QUAD_TRIANGLES;
@@ -11599,7 +11599,8 @@ var spine = (() => {
11599
11599
  attachmentColor = region.color;
11600
11600
  } else if (attachment instanceof MeshAttachment) {
11601
11601
  let mesh = attachment;
11602
- positions = positions.length < mesh.worldVerticesLength ? Utils.newFloatArray(mesh.worldVerticesLength) : positions;
11602
+ if (positions.length < mesh.worldVerticesLength)
11603
+ this.scratchPositions = positions = Utils.newFloatArray(mesh.worldVerticesLength);
11603
11604
  numVertices = mesh.worldVerticesLength >> 1;
11604
11605
  mesh.computeWorldVertices(
11605
11606
  slot,
@@ -11629,9 +11630,18 @@ var spine = (() => {
11629
11630
  triangles.length,
11630
11631
  uvs
11631
11632
  );
11632
- positions = clipper.clippedVertices;
11633
- uvs = clipper.clippedUVs;
11634
- triangles = clipper.clippedTriangles;
11633
+ if (clipper.clippedVertices.length > 0) {
11634
+ if (positions.length < clipper.clippedVertices.length)
11635
+ this.scratchPositions = positions = Utils.newFloatArray(clipper.clippedVertices.length);
11636
+ numVertices = clipper.clippedVertices.length / 2;
11637
+ for (let i2 = 0; i2 < clipper.clippedVertices.length; i2++)
11638
+ positions[i2] = clipper.clippedVertices[i2];
11639
+ uvs = clipper.clippedUVs;
11640
+ triangles = clipper.clippedTriangles;
11641
+ } else {
11642
+ clipper.clipEndWithSlot(slot);
11643
+ continue;
11644
+ }
11635
11645
  }
11636
11646
  let slotColor = slot.color;
11637
11647
  let finalColor = this.tempColor;
@@ -11640,14 +11650,14 @@ var spine = (() => {
11640
11650
  finalColor.b = skeletonColor.b * slotColor.b * attachmentColor.b;
11641
11651
  finalColor.a = skeletonColor.a * slotColor.a * attachmentColor.a;
11642
11652
  if (colors.length / 4 < numVertices)
11643
- colors = Utils.newFloatArray(numVertices * 4);
11653
+ this.scratchColors = colors = Utils.newFloatArray(numVertices * 4);
11644
11654
  for (let i2 = 0, n2 = numVertices * 4; i2 < n2; i2 += 4) {
11645
11655
  colors[i2] = finalColor.r;
11646
11656
  colors[i2 + 1] = finalColor.g;
11647
11657
  colors[i2 + 2] = finalColor.b;
11648
11658
  colors[i2 + 3] = finalColor.a;
11649
11659
  }
11650
- const scaledUvs = this.scratchUVs.length < uvs.length ? Utils.newFloatArray(uvs.length) : this.scratchUVs;
11660
+ const scaledUvs = this.scratchUVs.length < uvs.length ? this.scratchUVs = Utils.newFloatArray(uvs.length) : this.scratchUVs;
11651
11661
  const width = texture.getImage().image.width();
11652
11662
  const height = texture.getImage().image.height();
11653
11663
  for (let i2 = 0; i2 < uvs.length; i2 += 2) {