From a6c985c4f57860d2ee307ecfd1c8f5c3f46cee11 Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Wed, 13 Nov 2024 23:10:41 +0100 Subject: [PATCH] code review --- client/renderSDL/RenderHandler.cpp | 6 +++--- client/renderSDL/SDLImage.cpp | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/client/renderSDL/RenderHandler.cpp b/client/renderSDL/RenderHandler.cpp index 72076ab97..7e052eb11 100644 --- a/client/renderSDL/RenderHandler.cpp +++ b/client/renderSDL/RenderHandler.cpp @@ -246,9 +246,9 @@ std::shared_ptr RenderHandler::loadImageFromFileUncached(const Ima if(!defFile) // no prescale for this frame { auto tmpPath = (*locator.defFile).getName(); - boost::algorithm::replace_all(tmpPath, "2X/", "/"); - boost::algorithm::replace_all(tmpPath, "3X/", "/"); - boost::algorithm::replace_all(tmpPath, "4X/", "/"); + boost::algorithm::replace_all(tmpPath, "SPRITES2X/", "SPRITES/"); + boost::algorithm::replace_all(tmpPath, "SPRITES3X/", "SPRITES/"); + boost::algorithm::replace_all(tmpPath, "SPRITES4X/", "SPRITES/"); preScaledFactor = 1; defFile = getAnimationFile(AnimationPath::builtin(tmpPath)); } diff --git a/client/renderSDL/SDLImage.cpp b/client/renderSDL/SDLImage.cpp index d4236436f..d74024a55 100644 --- a/client/renderSDL/SDLImage.cpp +++ b/client/renderSDL/SDLImage.cpp @@ -279,7 +279,10 @@ std::shared_ptr SDLImageShared::scaleInteger(int factor, SDL_Palet SDL_Surface * scaled = nullptr; if(preScaleFactor == factor) - scaled = CSDL_Ext::scaleSurfaceIntegerFactor(surf, 1, EScalingAlgorithm::NEAREST); // keep size + { + scaled = CSDL_Ext::newSurface(Point(surf->w, surf->h), surf); + SDL_BlitSurface(surf, nullptr, scaled, nullptr); + } else if(preScaleFactor == 1) scaled = CSDL_Ext::scaleSurfaceIntegerFactor(surf, factor, EScalingAlgorithm::XBRZ); else