From 20a6d9411d43de620c4511b03e48310ff441b39e Mon Sep 17 00:00:00 2001 From: Noel Berry Date: Fri, 28 Oct 2022 12:54:01 -0700 Subject: [PATCH] fix incorrect pixel offset in asset packer trim --- src/blah_packer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/blah_packer.cpp b/src/blah_packer.cpp index 029f3bc..a5fc93d 100644 --- a/src/blah_packer.cpp +++ b/src/blah_packer.cpp @@ -40,7 +40,7 @@ void Packer::add_entry(u64 id, int w, int h, const Color* pixels, const Recti& s // TOP: for (int y = source.y; y < source.y + source.h; y++) - for (int x = source.x, s = y * w; x < source.x + source.w; x++, s++) + for (int x = source.x, s = x + y * w; x < source.x + source.w; x++, s++) if (pixels[s].a > 0) { top = y; @@ -304,4 +304,4 @@ Packer::Node* Packer::Node::reset(const Recti& rect) right = nullptr; down = nullptr; return this; -} \ No newline at end of file +}