diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2025-06-08 20:59:57 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2025-07-11 20:41:55 +0200 |
commit | 6b89b661df1a2682edfa491e1bb9a21c4ab0943c (patch) | |
tree | 11bbe888ecf9b45eeb78e371c00b950e9c4c4cac /src/graphics.cpp | |
parent | b3836dd46658d8bc24af2d60c5e7904d7f051bca (diff) | |
download | mana-6b89b661df1a2682edfa491e1bb9a21c4ab0943c.tar.gz mana-6b89b661df1a2682edfa491e1bb9a21c4ab0943c.tar.bz2 mana-6b89b661df1a2682edfa491e1bb9a21c4ab0943c.tar.xz mana-6b89b661df1a2682edfa491e1bb9a21c4ab0943c.zip |
Cleaned up ImageRect a little
* Use `std::unique_ptr`, so we can get rid of the custom move
constructor and destructor.
* Move and rename the `ImagePosition` enum to `WindowAlignment`, which
fits better with what this enum is actually used for.
Diffstat (limited to 'src/graphics.cpp')
-rw-r--r-- | src/graphics.cpp | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/graphics.cpp b/src/graphics.cpp index 5455f61a..c5b86bc6 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -21,27 +21,8 @@ #include "graphics.h" -#include "resources/image.h" - #include <guichan/exception.hpp> -#include <utility> - -ImageRect::ImageRect(ImageRect &&r) -{ - image = std::exchange(r.image, nullptr); - top = r.top; - left = r.left; - bottom = r.bottom; - right = r.right; - fillMode = r.fillMode; -} - -ImageRect::~ImageRect() -{ - delete image; -} - void Graphics::updateSize(int width, int height, float /*scale*/) { @@ -166,7 +147,7 @@ void Graphics::drawImageRect(const ImageRect &imgRect, int x, int y, int w, int switch (imgRect.fillMode) { case FillMode::Stretch: - drawRescaledImage(imgRect.image, + drawRescaledImage(imgRect.image.get(), srcGridX[ix], srcGridY[iy], dstGridX[ix], @@ -175,7 +156,7 @@ void Graphics::drawImageRect(const ImageRect &imgRect, int x, int y, int w, int dstW, dstH); break; case FillMode::Repeat: - drawRescaledImagePattern(imgRect.image, + drawRescaledImagePattern(imgRect.image.get(), srcGridX[ix], srcGridY[iy], srcW, srcH, |