From fd558de9723c3e10dc398874056fdaf4446f9840 Mon Sep 17 00:00:00 2001 From: Giwayume Date: Mon, 22 Nov 2021 11:10:39 -0500 Subject: [PATCH] Fix edge case where 1px cut off from right of image Backward loop should remain -1 (cherry picked from commit 88c1411051462846e15fdd8ed29da59564c11432) --- editor/import/resource_importer_texture_atlas.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp index a7e1986b3f4..115aab70cba 100644 --- a/editor/import/resource_importer_texture_atlas.cpp +++ b/editor/import/resource_importer_texture_atlas.cpp @@ -131,7 +131,7 @@ static void _plot_triangle(Vector2 *vertices, const Vector2 &p_offset, bool p_tr int max_y = MIN(y[2], height - p_offset.y - 1); for (int yi = y[0]; yi < max_y; yi++) { if (yi >= 0) { - for (int xi = (xf > 0 ? int(xf) : 0); xi < (xt < src_width ? xt : src_width - 1); xi++) { + for (int xi = (xf > 0 ? int(xf) : 0); xi < (xt <= src_width ? xt : src_width); xi++) { int px = xi, py = yi; int sx = px, sy = py; sx = CLAMP(sx, 0, src_width - 1);