Fix excessive bottom cropping in atlas generation

(cherry picked from commit fb7ae73045)
This commit is contained in:
Pedro J. Estébanez 2020-06-03 22:24:49 +02:00 committed by Rémi Verschelde
parent 7021991cd9
commit b2a64b144f

View file

@ -137,7 +137,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++) {