From 494e7218597a6cd94902b3ae6f827e74b41c00b0 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 12 Mar 2017 17:25:04 +0100 Subject: Fix redrawing of underlying exposed area on Widget moves/resizing. --- plugingui/pixelbuffer.h | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'plugingui/pixelbuffer.h') 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:: -- cgit v1.2.3