1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

Merge pull request #5090 from Laserlicht/fix_prescale

fix margin if image prescaled and not equal to current scaling
This commit is contained in:
Ivan Savenko 2024-12-15 13:29:54 +02:00 committed by GitHub
commit 4e30af287e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,6 +19,8 @@
#include "../render/CDefFile.h"
#include "../render/Graphics.h"
#include "../xBRZ/xbrz.h"
#include "../gui/CGuiHandler.h"
#include "../render/IScreenHandler.h"
#include <tbb/parallel_for.h>
#include <SDL_surface.h>
@ -276,6 +278,12 @@ void SDLImageShared::optimizeSurface()
margins.x += left;
margins.y += top;
}
if(preScaleFactor > 1 && preScaleFactor != GH.screenHandler().getScalingFactor())
{
margins.x = margins.x * GH.screenHandler().getScalingFactor() / preScaleFactor;
margins.y = margins.y * GH.screenHandler().getScalingFactor() / preScaleFactor;
}
}
std::shared_ptr<const ISharedImage> SDLImageShared::scaleInteger(int factor, SDL_Palette * palette, EImageBlitMode mode) const