diff options
author | Giwayume <giwayume@gmail.com> | 2021-11-18 10:05:59 -0500 |
---|---|---|
committer | Giwayume <giwayume@gmail.com> | 2021-11-18 10:05:59 -0500 |
commit | 9432efb7d0605e74ee04e34830dba17ddfa6715b (patch) | |
tree | e547ff42ba5ab5be3b452c9f2134fce86ff401a8 /editor/import | |
parent | 395558c02110f7779ba2881baf083f0ac3b47b47 (diff) |
Fix texture atlas generation when source sprite is larger than generated atlas
Diffstat (limited to 'editor/import')
-rw-r--r-- | editor/import/resource_importer_texture_atlas.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp index 1d59c3627d..3fdf5dd9db 100644 --- a/editor/import/resource_importer_texture_atlas.cpp +++ b/editor/import/resource_importer_texture_atlas.cpp @@ -134,7 +134,7 @@ static void _plot_triangle(Vector2i *vertices, const Vector2i &p_offset, bool p_ 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 < width ? xt : width - 1); xi++) { + for (int xi = (xf > 0 ? int(xf) : 0); xi < (xt < src_width ? xt : src_width - 1); xi++) { int px = xi, py = yi; int sx = px, sy = py; sx = CLAMP(sx, 0, src_width - 1); @@ -156,7 +156,7 @@ static void _plot_triangle(Vector2i *vertices, const Vector2i &p_offset, bool p_ p_image->set_pixel(px, py, color); } - for (int xi = (xf < width ? int(xf) : width - 1); xi >= (xt > 0 ? xt : 0); xi--) { + for (int xi = (xf < src_width ? int(xf) : src_width - 1); xi >= (xt > 0 ? xt : 0); xi--) { int px = xi, py = yi; int sx = px, sy = py; sx = CLAMP(sx, 0, src_width - 1); |