diff --git a/src/rtextures.c b/src/rtextures.c index 3b9baea82..f33709ded 100644 --- a/src/rtextures.c +++ b/src/rtextures.c @@ -3632,10 +3632,10 @@ void ImageDrawTriangle(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color col { // Calculate the 2D bounding box of the triangle // Determine the minimum and maximum x and y coordinates of the triangle vertices - int xMin = (int)((v1.x < v2.x) ? ((v1.x < v3.x) ? v1.x : v3.x) : ((v2.x < v3.x) ? v2.x : v3.x)); - int yMin = (int)((v1.y < v2.y) ? ((v1.y < v3.y) ? v1.y : v3.y) : ((v2.y < v3.y) ? v2.y : v3.y)); - int xMax = (int)((v1.x > v2.x) ? ((v1.x > v3.x) ? v1.x : v3.x) : ((v2.x > v3.x) ? v2.x : v3.x)); - int yMax = (int)((v1.y > v2.y) ? ((v1.y > v3.y) ? v1.y : v3.y) : ((v2.y > v3.y) ? v2.y : v3.y)); + int xMin = (int)((v1.x < v2.x)? ((v1.x < v3.x) ? v1.x : v3.x) : ((v2.x < v3.x) ? v2.x : v3.x)); + int yMin = (int)((v1.y < v2.y)? ((v1.y < v3.y) ? v1.y : v3.y) : ((v2.y < v3.y) ? v2.y : v3.y)); + int xMax = (int)((v1.x > v2.x)? ((v1.x > v3.x) ? v1.x : v3.x) : ((v2.x > v3.x) ? v2.x : v3.x)); + int yMax = (int)((v1.y > v2.y)? ((v1.y > v3.y) ? v1.y : v3.y) : ((v2.y > v3.y) ? v2.y : v3.y)); // Clamp the bounding box to the image dimensions if (xMin < 0) xMin = 0; @@ -3730,9 +3730,9 @@ void ImageDrawTriangleEx(Image *dst, Vector2 v1, Vector2 v2, Vector2 v3, Color c } // Calculate the initial barycentric coordinates for the top-left point of the bounding box - int w1Row = (int)((xMin - v2.x) * w1XStep + w1YStep * (yMin - v2.y)); - int w2Row = (int)((xMin - v3.x) * w2XStep + w2YStep * (yMin - v3.y)); - int w3Row = (int)((xMin - v1.x) * w3XStep + w3YStep * (yMin - v1.y)); + int w1Row = (int)((xMin - v2.x)*w1XStep + w1YStep*(yMin - v2.y)); + int w2Row = (int)((xMin - v3.x)*w2XStep + w2YStep*(yMin - v3.y)); + int w3Row = (int)((xMin - v1.x)*w3XStep + w3YStep*(yMin - v1.y)); // Calculate the inverse of the sum of the barycentric coordinates for normalization // NOTE 1: Here, we act as if we multiply by 255 the reciprocal, which avoids additional