diff mbox series

[PULL,v5,12/12] hw/display/artist: Fix invalidation of lines near screen border

Message ID 20200826211345.14295-13-deller@gmx.de
State New
Headers show
Series The following changes since commit 3461487523b897d324e8d91f3fd20ed55f849544: | expand

Commit Message

Helge Deller Aug. 26, 2020, 9:13 p.m. UTC
From: Sven Schnelle <svens@stackframe.org>

If parts of the invalidated screen lines are outside of the VRAM buffer,
the code skips the whole invalidate. This is incorrect when only parts
of the buffer are invisble - which is the case when the mouse cursor is
located near the screen border.

Signed-off-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Helge Deller <deller@gmx.de>
---
 hw/display/artist.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

--
2.21.3
diff mbox series

Patch

diff --git a/hw/display/artist.c b/hw/display/artist.c
index a959b2c158..71982559c6 100644
--- a/hw/display/artist.c
+++ b/hw/display/artist.c
@@ -206,7 +206,12 @@  static void artist_invalidate_lines(struct vram_buffer *buf,
                                     int starty, int height)
 {
     int start = starty * buf->width;
-    int size = height * buf->width;
+    int size;
+
+    if (starty + height > buf->height)
+        height = buf->height - starty;
+
+    size = height * buf->width;

     if (start + size <= buf->size) {
         memory_region_set_dirty(&buf->mr, start, size);