mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
*SDLCtrl: Fixed problem in inline.
git-svn-id: svn://ultimatepp.org/upp/trunk@3384 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
f67a9f86f8
commit
801ea8a594
3 changed files with 15 additions and 21 deletions
|
|
@ -4,9 +4,7 @@ uses
|
|||
Core,
|
||||
CtrlLib;
|
||||
|
||||
library(MSC) SDL;
|
||||
|
||||
library(GCC WIN32) SDL;
|
||||
library(WIN32) SDL;
|
||||
|
||||
library(LINUX) SDL;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;};
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue