mirror of
https://github.com/vcmi/vcmi.git
synced 2025-02-15 13:33:36 +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();
|
savePalette();
|
||||||
}
|
}
|
||||||
|
|
||||||
SDLImageShared::SDLImageShared(SDL_Surface * from)
|
SDLImageShared::SDLImageShared(SDL_Surface * from, int preScaleFactor)
|
||||||
: surf(nullptr),
|
: surf(nullptr),
|
||||||
margins(0, 0),
|
margins(0, 0),
|
||||||
fullSize(0, 0),
|
fullSize(0, 0),
|
||||||
originalPalette(nullptr),
|
originalPalette(nullptr),
|
||||||
preScaleFactor(1)
|
preScaleFactor(preScaleFactor)
|
||||||
{
|
{
|
||||||
surf = from;
|
surf = from;
|
||||||
if (surf == nullptr)
|
if (surf == nullptr)
|
||||||
@ -285,7 +285,7 @@ std::shared_ptr<ISharedImage> SDLImageShared::scaleInteger(int factor, SDL_Palet
|
|||||||
else
|
else
|
||||||
scaled = CSDL_Ext::scaleSurface(surf, (surf->w / preScaleFactor) * factor, (surf->h / preScaleFactor) * factor);
|
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.x = fullSize.x * factor;
|
||||||
ret->fullSize.y = fullSize.y * factor;
|
ret->fullSize.y = fullSize.y * factor;
|
||||||
@ -320,7 +320,7 @@ std::shared_ptr<ISharedImage> SDLImageShared::scaleTo(const Point & size, SDL_Pa
|
|||||||
else
|
else
|
||||||
CSDL_Ext::setDefaultColorKey(scaled);//just in case
|
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.x = (int) round((float)fullSize.x * scaleX);
|
||||||
ret->fullSize.y = (int) round((float)fullSize.y * scaleY);
|
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
|
std::shared_ptr<ISharedImage> SDLImageShared::horizontalFlip() const
|
||||||
{
|
{
|
||||||
SDL_Surface * flipped = CSDL_Ext::horizontalFlip(surf);
|
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->fullSize = fullSize;
|
||||||
ret->margins.x = margins.x;
|
ret->margins.x = margins.x;
|
||||||
ret->margins.y = fullSize.y - surf->h - margins.y;
|
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
|
std::shared_ptr<ISharedImage> SDLImageShared::verticalFlip() const
|
||||||
{
|
{
|
||||||
SDL_Surface * flipped = CSDL_Ext::verticalFlip(surf);
|
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->fullSize = fullSize;
|
||||||
ret->margins.x = fullSize.x - surf->w - margins.x;
|
ret->margins.x = fullSize.x - surf->w - margins.x;
|
||||||
ret->margins.y = margins.y;
|
ret->margins.y = margins.y;
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
//Load from bitmap file
|
//Load from bitmap file
|
||||||
SDLImageShared(const ImagePath & filename, int preScaleFactor=1);
|
SDLImageShared(const ImagePath & filename, int preScaleFactor=1);
|
||||||
//Create using existing surface, extraRef will increase refcount on SDL_Surface
|
//Create using existing surface, extraRef will increase refcount on SDL_Surface
|
||||||
SDLImageShared(SDL_Surface * from);
|
SDLImageShared(SDL_Surface * from, int preScaleFactor=1);
|
||||||
~SDLImageShared();
|
~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;
|
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