diff options
| author | raysan5 <[email protected]> | 2020-04-08 12:37:52 +0200 |
|---|---|---|
| committer | raysan5 <[email protected]> | 2020-04-08 12:37:52 +0200 |
| commit | 0abe557af103046e8cd3c313a7dc3428da0fc14a (patch) | |
| tree | 65debce188f67364eb6524a435d5df137d4e6a82 /src | |
| parent | 6c9f6cf0846c0fcb4374f133adbd3ae67c81811e (diff) | |
| download | raylib-0abe557af103046e8cd3c313a7dc3428da0fc14a.tar.gz raylib-0abe557af103046e8cd3c313a7dc3428da0fc14a.zip | |
Fixed issue with ImageDrawLine()
Diffstat (limited to 'src')
| -rw-r--r-- | src/textures.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/textures.c b/src/textures.c index 0f7f60ce..3071a7de 100644 --- a/src/textures.c +++ b/src/textures.c @@ -2073,9 +2073,9 @@ void ImageDrawCircleV(Image *dst, Vector2 center, int radius, Color color) void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int endPosY, Color color) { int m = 2*(endPosY - startPosY); - int slopeError = m - (startPosY - startPosX); + int slopeError = m - (endPosX - startPosX); - for (int x = startPosX, y = startPosY; x <= startPosY; x++) + for (int x = startPosX, y = startPosY; x <= endPosX; x++) { ImageDrawPixel(dst, x, y, color); slopeError += m; @@ -2083,7 +2083,7 @@ void ImageDrawLine(Image *dst, int startPosX, int startPosY, int endPosX, int en if (slopeError >= 0) { y++; - slopeError -= 2*(startPosY - startPosX); + slopeError -= 2*(endPosX - startPosX); } } } |
