- [NEW] Gestió més eficient de la memòria que usen els GIFs

This commit is contained in:
2024-07-02 13:19:16 +02:00
parent 77df278568
commit 2efbf6f717
6 changed files with 68 additions and 36 deletions

View File

@@ -46,7 +46,7 @@ namespace actor
strcpy(act->bmp, bmp.c_str());
act->pos = p;
act->size = s;
act->surface = draw::loadSurface(bmp.c_str());
act->surface = draw::getSurface(bmp.c_str());
act->bmp_rect = r;
act->bmp_offset = o;
act->anim_cycle = act->orient = 0;
@@ -82,7 +82,7 @@ namespace actor
{
actor_t *new_act = createEmptyActor();
actor::templates::copy(new_act, act);
new_act->surface = draw::loadSurface(new_act->bmp);
new_act->surface = draw::getSurface(new_act->bmp);
new_act->prev = new_act->next = new_act->above = new_act->below = nullptr;
return new_act;
}
@@ -109,7 +109,7 @@ namespace actor
} else if (util::strcomp(key, "bmp:")) {
const char *val = file::readString(buffer);
strcpy(t->bmp, val);
t->surface = draw::loadSurface(t->bmp);
t->surface = draw::getSurface(t->bmp);
} else if (util::strcomp(key, "bmp-rect:")) {
t->bmp_rect.x = file::readInt(buffer);
t->bmp_rect.y = file::readInt(buffer);
@@ -1076,7 +1076,7 @@ namespace actor
if (act==first) first = act->next;
if (act==dirty) dirty = act->next;
if (act->next) act->next->prev = act->prev;
draw::freeSurface(act->surface);
//draw::freeSurface(act->surface);
if (act==selected) selected = nullptr;
free(act);
}
@@ -1109,7 +1109,7 @@ namespace actor
if (act->flags & FLAG_HERO) {
hero = act;
} else {
draw::freeSurface(act->surface);
//draw::freeSurface(act->surface);
free(act);
}
act = tmp;
@@ -1122,7 +1122,7 @@ namespace actor
if (act->flags & FLAG_HERO) {
hero = act;
} else {
draw::freeSurface(act->surface);
//draw::freeSurface(act->surface);
free(act);
}
act = tmp;