diff options
| author | Ray <[email protected]> | 2021-08-16 23:23:16 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2021-08-16 23:23:16 +0200 |
| commit | a5beb940f8f08d91b33634ca7dc056f07f60f20c (patch) | |
| tree | 00814a4378f05794709171f14fae261ef31dff98 /src/textures.c | |
| parent | f3385b6ad22af53245e20ab3dda10853e1ee95a4 (diff) | |
| download | raylib-a5beb940f8f08d91b33634ca7dc056f07f60f20c.tar.gz raylib-a5beb940f8f08d91b33634ca7dc056f07f60f20c.zip | |
Remove trailing spaces
Diffstat (limited to 'src/textures.c')
| -rw-r--r-- | src/textures.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/textures.c b/src/textures.c index 2480bcfc..6d5c2c5f 100644 --- a/src/textures.c +++ b/src/textures.c @@ -382,7 +382,7 @@ Image LoadImageFromMemory(const char *fileType, const unsigned char *fileData, i if (image.data != NULL) TRACELOG(LOG_INFO, "IMAGE: Data loaded successfully (%ix%i | %s | %i mipmaps)", image.width, image.height, rlGetPixelFormatName(image.format), image.mipmaps); else TRACELOG(LOG_WARNING, "IMAGE: Failed to load image data"); - + return image; } @@ -2419,28 +2419,28 @@ void ImageDrawPixelV(Image *dst, Vector2 position, Color color) // Draw line within an image void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color) { - // Using Bresenham's algorithm as described in + // Using Bresenham's algorithm as described in // Drawing Lines with Pixels - Joshua Scott - March 2012 // https://classic.csunplugged.org/wp-content/uploads/2014/12/Lines.pdf - + int changeInX = (endPosX - startPosX); int absChangeInX = (changeInX < 0)? -changeInX : changeInX; int changeInY = (endPosY - startPosY); int absChangeInY = (changeInY < 0)? -changeInY : changeInY; - + int startU, startV, endU, stepV; // Substitutions, either U = X, V = Y or vice versa. See loop at end of function //int endV; // Not needed but left for better understanding, check code below int A, B, P; // See linked paper above, explained down in the main loop int reversedXY = (absChangeInY < absChangeInX); - - if (reversedXY) + + if (reversedXY) { A = 2*absChangeInY; B = A - 2*absChangeInX; P = A - absChangeInX; if (changeInX > 0) - { + { startU = startPosX; startV = startPosY; endU = endPosX; @@ -2452,23 +2452,23 @@ void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int en startV = endPosY; endU = startPosX; //endV = startPosY; - + // Since start and end are reversed changeInX = -changeInX; changeInY = -changeInY; } - + stepV = (changeInY < 0)? -1 : 1; - + ImageDrawPixel(dst, startU, startV, color); // At this point they are correctly ordered... } else { - A = 2*absChangeInX; + A = 2*absChangeInX; B = A - 2*absChangeInY; P = A - absChangeInY; - - if (changeInY > 0) + + if (changeInY > 0) { startU = startPosY; startV = startPosX; @@ -2481,21 +2481,21 @@ void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int en startV = endPosX; endU = startPosY; //endV = startPosX; - + // Since start and end are reversed changeInX = -changeInX; changeInY = -changeInY; } - + stepV = (changeInX < 0)? -1 : 1; - + ImageDrawPixel(dst, startV, startU, color); // ... but need to be reversed here. Repeated in the main loop below - } - + } + // We already drew the start point. If we started at startU + 0, the line would be crooked and too short - for (int u = startU + 1, v = startV; u <= endU; u++) + for (int u = startU + 1, v = startV; u <= endU; u++) { - if (P >= 0) + if (P >= 0) { v += stepV; // Adjusts whenever we stray too far from the direct line. Details in the linked paper above P += B; // Remembers that we corrected our path |
