summaryrefslogtreecommitdiff
path: root/editor/import
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2020-06-03 22:24:49 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2020-06-03 22:24:49 +0200
commitfb7ae73045a0b456c971c26c3c0aa1203aa9a9d7 (patch)
treec673d0988f76ad8aa40f4da11cc5088de3c7d19e /editor/import
parentdc67d0737b86c7a6cab66752b96631c59c703997 (diff)
Fix excessive bottom cropping in atlas generation
Diffstat (limited to 'editor/import')
-rw-r--r--editor/import/resource_importer_texture_atlas.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/editor/import/resource_importer_texture_atlas.cpp b/editor/import/resource_importer_texture_atlas.cpp
index 2848d13160..2423553d22 100644
--- a/editor/import/resource_importer_texture_atlas.cpp
+++ b/editor/import/resource_importer_texture_atlas.cpp
@@ -130,7 +130,8 @@ static void _plot_triangle(Vector2 *vertices, const Vector2 &p_offset, bool p_tr
double dx_low = double(x[2] - x[1]) / (y[2] - y[1] + 1);
double xf = x[0];
double xt = x[0] + dx_upper; // if y[0] == y[1], special case
- for (int yi = y[0]; yi <= (y[2] > height - 1 ? height - 1 : y[2]); yi++) {
+ 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++) {
int px = xi, py = yi;