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

Surface: Removed duplicate constructor.

There were two constructors that took an image path, skin name and alpha flag
as their arguments, but in different orders. We need only one of them.
This commit is contained in:
Maarten ter Huurne 2011-06-02 04:57:21 +02:00
parent b2896d6bac
commit 52c89d6005
3 changed files with 5 additions and 14 deletions

View File

@ -42,10 +42,9 @@ Surface::Surface() {
dblbuffer = NULL; dblbuffer = NULL;
} }
Surface::Surface(const string &img, bool alpha, const string &skin) { Surface::Surface(Surface *s) {
raw = NULL;
dblbuffer = NULL; dblbuffer = NULL;
load(img, alpha, skin); raw = SDL_DisplayFormat(s->raw);
halfW = raw->w/2; halfW = raw->w/2;
halfH = raw->h/2; halfH = raw->h/2;
} }
@ -58,13 +57,6 @@ Surface::Surface(const string &img, const string &skin, bool alpha) {
halfH = raw->h/2; halfH = raw->h/2;
} }
Surface::Surface(Surface *s) {
dblbuffer = NULL;
raw = SDL_DisplayFormat(s->raw);
halfW = raw->w/2;
halfH = raw->h/2;
}
Surface::~Surface() { Surface::~Surface() {
free(); free();
} }

View File

@ -40,9 +40,8 @@ RGBAColor strtorgba(const string &strColor);
class Surface { class Surface {
public: public:
Surface(); Surface();
Surface(const string &img, const string &skin="", bool alpha=true);
Surface(const string &img, bool alpha, const string &skin="");
Surface(Surface *s); Surface(Surface *s);
Surface(const string &img, const string &skin="", bool alpha=true);
~Surface(); ~Surface();
void enableVirtualDoubleBuffer(SDL_Surface *surface); void enableVirtualDoubleBuffer(SDL_Surface *surface);

View File

@ -80,7 +80,7 @@ Surface *SurfaceCollection::add(const string &path, bool alpha) {
return NULL; return NULL;
} else if (!fileExists(filePath)) return NULL; } else if (!fileExists(filePath)) return NULL;
Surface *s = new Surface(filePath,alpha); Surface *s = new Surface(filePath, "", alpha);
surfaces[path] = s; surfaces[path] = s;
return s; return s;
} }
@ -94,7 +94,7 @@ Surface *SurfaceCollection::addSkinRes(const string &path, bool alpha) {
string skinpath = getSkinFilePath(path); string skinpath = getSkinFilePath(path);
if (skinpath.empty()) if (skinpath.empty())
return NULL; return NULL;
Surface *s = new Surface(skinpath,alpha); Surface *s = new Surface(skinpath, "", alpha);
if (s != NULL) if (s != NULL)
surfaces[path] = s; surfaces[path] = s;
return s; return s;