refactor: fase 2 — elimina malloc/free a jdraw8 i paletes d'escenes
- JD8_Init/Quit: new[]/delete[] per a screen, main_palette, pixel_data
- JD8_NewSurface/FreeSurface: new Uint8[64000]{}/delete[]
- JD8_LoadPalette: uniforme — sempre retorna `new Color[256]`, copiant del
LoadPalette extern al path no-cached (l'intermedi raw es frees amb free()
perquè gif.h el malloca)
- JD8_SetScreenPalette: delete[] la paleta reemplaçada
- slides/secreta/menu/banner/mort scenes: std::free/std::malloc → delete[]/new Color[256]
Ownership uniforme: tot el cicle de vida de surface/palette usa new[]/delete[].
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -37,7 +37,7 @@ namespace {
|
||||
namespace scenes {
|
||||
|
||||
SecretaScene::~SecretaScene() {
|
||||
if (pal_aux_) std::free(pal_aux_);
|
||||
delete[] pal_aux_;
|
||||
// pal_active_ NO s'allibera: propietat de main_palette via SetScreenPalette.
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace scenes {
|
||||
|
||||
gfx_ = SurfaceHandle("gfx/tomba1.gif");
|
||||
pal_aux_ = JD8_LoadPalette("gfx/tomba1.gif");
|
||||
pal_active_ = static_cast<JD8_Palette>(std::malloc(768));
|
||||
pal_active_ = new Color[256];
|
||||
std::memcpy(pal_active_, pal_aux_, 768);
|
||||
|
||||
phase_ = Phase::InitialFadeOut;
|
||||
@@ -62,7 +62,7 @@ namespace scenes {
|
||||
JD8_ClearScreen(255);
|
||||
gfx_.reset("gfx/tomba2.gif");
|
||||
|
||||
std::free(pal_aux_);
|
||||
delete[] pal_aux_;
|
||||
pal_aux_ = JD8_LoadPalette("gfx/tomba2.gif");
|
||||
// pal_active_ continua sent el mateix buffer: només actualitzem
|
||||
// el seu contingut. main_palette ja apunta ací.
|
||||
|
||||
Reference in New Issue
Block a user