aboutsummaryrefslogtreecommitdiff
path: root/ui/vnc.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui/vnc.c')
-rw-r--r--ui/vnc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ui/vnc.c b/ui/vnc.c
index 651cbb8606..fd43f9b983 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -2624,8 +2624,8 @@ static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y)
int stx = x / VNC_STAT_RECT;
int has_dirty = 0;
- y = y / VNC_STAT_RECT * VNC_STAT_RECT;
- x = x / VNC_STAT_RECT * VNC_STAT_RECT;
+ y = QEMU_ALIGN_DOWN(y, VNC_STAT_RECT);
+ x = QEMU_ALIGN_DOWN(x, VNC_STAT_RECT);
QTAILQ_FOREACH(vs, &vd->clients, next) {
int j;
@@ -2714,8 +2714,8 @@ double vnc_update_freq(VncState *vs, int x, int y, int w, int h)
double total = 0;
int num = 0;
- x = (x / VNC_STAT_RECT) * VNC_STAT_RECT;
- y = (y / VNC_STAT_RECT) * VNC_STAT_RECT;
+ x = QEMU_ALIGN_DOWN(x, VNC_STAT_RECT);
+ y = QEMU_ALIGN_DOWN(y, VNC_STAT_RECT);
for (j = y; j <= y + h; j += VNC_STAT_RECT) {
for (i = x; i <= x + w; i += VNC_STAT_RECT) {
@@ -2781,7 +2781,7 @@ static int vnc_refresh_server_surface(VncDisplay *vd)
PIXMAN_FORMAT_BPP(pixman_image_get_format(vd->guest.fb));
guest_row0 = (uint8_t *)pixman_image_get_data(vd->guest.fb);
guest_stride = pixman_image_get_stride(vd->guest.fb);
- guest_ll = pixman_image_get_width(vd->guest.fb) * ((guest_bpp + 7) / 8);
+ guest_ll = pixman_image_get_width(vd->guest.fb) * (DIV_ROUND_UP(guest_bpp, 8));
}
line_bytes = MIN(server_stride, guest_ll);