From 801ea8a594694d2fd52f78dfac2b068cdff69422 Mon Sep 17 00:00:00 2001 From: koldo Date: Thu, 28 Apr 2011 20:40:20 +0000 Subject: [PATCH] *SDLCtrl: Fixed problem in inline. git-svn-id: svn://ultimatepp.org/upp/trunk@3384 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- bazaar/SDL/SDL.upp | 4 +--- bazaar/SDL/SDLCtrl.h | 16 ++++++++++++++-- bazaar/SDL/SDLSurface.cpp | 16 ---------------- 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/bazaar/SDL/SDL.upp b/bazaar/SDL/SDL.upp index 02bf375ff..779fa525a 100644 --- a/bazaar/SDL/SDL.upp +++ b/bazaar/SDL/SDL.upp @@ -4,9 +4,7 @@ uses Core, CtrlLib; -library(MSC) SDL; - -library(GCC WIN32) SDL; +library(WIN32) SDL; library(LINUX) SDL; diff --git a/bazaar/SDL/SDLCtrl.h b/bazaar/SDL/SDLCtrl.h index c4b821056..7289c3286 100644 --- a/bazaar/SDL/SDLCtrl.h +++ b/bazaar/SDL/SDLCtrl.h @@ -26,10 +26,22 @@ public: void DrawCircle(int x, int y, int radius, int thick, Color color); void FillCircle(int x, int y, int radius, Color color); void DrawPixel(int x, int y, Color color); - void DrawPixel(int x, int y, Uint32 scolor); + inline void DrawPixel(int x, int y, Uint32 scolor) { + byte *pixelpos = GetPixelPos(x, y); + if (!pixelpos) + return; + if (surface->format->BytesPerPixel == 1) + *pixelpos = (byte)scolor; + else + memcpy(pixelpos, &scolor, surface->format->BytesPerPixel); + } Color GetPixel(int x, int y); byte GetPixelByte(int x, int y); - byte *GetPixelPos(int x, int y); + inline byte *GetPixelPos(int x, int y) { + if (x < 0 || y < 0|| x >= surface->w || y >= surface->h) + return 0; + return (byte *)surface->pixels + surface->pitch*y + surface->format->BytesPerPixel*x; + } Uint32 GetColor(Color color); int GetBpp() {return surface->format->BitsPerPixel;}; int GetWidth() {return surface->w;}; diff --git a/bazaar/SDL/SDLSurface.cpp b/bazaar/SDL/SDLSurface.cpp index 6b50d7e33..a574e973e 100644 --- a/bazaar/SDL/SDLSurface.cpp +++ b/bazaar/SDL/SDLSurface.cpp @@ -93,12 +93,6 @@ bool SDLSurface::Blit(SDLSurface &surf, Rect source, Rect dest) { return true; } -inline byte *SDLSurface::GetPixelPos(int x, int y) { - if (x < 0 || y < 0|| x >= surface->w || y >= surface->h) - return 0; - return (byte *)surface->pixels + surface->pitch*y + surface->format->BytesPerPixel*x; -} - void SDLSurface::DrawPixel(int x, int y, Color color) { Uint32 scolor = GetColor(color); byte *pixelpos = GetPixelPos(x, y); @@ -106,16 +100,6 @@ void SDLSurface::DrawPixel(int x, int y, Color color) { memcpy(pixelpos, &scolor, surface->format->BytesPerPixel); } -inline void SDLSurface::DrawPixel(int x, int y, Uint32 scolor) { - byte *pixelpos = GetPixelPos(x, y); - if (!pixelpos) - return; - if (surface->format->BytesPerPixel == 1) - *pixelpos = (byte)scolor; - else - memcpy(pixelpos, &scolor, surface->format->BytesPerPixel); -} - Color SDLSurface::GetPixel(int x, int y) { Uint32 scolor; byte *pixelpos = GetPixelPos(x, y);