fix: tidy statics, instance, stretch43, fill/find_if ranges, NOLINT externs

This commit is contained in:
2026-05-16 15:17:38 +02:00
parent ae359f4a1e
commit b984e6041e
15 changed files with 77 additions and 74 deletions
+8 -8
View File
@@ -56,18 +56,18 @@ namespace {
} // namespace
#endif // __EMSCRIPTEN__
std::unique_ptr<Screen> Screen::instance_;
std::unique_ptr<Screen> Screen::instance;
void Screen::init() {
instance_ = std::unique_ptr<Screen>(new Screen());
instance = std::unique_ptr<Screen>(new Screen());
}
void Screen::destroy() {
instance_.reset();
instance.reset();
}
auto Screen::get() -> Screen* {
return instance_.get();
return instance.get();
}
Screen::Screen() {
@@ -178,7 +178,7 @@ void Screen::initShaders() {
shader_backend_->setScalingMode(Options::video.scaling_mode);
shader_backend_->setVSync(Options::video.vsync);
shader_backend_->setTextureFilter(Options::video.texture_filter);
shader_backend_->setStretch4_3(Options::video.aspect_ratio_4_3);
shader_backend_->setStretch43(Options::video.aspect_ratio_4_3);
shader_backend_->setDownscaleAlgo(Options::video.downscale_algo);
if (Options::video.supersampling) {
@@ -346,7 +346,7 @@ auto Screen::toggleSupersampling() -> bool {
void Screen::toggleAspectRatio() {
Options::video.aspect_ratio_4_3 = !Options::video.aspect_ratio_4_3;
if (shader_backend_) {
shader_backend_->setStretch4_3(Options::video.aspect_ratio_4_3);
shader_backend_->setStretch43(Options::video.aspect_ratio_4_3);
} else {
applyFallbackPresentation();
}
@@ -560,7 +560,7 @@ auto Screen::getActiveShaderName() const -> const char* {
}
void Screen::updateRenderInfo() {
static const Uint32 start_ticks = SDL_GetTicks();
static const Uint32 START_TICKS = SDL_GetTicks();
std::string driver = gpu_driver_.empty() ? "sdl" : toLower(gpu_driver_);
// Segment 0: FPS + driver (sempre visible)
@@ -578,7 +578,7 @@ void Screen::updateRenderInfo() {
// Segment 3: hora (només si show_time)
char time_buf[32] = {0};
if (Options::render_info.show_time) {
Uint32 elapsed = SDL_GetTicks() - start_ticks;
Uint32 elapsed = SDL_GetTicks() - START_TICKS;
int minutes = elapsed / 60000;
int seconds = (elapsed / 1000) % 60;
int centis = (elapsed / 10) % 100;
+1 -1
View File
@@ -71,7 +71,7 @@ class Screen {
void applyFallbackPresentation(); // Logical presentation + scale mode per al path SDL_Renderer
void ensureFallbackInternalTexture(); // Recrea internal_texture_sdl_ si cal (fallback path)
static std::unique_ptr<Screen> instance_;
static std::unique_ptr<Screen> instance;
SDL_Window* window_{nullptr};
SDL_Renderer* renderer_{nullptr};
@@ -1286,7 +1286,7 @@ namespace Rendering {
}
}
void SDL3GPUShader::setStretch4_3(bool enabled) {
void SDL3GPUShader::setStretch43(bool enabled) {
stretch_4_3_ = enabled;
if (!is_initialized_ || device_ == nullptr) {
return;
@@ -118,8 +118,8 @@ namespace Rendering {
[[nodiscard]] auto getActiveShader() const -> ShaderType override { return active_shader_; }
// Estirament vertical 4:3 (fusionat amb l'upscale pass)
void setStretch4_3(bool enabled) override;
[[nodiscard]] auto isStretch4_3() const -> bool override { return stretch_4_3_; }
void setStretch43(bool enabled) override;
[[nodiscard]] auto isStretch43() const -> bool override { return stretch_4_3_; }
// Filtre de textura global (sempre aplicat, independent de 4:3)
void setTextureFilter(Options::TextureFilter filter) override {
+2 -2
View File
@@ -171,8 +171,8 @@ namespace Rendering {
* @brief Activa/desactiva estirament vertical 4:3 (200→240 línies efectives).
* Només afecta el viewport, no les textures ni els shaders.
*/
virtual void setStretch4_3(bool /*enabled*/) {}
[[nodiscard]] virtual auto isStretch4_3() const -> bool { return false; }
virtual void setStretch43(bool /*enabled*/) {}
[[nodiscard]] virtual auto isStretch43() const -> bool { return false; }
/**
* @brief Filtre de textura global per a l'upscale final (sempre aplicat).
+1
View File
@@ -12,6 +12,7 @@
// Forward declarations de gif.h (inclòs des de jdraw8.cpp, no es pot incloure dos vegades)
struct rgb;
// NOLINTNEXTLINE(readability-identifier-naming) — exportat per external/gif.h, no controlem el nom.
extern auto LoadGif(unsigned char* data, unsigned short* w, unsigned short* h) -> unsigned char*;
Text::Text(const char* fnt_file, const char* gif_file) {