diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2019-02-11 10:52:30 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2019-02-11 10:52:30 +0100 |
commit | 43c2a51331d3e91d86ef50c5262920bdaa260925 (patch) | |
tree | ffc5b03be36537e6f028df935a251493d4557979 /plugingui/image.cc | |
parent | 152423c0274887415b50c0d31828036a8fe54708 (diff) |
Show/hide drumkit tab depending on if the current kit has a valid image attached or not.
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:: |