summaryrefslogtreecommitdiff
path: root/plugingui/pixelbuffer.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-11-15 15:42:14 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2020-11-15 15:42:14 +0100
commit37e0c7ece76d2fdc23a42f87f9112ec1423dd988 (patch)
tree9d52181de738cf69784f017e8975ac39b790eccc /plugingui/pixelbuffer.cc
parenta8eea6e9c1f32d5562594656c68dc4b9f985b790 (diff)
Make sure tooltips are always shown inside the window.
Diffstat (limited to 'plugingui/pixelbuffer.cc')
-rw-r--r--plugingui/pixelbuffer.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/plugingui/pixelbuffer.cc b/plugingui/pixelbuffer.cc
index c73e663..3c666cd 100644
--- a/plugingui/pixelbuffer.cc
+++ b/plugingui/pixelbuffer.cc
@@ -30,6 +30,7 @@
#include <cstdlib>
#include <cstring>
+#include <algorithm>
namespace GUI
{
@@ -85,10 +86,10 @@ Rect PixelBuffer::updateBuffer(std::vector<PixelBufferAlpha*>& pixel_buffers)
{
if(pixel_buffer->dirty)
{
- auto x1 = (std::size_t)pixel_buffer->x;
- auto x2 = (std::size_t)(pixel_buffer->x + pixel_buffer->width);
- auto y1 = (std::size_t)pixel_buffer->y;
- auto y2 = (std::size_t)(pixel_buffer->y + pixel_buffer->height);
+ auto x1 = (std::size_t)std::max(pixel_buffer->x, 0);
+ auto x2 = (std::size_t)std::max((pixel_buffer->x + (int)pixel_buffer->width), 0);
+ auto y1 = (std::size_t)std::max(pixel_buffer->y, 0);
+ auto y2 = (std::size_t)std::max((pixel_buffer->y + (int)pixel_buffer->height), 0);
pixel_buffer->dirty = false;
if(!has_dirty_rect)