From patchwork Tue Nov 13 08:56:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: console: clip update rectangle Date: Mon, 12 Nov 2012 22:56:52 -0000 From: Gerd Hoffmann X-Patchwork-Id: 198569 Message-Id: <1352797012-17049-1-git-send-email-kraxel@redhat.com> To: qemu-devel@nongnu.org Cc: Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- console.h | 10 ++++++++++ 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);