qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 11/20] vnc: add vnc_width+vnc_height helpers


From: Gerd Hoffmann
Subject: [Qemu-devel] [PULL 11/20] vnc: add vnc_width+vnc_height helpers
Date: Mon, 16 Nov 2015 18:25:26 +0100

Signed-off-by: Gerd Hoffmann <address@hidden>
Reviewed-by: Peter Lieven <address@hidden>
Reviewed-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
---
 ui/vnc.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index 49de39d..9ffad16 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -615,6 +615,17 @@ static void framebuffer_update_request(VncState *vs, int 
incremental,
 static void vnc_refresh(DisplayChangeListener *dcl);
 static int vnc_refresh_server_surface(VncDisplay *vd);
 
+static int vnc_width(VncDisplay *vd)
+{
+    return MIN(VNC_MAX_WIDTH, ROUND_UP(surface_width(vd->ds),
+                                       VNC_DIRTY_PIXELS_PER_BIT));
+}
+
+static int vnc_height(VncDisplay *vd)
+{
+    return MIN(VNC_MAX_HEIGHT, surface_height(vd->ds));
+}
+
 static void vnc_set_area_dirty(DECLARE_BITMAP(dirty[VNC_MAX_HEIGHT],
                                VNC_MAX_WIDTH / VNC_DIRTY_PIXELS_PER_BIT),
                                int width, int height,
@@ -725,9 +736,8 @@ static void vnc_dpy_switch(DisplayChangeListener *dcl,
     /* server surface */
     qemu_pixman_image_unref(vd->server);
     vd->ds = surface;
-    width = MIN(VNC_MAX_WIDTH, ROUND_UP(surface_width(vd->ds),
-                                        VNC_DIRTY_PIXELS_PER_BIT));
-    height = MIN(VNC_MAX_HEIGHT, surface_height(vd->ds));
+    width = vnc_width(vd);
+    height = vnc_height(vd);
     vd->server = pixman_image_create_bits(VNC_SERVER_FB_FORMAT,
                                           width, height, NULL, 0);
 
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]