From 4b4496dbccc5f286f0ef411f0ff702d67cb95145 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 14 Dec 2012 08:54:25 +0100 Subject: console: clip update rectangle Signed-off-by: Gerd Hoffmann Signed-off-by: Blue Swirl --- console.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/console.h b/console.h index 50a0512f32..edb1950871 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); -- cgit v1.2.3