From 144fc380d035b71dc45a6ffc4231322bac817ba5 Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Tue, 7 Apr 2026 17:43:38 +0200 Subject: [PATCH] eliminat el path de borde multicolor --- source/core/rendering/screen.cpp | 39 ++++++++++++-------------------- source/core/rendering/screen.hpp | 4 +--- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/source/core/rendering/screen.cpp b/source/core/rendering/screen.cpp index 1c5e7ee..fd33f13 100644 --- a/source/core/rendering/screen.cpp +++ b/source/core/rendering/screen.cpp @@ -90,10 +90,8 @@ Screen::Screen() { border_surface_, [this]() { // Actualizar caché ARGB del borde cuando cambia la paleta - if (border_is_solid_) { - border_surface_->toARGBBuffer(border_pixel_buffer_.data()); - border_argb_color_ = border_pixel_buffer_[0]; - } + border_surface_->toARGBBuffer(border_pixel_buffer_.data()); + border_argb_color_ = border_pixel_buffer_[0]; }); // Cachear el color ARGB inicial del borde (borde sólido por defecto) @@ -221,7 +219,6 @@ void Screen::setBorderColor(Uint8 color) { // Actualizar caché ARGB del borde sólido (ocurre una vez por habitación, no cada frame) border_surface_->toARGBBuffer(border_pixel_buffer_.data()); border_argb_color_ = border_pixel_buffer_[0]; - border_is_solid_ = true; } // Cambia entre borde visible y no visible @@ -397,27 +394,20 @@ void Screen::textureToRenderer() { const int OFF_X = static_cast(game_surface_dstrect_.x); const int OFF_Y = static_cast(game_surface_dstrect_.y); - if (border_is_solid_) { - // Path A: borde sólido (gameplay normal) - // Rellena solo el marco con el color cacheado — sin lookups de paleta. - // El área central (juego) se deja sin tocar; el overlay la sobreescribe igualmente. + // Rellena solo el marco con el color cacheado — sin lookups de paleta. + // El área central (juego) se deja sin tocar; el overlay la sobreescribe igualmente. - // Franjas superior e inferior (ancho completo) - std::fill_n(border_pixel_buffer_.data(), OFF_Y * BORDER_W, border_argb_color_); - std::fill_n(&border_pixel_buffer_[(OFF_Y + GAME_H) * BORDER_W], - (BORDER_H - OFF_Y - GAME_H) * BORDER_W, + // Franjas superior e inferior (ancho completo) + std::fill_n(border_pixel_buffer_.data(), OFF_Y * BORDER_W, border_argb_color_); + std::fill_n(&border_pixel_buffer_[(OFF_Y + GAME_H) * BORDER_W], + (BORDER_H - OFF_Y - GAME_H) * BORDER_W, + border_argb_color_); + // Columnas laterales en las filas del área de juego + for (int y = OFF_Y; y < OFF_Y + GAME_H; ++y) { + std::fill_n(&border_pixel_buffer_[y * BORDER_W], OFF_X, border_argb_color_); + std::fill_n(&border_pixel_buffer_[(y * BORDER_W) + OFF_X + GAME_W], + BORDER_W - OFF_X - GAME_W, border_argb_color_); - // Columnas laterales en las filas del área de juego - for (int y = OFF_Y; y < OFF_Y + GAME_H; ++y) { - std::fill_n(&border_pixel_buffer_[y * BORDER_W], OFF_X, border_argb_color_); - std::fill_n(&border_pixel_buffer_[(y * BORDER_W) + OFF_X + GAME_W], - BORDER_W - OFF_X - GAME_W, - border_argb_color_); - } - } else { - // Path B: borde dinámico (escena de carga — bandas de colores animadas) - // Conversión completa: la escena modifica border_surface_ cada frame - border_surface_->toARGBBuffer(border_pixel_buffer_.data()); } // Overlay del juego sobre el centro del buffer (ambos paths) @@ -508,7 +498,6 @@ auto Screen::getRenderer() -> SDL_Renderer* { return renderer_; } auto Screen::getRendererSurface() -> std::shared_ptr { return (*renderer_surface_); } auto Screen::getGameSurface() -> std::shared_ptr { return game_surface_; } auto Screen::getBorderSurface() -> std::shared_ptr { - border_is_solid_ = false; // Modificación externa → modo borde dinámico return border_surface_; } diff --git a/source/core/rendering/screen.hpp b/source/core/rendering/screen.hpp index a0801f0..61ff3b1 100644 --- a/source/core/rendering/screen.hpp +++ b/source/core/rendering/screen.hpp @@ -164,9 +164,7 @@ class Screen { std::vector game_pixel_buffer_; // Textura de juego std::vector border_pixel_buffer_; // Textura de borde (composición final borde+juego) - // Caché del borde sólido (gameplay normal) - bool border_is_solid_{true}; // true = borde de color sólido; false = borde dinámico (carga) - Uint32 border_argb_color_{0}; // Color ARGB pre-convertido del borde sólido + Uint32 border_argb_color_{0}; // Color ARGB pre-convertido del borde // Configuración de ventana y pantalla int window_width_{0}; // Ancho de la pantalla o ventana