1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-26 18:00:16 +02:00

Surface: Minor cleanups.

Removed unused "locked" field.
Inlined format() private method: since "raw" can no longer be NULL, the method became trivial.
This commit is contained in:
Maarten ter Huurne 2011-06-02 22:32:08 +02:00
parent 52f4686e4a
commit 25e8e62622
2 changed files with 1 additions and 10 deletions

View File

@ -84,13 +84,6 @@ Surface::~Surface() {
} }
} }
SDL_PixelFormat *Surface::format() {
if (raw==NULL)
return NULL;
else
return raw->format;
}
void Surface::flip() { void Surface::flip() {
SDL_Flip(raw); SDL_Flip(raw);
} }
@ -134,7 +127,7 @@ int Surface::box(Sint16 x, Sint16 y, Sint16 w, Sint16 h, Uint8 r, Uint8 g, Uint8
} }
int Surface::box(Sint16 x, Sint16 y, Sint16 w, Sint16 h, Uint8 r, Uint8 g, Uint8 b) { int Surface::box(Sint16 x, Sint16 y, Sint16 w, Sint16 h, Uint8 r, Uint8 g, Uint8 b) {
SDL_Rect re = {x,y,w,h}; SDL_Rect re = {x,y,w,h};
return SDL_FillRect(raw, &re, SDL_MapRGBA(format(),r,g,b,255)); return SDL_FillRect(raw, &re, SDL_MapRGBA(raw->format,r,g,b,255));
} }
int Surface::box(Sint16 x, Sint16 y, Sint16 w, Sint16 h, RGBAColor c) { int Surface::box(Sint16 x, Sint16 y, Sint16 w, Sint16 h, RGBAColor c) {
return box(x,y,w,h,c.r,c.g,c.b,c.a); return box(x,y,w,h,c.r,c.g,c.b,c.a);

View File

@ -73,13 +73,11 @@ public:
private: private:
Surface(SDL_Surface *raw, bool freeWhenDone); Surface(SDL_Surface *raw, bool freeWhenDone);
SDL_PixelFormat *format();
bool blit(SDL_Surface *destination, int x, int y, int w=0, int h=0, int a=-1); bool blit(SDL_Surface *destination, int x, int y, int w=0, int h=0, int a=-1);
bool blitCenter(SDL_Surface *destination, int x, int y, int w=0, int h=0, int a=-1); bool blitCenter(SDL_Surface *destination, int x, int y, int w=0, int h=0, int a=-1);
bool blitRight(SDL_Surface *destination, int x, int y, int w=0, int h=0, int a=-1); bool blitRight(SDL_Surface *destination, int x, int y, int w=0, int h=0, int a=-1);
bool freeWhenDone; bool freeWhenDone;
bool locked;
int halfW, halfH; int halfW, halfH;
}; };