Fix edge case where 1px cut off from right of image

Backward loop should remain -1

(cherry picked from commit 88c1411051)
This commit is contained in:
Giwayume 2021-11-22 11:10:39 -05:00 committed by Rémi Verschelde
parent 27f0a9547f
commit fd558de972
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 1 additions and 1 deletions

View File

@ -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); int max_y = MIN(y[2], height - p_offset.y - 1);
for (int yi = y[0]; yi < max_y; yi++) { for (int yi = y[0]; yi < max_y; yi++) {
if (yi >= 0) { 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 px = xi, py = yi;
int sx = px, sy = py; int sx = px, sy = py;
sx = CLAMP(sx, 0, src_width - 1); sx = CLAMP(sx, 0, src_width - 1);