Fixed TextureAtlas import.

(cherry picked from commit 744c1fafff)
This commit is contained in:
Maurizio Petrarota 2020-02-26 14:35:57 +01:00 committed by Rémi Verschelde
parent 30688769f4
commit 53b4689979
1 changed files with 4 additions and 4 deletions

View File

@ -143,8 +143,8 @@ static void _plot_triangle(Vector2 *vertices, const Vector2 &p_offset, bool p_tr
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); sx = CLAMP(sx, 0, src_width - 1);
sy = CLAMP(sy, 0, src_height); sy = CLAMP(sy, 0, src_height - 1);
Color color = p_src_image->get_pixel(sx, sy); Color color = p_src_image->get_pixel(sx, sy);
if (p_transposed) { if (p_transposed) {
SWAP(px, py); SWAP(px, py);
@ -165,8 +165,8 @@ static void _plot_triangle(Vector2 *vertices, const Vector2 &p_offset, bool p_tr
for (int xi = (xf < width ? int(xf) : width - 1); xi >= (xt > 0 ? xt : 0); xi--) { for (int xi = (xf < width ? int(xf) : width - 1); xi >= (xt > 0 ? xt : 0); 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); sx = CLAMP(sx, 0, src_width - 1);
sy = CLAMP(sy, 0, src_height); sy = CLAMP(sy, 0, src_height - 1);
Color color = p_src_image->get_pixel(sx, sy); Color color = p_src_image->get_pixel(sx, sy);
if (p_transposed) { if (p_transposed) {
SWAP(px, py); SWAP(px, py);