mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-25 21:50:17 +02:00
Surface: Remove alpha flag.
As for SurfaceCollection, the alpha flag passed to the Surface constructor was also always true. Therefore there is no need to have the flag.
This commit is contained in:
parent
44ca4e3460
commit
7877fee3fa
@ -49,10 +49,10 @@ Surface::Surface(Surface *s) {
|
||||
halfH = raw->h/2;
|
||||
}
|
||||
|
||||
Surface::Surface(const string &img, const string &skin, bool alpha) {
|
||||
Surface::Surface(const string &img, const string &skin) {
|
||||
raw = NULL;
|
||||
dblbuffer = NULL;
|
||||
load(img, alpha, skin);
|
||||
load(img, skin);
|
||||
halfW = raw->w/2;
|
||||
halfH = raw->h/2;
|
||||
}
|
||||
@ -78,7 +78,7 @@ SDL_PixelFormat *Surface::format() {
|
||||
return raw->format;
|
||||
}
|
||||
|
||||
void Surface::load(const string &img, bool alpha, const string &skin) {
|
||||
void Surface::load(const string &img, const string &skin) {
|
||||
free();
|
||||
|
||||
string skinpath;
|
||||
@ -92,10 +92,7 @@ void Surface::load(const string &img, bool alpha, const string &skin) {
|
||||
|
||||
SDL_Surface *buf = loadPNG(skinpath);
|
||||
if (buf!=NULL) {
|
||||
if (alpha)
|
||||
raw = SDL_DisplayFormatAlpha(buf);
|
||||
else
|
||||
raw = SDL_DisplayFormat(buf);
|
||||
SDL_FreeSurface(buf);
|
||||
} else {
|
||||
ERROR("Couldn't load surface '%s'\n", img.c_str());
|
||||
|
@ -41,7 +41,7 @@ class Surface {
|
||||
public:
|
||||
Surface();
|
||||
Surface(Surface *s);
|
||||
Surface(const string &img, const string &skin="", bool alpha=true);
|
||||
Surface(const string &img, const string &skin="");
|
||||
~Surface();
|
||||
|
||||
void enableVirtualDoubleBuffer(SDL_Surface *surface);
|
||||
@ -75,7 +75,7 @@ public:
|
||||
|
||||
private:
|
||||
SDL_PixelFormat *format();
|
||||
void load(const string &img, bool alpha=true, const string &skin="");
|
||||
void load(const string &img, const string &skin);
|
||||
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 blitRight(SDL_Surface *destination, int x, int y, int w=0, int h=0, int a=-1);
|
||||
|
@ -80,7 +80,7 @@ Surface *SurfaceCollection::add(const string &path) {
|
||||
return NULL;
|
||||
} else if (!fileExists(filePath)) return NULL;
|
||||
|
||||
Surface *s = new Surface(filePath, "");
|
||||
Surface *s = new Surface(filePath);
|
||||
surfaces[path] = s;
|
||||
return s;
|
||||
}
|
||||
@ -94,7 +94,7 @@ Surface *SurfaceCollection::addSkinRes(const string &path) {
|
||||
string skinpath = getSkinFilePath(path);
|
||||
if (skinpath.empty())
|
||||
return NULL;
|
||||
Surface *s = new Surface(skinpath, "", true);
|
||||
Surface *s = new Surface(skinpath);
|
||||
if (s != NULL)
|
||||
surfaces[path] = s;
|
||||
return s;
|
||||
|
Loading…
Reference in New Issue
Block a user