1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-22 03:39:45 +02:00

Fix positioning of scaleable main menu when xbrz is in use

This commit is contained in:
Ivan Savenko 2024-12-18 21:33:37 +00:00
parent 23f3936739
commit 03b7622a1d
3 changed files with 13 additions and 10 deletions

View File

@ -111,12 +111,12 @@ public:
virtual bool isTransparent(const Point & coords) const = 0;
virtual void draw(SDL_Surface * where, SDL_Palette * palette, const Point & dest, const Rect * src, const ColorRGBA & colorMultiplier, uint8_t alpha, EImageBlitMode mode) const = 0;
virtual std::shared_ptr<IImage> createImageReference(EImageBlitMode mode) const = 0;
[[nodiscard]] virtual std::shared_ptr<IImage> createImageReference(EImageBlitMode mode) const = 0;
virtual std::shared_ptr<const ISharedImage> horizontalFlip() const = 0;
virtual std::shared_ptr<const ISharedImage> verticalFlip() const = 0;
virtual std::shared_ptr<const ISharedImage> scaleInteger(int factor, SDL_Palette * palette, EImageBlitMode blitMode) const = 0;
virtual std::shared_ptr<const ISharedImage> scaleTo(const Point & size, SDL_Palette * palette) const = 0;
[[nodiscard]] virtual std::shared_ptr<const ISharedImage> horizontalFlip() const = 0;
[[nodiscard]] virtual std::shared_ptr<const ISharedImage> verticalFlip() const = 0;
[[nodiscard]] virtual std::shared_ptr<const ISharedImage> scaleInteger(int factor, SDL_Palette * palette, EImageBlitMode blitMode) const = 0;
[[nodiscard]] virtual std::shared_ptr<const ISharedImage> scaleTo(const Point & size, SDL_Palette * palette) const = 0;
virtual ~ISharedImage() = default;

View File

@ -43,6 +43,9 @@ void ImageScaled::scaleInteger(int factor)
void ImageScaled::scaleTo(const Point & size)
{
if (source)
source = source->scaleTo(size, nullptr);
if (body)
body = body->scaleTo(size * GH.screenHandler().getScalingFactor(), nullptr);
}

View File

@ -57,11 +57,11 @@ public:
void exportBitmap(const boost::filesystem::path & path, SDL_Palette * palette) const override;
Point dimensions() const override;
bool isTransparent(const Point & coords) const override;
std::shared_ptr<IImage> createImageReference(EImageBlitMode mode) const override;
std::shared_ptr<const ISharedImage> horizontalFlip() const override;
std::shared_ptr<const ISharedImage> verticalFlip() const override;
std::shared_ptr<const ISharedImage> scaleInteger(int factor, SDL_Palette * palette, EImageBlitMode blitMode) const override;
std::shared_ptr<const ISharedImage> scaleTo(const Point & size, SDL_Palette * palette) const override;
[[nodiscard]] std::shared_ptr<IImage> createImageReference(EImageBlitMode mode) const override;
[[nodiscard]] std::shared_ptr<const ISharedImage> horizontalFlip() const override;
[[nodiscard]] std::shared_ptr<const ISharedImage> verticalFlip() const override;
[[nodiscard]] std::shared_ptr<const ISharedImage> scaleInteger(int factor, SDL_Palette * palette, EImageBlitMode blitMode) const override;
[[nodiscard]] std::shared_ptr<const ISharedImage> scaleTo(const Point & size, SDL_Palette * palette) const override;
friend class SDLImageLoader;
};