From 0a28ee8f92031f262f7ee88285dbc47f00936629 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 15 Jan 2010 20:05:49 +0000 Subject: [PATCH] Fixed building under Visual Studio --- VisualC/SDL/SDL.vcproj | 56 +++++++++++++++++++++++++++++++++-- VisualC/SDL/SDL_VS2008.vcproj | 16 ++++++++++ src/SDL_assert.c | 1 + src/video/SDL_drawline.c | 16 +++++++++- 4 files changed, 86 insertions(+), 3 deletions(-) diff --git a/VisualC/SDL/SDL.vcproj b/VisualC/SDL/SDL.vcproj index ff4b645a6..9ae52b1ea 100644 --- a/VisualC/SDL/SDL.vcproj +++ b/VisualC/SDL/SDL.vcproj @@ -26,7 +26,7 @@ + + + + @@ -235,6 +243,10 @@ RelativePath="..\..\include\SDL_config_win32.h" > + + @@ -251,6 +263,10 @@ RelativePath="..\..\include\SDL_events.h" > + + @@ -287,6 +303,10 @@ RelativePath="..\..\include\SDL_opengl.h" > + + @@ -303,14 +323,26 @@ RelativePath="..\..\include\SDL_quit.h" > + + + + + + @@ -424,6 +456,14 @@ RelativePath="..\..\src\video\SDL_alphamult.h" > + + + + @@ -452,6 +492,10 @@ RelativePath="..\..\src\audio\SDL_audiotypecvt.c" > + + @@ -560,6 +604,10 @@ RelativePath="..\..\src\video\SDL_drawpoint.c" > + + @@ -624,6 +672,10 @@ RelativePath="..\..\src\stdlib\SDL_getenv.c" > + + diff --git a/VisualC/SDL/SDL_VS2008.vcproj b/VisualC/SDL/SDL_VS2008.vcproj index bfe8ef5c0..bbf91e43a 100644 --- a/VisualC/SDL/SDL_VS2008.vcproj +++ b/VisualC/SDL/SDL_VS2008.vcproj @@ -370,6 +370,10 @@ RelativePath="..\..\include\SDL.h" > + + @@ -607,6 +611,14 @@ RelativePath="..\..\src\video\SDL_alphamult.h" > + + + + @@ -815,6 +827,10 @@ RelativePath="..\..\src\stdlib\SDL_getenv.c" > + + diff --git a/src/SDL_assert.c b/src/SDL_assert.c index e86811afb..b46b0b756 100644 --- a/src/SDL_assert.c +++ b/src/SDL_assert.c @@ -22,6 +22,7 @@ #include "SDL.h" #include "SDL_assert.h" +#include "video/SDL_sysvideo.h" #ifdef _WINDOWS #define WIN32_LEAN_AND_MEAN 1 diff --git a/src/video/SDL_drawline.c b/src/video/SDL_drawline.c index aa185b34a..f703e7ae6 100644 --- a/src/video/SDL_drawline.c +++ b/src/video/SDL_drawline.c @@ -28,7 +28,21 @@ SDL_DrawLine1(SDL_Surface * dst, int x1, int y1, int x2, int y2, Uint32 color, 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)) {