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:
commit
4e30af287e
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user