diff options
Diffstat (limited to 'plugingui/image.cc')
-rw-r--r-- | plugingui/image.cc | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/plugingui/image.cc b/plugingui/image.cc index 4b5622e..70ee08e 100644 --- a/plugingui/image.cc +++ b/plugingui/image.cc @@ -76,15 +76,17 @@ Image& Image::operator=(Image&& other) image_data = std::move(other.image_data); _width = other._width; _height = other._height; + valid = other.valid; other._width = 0; other._height = 0; - + other.valid = false; return *this; } void Image::setError() { + valid = false; Resource rc(":resources/png_error"); const unsigned char* ptr = (const unsigned char*)rc.data(); @@ -155,6 +157,7 @@ void Image::load(const char* data, size_t size) assert(image_data.size() == (_width * _height)); std::free(char_image_data); + valid = true; } size_t Image::width() const @@ -177,4 +180,9 @@ const Colour& Image::getPixel(size_t x, size_t y) const return image_data[x + y * _width]; } +bool Image::isValid() const +{ + return valid; +} + } // GUI:: |