refactor: fase 3 — Text::bitmap_ a std::vector<Uint8>

- bitmap_: Uint8* (owning, free'd al destructor) → std::vector<Uint8>
- loadBitmap copia des del buffer de LoadGif i fa free(pixels) de
  l'intermedi (gif.h usa malloc internament)
- ~Text() eliminat: regla 0 aplicada (vector es destrueix sol)
- Les 4 comprovacions !bitmap_ → bitmap_.empty()

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-18 13:44:07 +02:00
parent 53e93ef697
commit 2a8fbbb095
2 changed files with 8 additions and 11 deletions

View File

@@ -5,11 +5,11 @@
#include <cstdint>
#include <string>
#include <unordered_map>
#include <vector>
class Text {
public:
Text(const char* fnt_file, const char* gif_file);
~Text();
// Pinta texto sobre un buffer ARGB de 320x200
void draw(Uint32* pixel_data, int x, int y, const char* text, Uint32 color) const;
@@ -46,7 +46,7 @@ class Text {
int cell_spacing_{0};
int row_spacing_{0};
Uint8* bitmap_{nullptr}; // píxels 8-bit del GIF de la font
std::vector<Uint8> bitmap_; // píxels 8-bit del GIF de la font
int bitmap_width_{0};
int bitmap_height_{0};