aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2012-12-14 08:54:25 +0100
committerBlue Swirl <blauwirbel@gmail.com>2012-12-14 20:56:26 +0000
commit4b4496dbccc5f286f0ef411f0ff702d67cb95145 (patch)
tree6732827a92f08556658906afae0dfdf643ccf462
parentbc210eb163b162ff2e94e5c8f4307715731257f8 (diff)
downloadqemu-4b4496dbccc5f286f0ef411f0ff702d67cb95145.zip
qemu-4b4496dbccc5f286f0ef411f0ff702d67cb95145.tar.gz
qemu-4b4496dbccc5f286f0ef411f0ff702d67cb95145.tar.bz2
console: clip update rectangle
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r--console.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/console.h b/console.h
index 50a0512..edb1950 100644
--- a/console.h
+++ b/console.h
@@ -229,6 +229,16 @@ static inline void unregister_displaychangelistener(DisplayState *ds,
static inline void dpy_gfx_update(DisplayState *s, int x, int y, int w, int h)
{
struct DisplayChangeListener *dcl;
+ int width = pixman_image_get_width(s->surface->image);
+ int height = pixman_image_get_height(s->surface->image);
+
+ x = MAX(x, 0);
+ y = MAX(y, 0);
+ x = MIN(x, width);
+ y = MIN(y, height);
+ w = MIN(w, width - x);
+ h = MIN(h, height - y);
+
QLIST_FOREACH(dcl, &s->listeners, next) {
if (dcl->dpy_gfx_update) {
dcl->dpy_gfx_update(s, x, y, w, h);