diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2017-03-12 17:25:04 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2017-03-12 17:33:17 +0100 |
commit | 494e7218597a6cd94902b3ae6f827e74b41c00b0 (patch) | |
tree | 8b0e7359b9664249945b62a0012c2178b5faf823 /plugingui/pixelbuffer.h | |
parent | 75de9c0ac782fa6fecb92f3a22f311b517856abb (diff) |
Fix redrawing of underlying exposed area on Widget moves/resizing.
Diffstat (limited to 'plugingui/pixelbuffer.h')
-rw-r--r-- | plugingui/pixelbuffer.h | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/plugingui/pixelbuffer.h b/plugingui/pixelbuffer.h index 94c5496..71869a0 100644 --- a/plugingui/pixelbuffer.h +++ b/plugingui/pixelbuffer.h @@ -33,47 +33,49 @@ namespace GUI { -class PixelBuffer { +class PixelBuffer +{ public: - PixelBuffer(size_t width, size_t height); + PixelBuffer(std::size_t width, std::size_t height); ~PixelBuffer(); - void realloc(size_t width, size_t height); + void realloc(std::size_t width, std::size_t height); - void setPixel(size_t x, size_t y, + void setPixel(std::size_t x, std::size_t y, unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha); unsigned char* buf{nullptr}; - size_t width{0}; - size_t height{0}; + std::size_t width{0}; + std::size_t height{0}; }; -class PixelBufferAlpha { +class PixelBufferAlpha +{ public: PixelBufferAlpha() = default; - PixelBufferAlpha(size_t width, size_t height); + PixelBufferAlpha(std::size_t width, std::size_t height); ~PixelBufferAlpha(); - void realloc(size_t width, size_t height); + void realloc(std::size_t width, std::size_t height); - void setPixel(size_t x, size_t y, + void setPixel(std::size_t x, std::size_t y, unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha); - void addPixel(size_t x, size_t y, + void addPixel(std::size_t x, std::size_t y, unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha); - void addPixel(size_t x, size_t y, const Colour& c); + void addPixel(std::size_t x, std::size_t y, const Colour& c); - void pixel(size_t x, size_t y, + void pixel(std::size_t x, std::size_t y, unsigned char* red, unsigned char* green, unsigned char* blue, @@ -86,6 +88,15 @@ public: int x{0}; int y{0}; bool dirty{true}; + bool visible{true}; + + // Add optional dirty rect that this pixelbuffer took up since it was last + // rendered. Make sure to update this list on resize and/or move. + std::size_t last_width{0}; + std::size_t last_height{0}; + int last_x{0}; + int last_y{0}; + bool has_last{false}; }; } // GUI:: |