From 67b3faef0116589a321e9da05f9cbdcd8e51e729 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Fri, 28 Oct 2022 09:01:22 -0700 Subject: [PATCH] Use bbox padding and width consistently --- src/browser/renderer/shared/TextureAtlas.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/browser/renderer/shared/TextureAtlas.ts b/src/browser/renderer/shared/TextureAtlas.ts index d59ee64e..4edebf5c 100644 --- a/src/browser/renderer/shared/TextureAtlas.ts +++ b/src/browser/renderer/shared/TextureAtlas.ts @@ -715,7 +715,7 @@ export class TextureAtlas implements ITextureAtlas { } boundingBox.left = 0; found = false; - for (let x = 0; x < width; x++) { + for (let x = 0; x < padding + width; x++) { for (let y = 0; y < height; y++) { const alphaOffset = y * this._tmpCanvas.width * 4 + x * 4 + 3; if (imageData.data[alphaOffset] !== 0) { @@ -730,7 +730,7 @@ export class TextureAtlas implements ITextureAtlas { } boundingBox.right = width; found = false; - for (let x = padding + width - 1; x >= 0; x--) { + for (let x = padding + width - 1; x >= padding; x--) { for (let y = 0; y < height; y++) { const alphaOffset = y * this._tmpCanvas.width * 4 + x * 4 + 3; if (imageData.data[alphaOffset] !== 0) {