vnc: add vnc_width+vnc_height helpers

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Message-id: 1446203414-4013-12-git-send-email-kraxel@redhat.com
This commit is contained in:
Gerd Hoffmann 2015-10-30 12:10:06 +01:00
parent e081aae5ae
commit d05959c2e1
1 changed files with 13 additions and 3 deletions

View File

@ -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);