mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-13 13:18:43 +02:00
missing prescalefactor
This commit is contained in:
parent
bcdef11093
commit
1f7cec3ae3
@ -102,12 +102,12 @@ SDLImageShared::SDLImageShared(const CDefFile * data, size_t frame, size_t group
|
||||
savePalette();
|
||||
}
|
||||
|
||||
SDLImageShared::SDLImageShared(SDL_Surface * from)
|
||||
SDLImageShared::SDLImageShared(SDL_Surface * from, int preScaleFactor)
|
||||
: surf(nullptr),
|
||||
margins(0, 0),
|
||||
fullSize(0, 0),
|
||||
originalPalette(nullptr),
|
||||
preScaleFactor(1)
|
||||
preScaleFactor(preScaleFactor)
|
||||
{
|
||||
surf = from;
|
||||
if (surf == nullptr)
|
||||
@ -285,7 +285,7 @@ std::shared_ptr<ISharedImage> SDLImageShared::scaleInteger(int factor, SDL_Palet
|
||||
else
|
||||
scaled = CSDL_Ext::scaleSurface(surf, (surf->w / preScaleFactor) * factor, (surf->h / preScaleFactor) * factor);
|
||||
|
||||
auto ret = std::make_shared<SDLImageShared>(scaled);
|
||||
auto ret = std::make_shared<SDLImageShared>(scaled, preScaleFactor);
|
||||
|
||||
ret->fullSize.x = fullSize.x * factor;
|
||||
ret->fullSize.y = fullSize.y * factor;
|
||||
@ -320,7 +320,7 @@ std::shared_ptr<ISharedImage> SDLImageShared::scaleTo(const Point & size, SDL_Pa
|
||||
else
|
||||
CSDL_Ext::setDefaultColorKey(scaled);//just in case
|
||||
|
||||
auto ret = std::make_shared<SDLImageShared>(scaled);
|
||||
auto ret = std::make_shared<SDLImageShared>(scaled, preScaleFactor);
|
||||
|
||||
ret->fullSize.x = (int) round((float)fullSize.x * scaleX);
|
||||
ret->fullSize.y = (int) round((float)fullSize.y * scaleY);
|
||||
@ -378,7 +378,7 @@ std::shared_ptr<IImage> SDLImageShared::createImageReference(EImageBlitMode mode
|
||||
std::shared_ptr<ISharedImage> SDLImageShared::horizontalFlip() const
|
||||
{
|
||||
SDL_Surface * flipped = CSDL_Ext::horizontalFlip(surf);
|
||||
auto ret = std::make_shared<SDLImageShared>(flipped);
|
||||
auto ret = std::make_shared<SDLImageShared>(flipped, preScaleFactor);
|
||||
ret->fullSize = fullSize;
|
||||
ret->margins.x = margins.x;
|
||||
ret->margins.y = fullSize.y - surf->h - margins.y;
|
||||
@ -390,7 +390,7 @@ std::shared_ptr<ISharedImage> SDLImageShared::horizontalFlip() const
|
||||
std::shared_ptr<ISharedImage> SDLImageShared::verticalFlip() const
|
||||
{
|
||||
SDL_Surface * flipped = CSDL_Ext::verticalFlip(surf);
|
||||
auto ret = std::make_shared<SDLImageShared>(flipped);
|
||||
auto ret = std::make_shared<SDLImageShared>(flipped, preScaleFactor);
|
||||
ret->fullSize = fullSize;
|
||||
ret->margins.x = fullSize.x - surf->w - margins.x;
|
||||
ret->margins.y = margins.y;
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
//Load from bitmap file
|
||||
SDLImageShared(const ImagePath & filename, int preScaleFactor=1);
|
||||
//Create using existing surface, extraRef will increase refcount on SDL_Surface
|
||||
SDLImageShared(SDL_Surface * from);
|
||||
SDLImageShared(SDL_Surface * from, int preScaleFactor=1);
|
||||
~SDLImageShared();
|
||||
|
||||
void draw(SDL_Surface * where, SDL_Palette * palette, const Point & dest, const Rect * src, const ColorRGBA & colorMultiplier, uint8_t alpha, EImageBlitMode mode) const override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user