1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-12-27 11:21:45 +02:00

Surface: Use the destructor as intended.

There is no reason to have an explicit free() method instead of just
destructing the Surface object and doing cleanup in the destructor.
This commit is contained in:
Maarten ter Huurne 2011-06-02 18:15:15 +02:00
parent 0c867aabbf
commit 0a9229ff3f
4 changed files with 2 additions and 13 deletions

View File

@ -327,7 +327,7 @@ GMenu2X::~GMenu2X() {
void GMenu2X::quit() {
fflush(NULL);
sc.clear();
s->free();
free(s);
SDL_Quit();
#ifdef TARGET_GP2X
/* if (gp2x_mem!=0) {

View File

@ -66,10 +66,6 @@ Surface::Surface(const string &img, const string &skin) {
}
Surface::~Surface() {
free();
}
void Surface::free() {
if (freeWhenDone) {
SDL_FreeSurface(raw);
}
@ -83,8 +79,6 @@ SDL_PixelFormat *Surface::format() {
}
void Surface::load(const string &img, const string &skin) {
free();
string skinpath;
if (!skin.empty() && !img.empty() && img[0]!='/') {
skinpath = "skins/"+skin+"/"+img;

View File

@ -47,7 +47,6 @@ public:
SDL_Surface *raw;
void free();
void flip();
void clearClipRect();

View File

@ -109,11 +109,7 @@ void SurfaceCollection::del(const string &path) {
}
void SurfaceCollection::clear() {
while (surfaces.size()>0) {
surfaces.begin()->second->free();
free(surfaces.begin()->second);
surfaces.erase(surfaces.begin());
}
surfaces.clear();
}
void SurfaceCollection::move(const string &from, const string &to) {