mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-26 03:06:15 +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:
parent
0c867aabbf
commit
0a9229ff3f
@ -327,7 +327,7 @@ GMenu2X::~GMenu2X() {
|
|||||||
void GMenu2X::quit() {
|
void GMenu2X::quit() {
|
||||||
fflush(NULL);
|
fflush(NULL);
|
||||||
sc.clear();
|
sc.clear();
|
||||||
s->free();
|
free(s);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
#ifdef TARGET_GP2X
|
#ifdef TARGET_GP2X
|
||||||
/* if (gp2x_mem!=0) {
|
/* if (gp2x_mem!=0) {
|
||||||
|
@ -66,10 +66,6 @@ Surface::Surface(const string &img, const string &skin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Surface::~Surface() {
|
Surface::~Surface() {
|
||||||
free();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Surface::free() {
|
|
||||||
if (freeWhenDone) {
|
if (freeWhenDone) {
|
||||||
SDL_FreeSurface(raw);
|
SDL_FreeSurface(raw);
|
||||||
}
|
}
|
||||||
@ -83,8 +79,6 @@ SDL_PixelFormat *Surface::format() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Surface::load(const string &img, const string &skin) {
|
void Surface::load(const string &img, const string &skin) {
|
||||||
free();
|
|
||||||
|
|
||||||
string skinpath;
|
string skinpath;
|
||||||
if (!skin.empty() && !img.empty() && img[0]!='/') {
|
if (!skin.empty() && !img.empty() && img[0]!='/') {
|
||||||
skinpath = "skins/"+skin+"/"+img;
|
skinpath = "skins/"+skin+"/"+img;
|
||||||
|
@ -47,7 +47,6 @@ public:
|
|||||||
|
|
||||||
SDL_Surface *raw;
|
SDL_Surface *raw;
|
||||||
|
|
||||||
void free();
|
|
||||||
void flip();
|
void flip();
|
||||||
|
|
||||||
void clearClipRect();
|
void clearClipRect();
|
||||||
|
@ -109,11 +109,7 @@ void SurfaceCollection::del(const string &path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceCollection::clear() {
|
void SurfaceCollection::clear() {
|
||||||
while (surfaces.size()>0) {
|
surfaces.clear();
|
||||||
surfaces.begin()->second->free();
|
|
||||||
free(surfaces.begin()->second);
|
|
||||||
surfaces.erase(surfaces.begin());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SurfaceCollection::move(const string &from, const string &to) {
|
void SurfaceCollection::move(const string &from, const string &to) {
|
||||||
|
Loading…
Reference in New Issue
Block a user