mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-17 20:58:07 +02:00
rename variable
This commit is contained in:
parent
7c3afde7ee
commit
bcdef11093
@ -89,12 +89,12 @@ int IImage::height() const
|
||||
return dimensions().y;
|
||||
}
|
||||
|
||||
SDLImageShared::SDLImageShared(const CDefFile * data, size_t frame, size_t group, int scaleFactor)
|
||||
SDLImageShared::SDLImageShared(const CDefFile * data, size_t frame, size_t group, int preScaleFactor)
|
||||
: surf(nullptr),
|
||||
margins(0, 0),
|
||||
fullSize(0, 0),
|
||||
originalPalette(nullptr),
|
||||
scaleFactor(scaleFactor)
|
||||
preScaleFactor(preScaleFactor)
|
||||
{
|
||||
SDLImageLoader loader(this);
|
||||
data->loadFrame(frame, group, loader);
|
||||
@ -107,7 +107,7 @@ SDLImageShared::SDLImageShared(SDL_Surface * from)
|
||||
margins(0, 0),
|
||||
fullSize(0, 0),
|
||||
originalPalette(nullptr),
|
||||
scaleFactor(1)
|
||||
preScaleFactor(1)
|
||||
{
|
||||
surf = from;
|
||||
if (surf == nullptr)
|
||||
@ -120,12 +120,12 @@ SDLImageShared::SDLImageShared(SDL_Surface * from)
|
||||
fullSize.y = surf->h;
|
||||
}
|
||||
|
||||
SDLImageShared::SDLImageShared(const ImagePath & filename, int scaleFactor)
|
||||
SDLImageShared::SDLImageShared(const ImagePath & filename, int preScaleFactor)
|
||||
: surf(nullptr),
|
||||
margins(0, 0),
|
||||
fullSize(0, 0),
|
||||
originalPalette(nullptr),
|
||||
scaleFactor(scaleFactor)
|
||||
preScaleFactor(preScaleFactor)
|
||||
{
|
||||
surf = BitmapHandler::loadBitmap(filename);
|
||||
|
||||
@ -278,12 +278,12 @@ std::shared_ptr<ISharedImage> SDLImageShared::scaleInteger(int factor, SDL_Palet
|
||||
SDL_SetSurfacePalette(surf, palette);
|
||||
|
||||
SDL_Surface * scaled = nullptr;
|
||||
if(scaleFactor == factor)
|
||||
if(preScaleFactor == factor)
|
||||
scaled = CSDL_Ext::scaleSurfaceIntegerFactor(surf, 1, EScalingAlgorithm::NEAREST); // keep size
|
||||
else if(scaleFactor == 1)
|
||||
else if(preScaleFactor == 1)
|
||||
scaled = CSDL_Ext::scaleSurfaceIntegerFactor(surf, factor, EScalingAlgorithm::XBRZ);
|
||||
else
|
||||
scaled = CSDL_Ext::scaleSurface(surf, (surf->w / scaleFactor) * factor, (surf->h / scaleFactor) * factor);
|
||||
scaled = CSDL_Ext::scaleSurface(surf, (surf->w / preScaleFactor) * factor, (surf->h / preScaleFactor) * factor);
|
||||
|
||||
auto ret = std::make_shared<SDLImageShared>(scaled);
|
||||
|
||||
@ -364,7 +364,7 @@ bool SDLImageShared::isTransparent(const Point & coords) const
|
||||
|
||||
Point SDLImageShared::dimensions() const
|
||||
{
|
||||
return fullSize / scaleFactor;
|
||||
return fullSize / preScaleFactor;
|
||||
}
|
||||
|
||||
std::shared_ptr<IImage> SDLImageShared::createImageReference(EImageBlitMode mode)
|
||||
|
@ -36,7 +36,7 @@ class SDLImageShared final : public ISharedImage, public std::enable_shared_from
|
||||
Point fullSize;
|
||||
|
||||
//pre scaled image
|
||||
int scaleFactor;
|
||||
int preScaleFactor;
|
||||
|
||||
// Keep the original palette, in order to do color switching operation
|
||||
void savePalette();
|
||||
@ -45,9 +45,9 @@ class SDLImageShared final : public ISharedImage, public std::enable_shared_from
|
||||
|
||||
public:
|
||||
//Load image from def file
|
||||
SDLImageShared(const CDefFile *data, size_t frame, size_t group=0, int scaleFactor=1);
|
||||
SDLImageShared(const CDefFile *data, size_t frame, size_t group=0, int preScaleFactor=1);
|
||||
//Load from bitmap file
|
||||
SDLImageShared(const ImagePath & filename, int scaleFactor=1);
|
||||
SDLImageShared(const ImagePath & filename, int preScaleFactor=1);
|
||||
//Create using existing surface, extraRef will increase refcount on SDL_Surface
|
||||
SDLImageShared(SDL_Surface * from);
|
||||
~SDLImageShared();
|
||||
|
Loading…
x
Reference in New Issue
Block a user