mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2025-04-21 12:27:27 +03: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:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -47,7 +47,6 @@ public:
|
||||
|
||||
SDL_Surface *raw;
|
||||
|
||||
void free();
|
||||
void flip();
|
||||
|
||||
void clearClipRect();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user