feat: Sistema de pre-escalado de logos con stb_image_resize2
Implementa pre-escalado de alta calidad para eliminar artefactos de escalado dinámico de SDL y mejorar la nitidez visual de los logos. Características: - 4 texturas pre-escaladas (2 logos × 2 resoluciones: base + nativa) - Detección automática de resolución nativa del monitor - Switching dinámico entre texturas al cambiar resolución (F4) - Renderizado 1:1 sin escalado adicional (máxima calidad) - Algoritmo Mitchell en espacio sRGB (balance calidad/velocidad) - Todo en RAM, sin archivos temporales Archivos nuevos: - source/external/stb_image_resize2.h: Biblioteca de escalado stb - source/logo_scaler.h/cpp: Clase helper para pre-escalado Cambios en AppLogo: - Reemplazadas shared_ptr<Texture> por SDL_Texture* raw pointers - initialize(): Pre-escala logos a 2 resoluciones al inicio - updateScreenSize(): Cambia entre texturas según resolución - render(): Simplificado, siempre usa renderWithGeometry() - ~AppLogo(): Libera 4 texturas SDL manualmente El sistema detecta la resolución nativa al inicio y crea versiones optimizadas. Al presionar F4, cambia automáticamente a la textura nativa para calidad perfecta en fullscreen. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -28,7 +28,7 @@ enum class AppLogoAnimationType {
|
||||
class AppLogo {
|
||||
public:
|
||||
AppLogo() = default;
|
||||
~AppLogo() = default;
|
||||
~AppLogo(); // Necesario para liberar las 4 texturas SDL
|
||||
|
||||
// Inicializar textura y sprite del logo
|
||||
bool initialize(SDL_Renderer* renderer, int screen_width, int screen_height);
|
||||
@@ -43,13 +43,33 @@ class AppLogo {
|
||||
void updateScreenSize(int screen_width, int screen_height);
|
||||
|
||||
private:
|
||||
// Texturas y sprites (x2 - logo1 y logo2 superpuestos)
|
||||
std::shared_ptr<Texture> logo1_texture_; // Textura del logo1 (data/logo/logo.png)
|
||||
std::unique_ptr<Sprite> logo1_sprite_; // Sprite para renderizar logo1
|
||||
std::shared_ptr<Texture> logo2_texture_; // Textura del logo2 (data/logo/logo2.png)
|
||||
std::unique_ptr<Sprite> logo2_sprite_; // Sprite para renderizar logo2
|
||||
// ====================================================================
|
||||
// Texturas pre-escaladas (4 texturas: 2 logos × 2 resoluciones)
|
||||
// ====================================================================
|
||||
SDL_Texture* logo1_base_texture_ = nullptr; // Logo1 para resolución base
|
||||
SDL_Texture* logo1_native_texture_ = nullptr; // Logo1 para resolución nativa (F4)
|
||||
SDL_Texture* logo2_base_texture_ = nullptr; // Logo2 para resolución base
|
||||
SDL_Texture* logo2_native_texture_ = nullptr; // Logo2 para resolución nativa (F4)
|
||||
|
||||
// Dimensiones pre-calculadas para cada textura
|
||||
int logo1_base_width_ = 0, logo1_base_height_ = 0;
|
||||
int logo1_native_width_ = 0, logo1_native_height_ = 0;
|
||||
int logo2_base_width_ = 0, logo2_base_height_ = 0;
|
||||
int logo2_native_width_ = 0, logo2_native_height_ = 0;
|
||||
|
||||
// Texturas actualmente en uso (apuntan a base o native según resolución)
|
||||
SDL_Texture* logo1_current_texture_ = nullptr;
|
||||
SDL_Texture* logo2_current_texture_ = nullptr;
|
||||
int logo1_current_width_ = 0, logo1_current_height_ = 0;
|
||||
int logo2_current_width_ = 0, logo2_current_height_ = 0;
|
||||
|
||||
// Resoluciones conocidas
|
||||
int base_screen_width_ = 0, base_screen_height_ = 0; // Resolución inicial
|
||||
int native_screen_width_ = 0, native_screen_height_ = 0; // Resolución nativa (F4)
|
||||
|
||||
// ====================================================================
|
||||
// Variables COMPARTIDAS (sincronización de ambos logos)
|
||||
// ====================================================================
|
||||
AppLogoState state_ = AppLogoState::HIDDEN; // Estado actual de la máquina de estados
|
||||
float timer_ = 0.0f; // Contador de tiempo para estado actual
|
||||
int current_alpha_ = 0; // Alpha actual (0-255)
|
||||
|
||||
Reference in New Issue
Block a user