Mercurial > sdl-ios-xcode
diff src/video/SDL_drawline.c @ 3671:0d6f520c0eb9
Fixed building under Visual Studio
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 15 Jan 2010 20:05:49 +0000 |
parents | f638ded38b8a |
children | f7b03b6838cb |
line wrap: on
line diff
--- a/src/video/SDL_drawline.c Wed Jan 13 19:29:33 2010 +0000 +++ b/src/video/SDL_drawline.c Fri Jan 15 20:05:49 2010 +0000 @@ -28,7 +28,21 @@ SDL_bool draw_end) { if (y1 == y2) { - HLINE(Uint8, DRAW_FASTSETPIXEL1, draw_end); + //HLINE(Uint8, DRAW_FASTSETPIXEL1, draw_end); + int length; + int pitch = (dst->pitch / dst->format->BytesPerPixel); + Uint8 *pixel; + if (x1 <= x2) { + pixel = (Uint8 *)dst->pixels + y1 * pitch + x1; + length = draw_end ? (x2-x1+1) : (x2-x1); + } else { + pixel = (Uint8 *)dst->pixels + y1 * pitch + x2; + if (!draw_end) { + ++pixel; + } + length = draw_end ? (x1-x2+1) : (x1-x2); + } + SDL_memset(pixel, color, length); } else if (x1 == x2) { VLINE(Uint8, DRAW_FASTSETPIXEL1, draw_end); } else if (ABS(x1 - x2) == ABS(y1 - y2)) {