*SDLCtrl: Fixed problem in inline.

git-svn-id: svn://ultimatepp.org/upp/trunk@3384 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2011-04-28 20:40:20 +00:00
parent f67a9f86f8
commit 801ea8a594
3 changed files with 15 additions and 21 deletions

View file

@ -4,9 +4,7 @@ uses
Core,
CtrlLib;
library(MSC) SDL;
library(GCC WIN32) SDL;
library(WIN32) SDL;
library(LINUX) SDL;

View file

@ -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;};

View file

@ -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);