mirror of
https://github.com/vcmi/vcmi.git
synced 2025-12-01 23:12:49 +02:00
Moved image scaling & optimization logic to separate classes
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "CursorHardware.h"
|
||||
|
||||
#include "SDL_Extensions.h"
|
||||
#include "SDLImageScaler.h"
|
||||
|
||||
#include "../gui/CGuiHandler.h"
|
||||
#include "../render/IScreenHandler.h"
|
||||
@@ -60,7 +61,10 @@ void CursorHardware::setImage(std::shared_ptr<IImage> image, const Point & pivot
|
||||
CSDL_Ext::fillSurface(cursorSurface, CSDL_Ext::toSDL(Colors::TRANSPARENCY));
|
||||
|
||||
image->draw(cursorSurface, Point(0,0), nullptr, GH.screenHandler().getScalingFactor());
|
||||
auto cursorSurfaceScaled = CSDL_Ext::scaleSurface(cursorSurface, cursorDimensionsScaled.x, cursorDimensionsScaled.y, EScalingAlgorithm::BILINEAR );
|
||||
|
||||
SDLImageScaler scaler(cursorSurface);
|
||||
scaler.scaleSurface(cursorDimensionsScaled, EScalingAlgorithm::BILINEAR);
|
||||
SDL_Surface * cursorSurfaceScaled = scaler.acquireResultSurface();
|
||||
|
||||
auto oldCursor = cursor;
|
||||
cursor = SDL_CreateColorCursor(cursorSurfaceScaled, pivotOffsetScaled.x, pivotOffsetScaled.y);
|
||||
|
||||
Reference in New Issue
Block a user