summaryrefslogtreecommitdiff
path: root/plugingui/image.cc
diff options
context:
space:
mode:
Diffstat (limited to 'plugingui/image.cc')
-rw-r--r--plugingui/image.cc32
1 files changed, 31 insertions, 1 deletions
diff --git a/plugingui/image.cc b/plugingui/image.cc
index 250dc60..63f708d 100644
--- a/plugingui/image.cc
+++ b/plugingui/image.cc
@@ -48,9 +48,39 @@ Image::Image(const std::string& filename)
load(rc.data(), rc.size());
}
+Image::Image(Image&& other)
+ : _width(other._width)
+ , _height(other._height)
+ , image_data(other.image_data)
+{
+ other.image_data = nullptr;
+ other._width = 0;
+ other._height = 0;
+}
+
Image::~Image()
{
- std::free(image_data);
+ if(image_data)
+ {
+ std::free(image_data);
+ }
+}
+
+Image& Image::operator=(Image&& other)
+{
+ if(image_data)
+ {
+ std::free(image_data);
+ }
+ image_data = other.image_data;
+ _width = other._width;
+ _height = other._height;
+
+ other.image_data = nullptr;
+ other._width = 0;
+ other._height = 0;
+
+ return *this;
}
void Image::setError()