Mercurial > sdl-ios-xcode
comparison 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 |
comparison
equal
deleted
inserted
replaced
3670:62b6a5b99918 | 3671:0d6f520c0eb9 |
---|---|
26 static void | 26 static void |
27 SDL_DrawLine1(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color, | 27 SDL_DrawLine1(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color, |
28 SDL_bool draw_end) | 28 SDL_bool draw_end) |
29 { | 29 { |
30 if (y1 == y2) { | 30 if (y1 == y2) { |
31 HLINE(Uint8, DRAW_FASTSETPIXEL1, draw_end); | 31 //HLINE(Uint8, DRAW_FASTSETPIXEL1, draw_end); |
32 int length; | |
33 int pitch = (dst->pitch / dst->format->BytesPerPixel); | |
34 Uint8 *pixel; | |
35 if (x1 <= x2) { | |
36 pixel = (Uint8 *)dst->pixels + y1 * pitch + x1; | |
37 length = draw_end ? (x2-x1+1) : (x2-x1); | |
38 } else { | |
39 pixel = (Uint8 *)dst->pixels + y1 * pitch + x2; | |
40 if (!draw_end) { | |
41 ++pixel; | |
42 } | |
43 length = draw_end ? (x1-x2+1) : (x1-x2); | |
44 } | |
45 SDL_memset(pixel, color, length); | |
32 } else if (x1 == x2) { | 46 } else if (x1 == x2) { |
33 VLINE(Uint8, DRAW_FASTSETPIXEL1, draw_end); | 47 VLINE(Uint8, DRAW_FASTSETPIXEL1, draw_end); |
34 } else if (ABS(x1 - x2) == ABS(y1 - y2)) { | 48 } else if (ABS(x1 - x2) == ABS(y1 - y2)) { |
35 DLINE(Uint8, DRAW_FASTSETPIXEL1, draw_end); | 49 DLINE(Uint8, DRAW_FASTSETPIXEL1, draw_end); |
36 } else { | 50 } else { |