mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 00:47:30 +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;
|
halfH = raw->h/2;
|
||||||
}
|
}
|
||||||
|
|
||||||
Surface::Surface(const string &img, const string &skin, bool alpha) {
|
Surface::Surface(const string &img, const string &skin) {
|
||||||
raw = NULL;
|
raw = NULL;
|
||||||
dblbuffer = NULL;
|
dblbuffer = NULL;
|
||||||
load(img, alpha, skin);
|
load(img, skin);
|
||||||
halfW = raw->w/2;
|
halfW = raw->w/2;
|
||||||
halfH = raw->h/2;
|
halfH = raw->h/2;
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ SDL_PixelFormat *Surface::format() {
|
|||||||
return raw->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();
|
free();
|
||||||
|
|
||||||
string skinpath;
|
string skinpath;
|
||||||
@ -92,10 +92,7 @@ void Surface::load(const string &img, bool alpha, const string &skin) {
|
|||||||
|
|
||||||
SDL_Surface *buf = loadPNG(skinpath);
|
SDL_Surface *buf = loadPNG(skinpath);
|
||||||
if (buf!=NULL) {
|
if (buf!=NULL) {
|
||||||
if (alpha)
|
|
||||||
raw = SDL_DisplayFormatAlpha(buf);
|
raw = SDL_DisplayFormatAlpha(buf);
|
||||||
else
|
|
||||||
raw = SDL_DisplayFormat(buf);
|
|
||||||
SDL_FreeSurface(buf);
|
SDL_FreeSurface(buf);
|
||||||
} else {
|
} else {
|
||||||
ERROR("Couldn't load surface '%s'\n", img.c_str());
|
ERROR("Couldn't load surface '%s'\n", img.c_str());
|
||||||
|
@ -41,7 +41,7 @@ class Surface {
|
|||||||
public:
|
public:
|
||||||
Surface();
|
Surface();
|
||||||
Surface(Surface *s);
|
Surface(Surface *s);
|
||||||
Surface(const string &img, const string &skin="", bool alpha=true);
|
Surface(const string &img, const string &skin="");
|
||||||
~Surface();
|
~Surface();
|
||||||
|
|
||||||
void enableVirtualDoubleBuffer(SDL_Surface *surface);
|
void enableVirtualDoubleBuffer(SDL_Surface *surface);
|
||||||
@ -75,7 +75,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SDL_PixelFormat *format();
|
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 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);
|
||||||
|
@ -80,7 +80,7 @@ Surface *SurfaceCollection::add(const string &path) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
} else if (!fileExists(filePath)) return NULL;
|
} else if (!fileExists(filePath)) return NULL;
|
||||||
|
|
||||||
Surface *s = new Surface(filePath, "");
|
Surface *s = new Surface(filePath);
|
||||||
surfaces[path] = s;
|
surfaces[path] = s;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -94,7 +94,7 @@ Surface *SurfaceCollection::addSkinRes(const string &path) {
|
|||||||
string skinpath = getSkinFilePath(path);
|
string skinpath = getSkinFilePath(path);
|
||||||
if (skinpath.empty())
|
if (skinpath.empty())
|
||||||
return NULL;
|
return NULL;
|
||||||
Surface *s = new Surface(skinpath, "", true);
|
Surface *s = new Surface(skinpath);
|
||||||
if (s != NULL)
|
if (s != NULL)
|
||||||
surfaces[path] = s;
|
surfaces[path] = s;
|
||||||
return s;
|
return s;
|
||||||
|
Loading…
Reference in New Issue
Block a user