diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/cursor.c | 2 | ||||
-rw-r--r-- | ui/vnc-enc-tight.c | 2 | ||||
-rw-r--r-- | ui/vnc.c | 10 |
3 files changed, 7 insertions, 7 deletions
diff --git a/ui/cursor.c b/ui/cursor.c index 5155b392e8..2e2fe13fa6 100644 --- a/ui/cursor.c +++ b/ui/cursor.c @@ -118,7 +118,7 @@ void cursor_put(QEMUCursor *c) int cursor_get_mono_bpl(QEMUCursor *c) { - return (c->width + 7) / 8; + return DIV_ROUND_UP(c->width, 8); } void cursor_set_mono(QEMUCursor *c, diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c index 89ab12c0d8..f38aceb4da 100644 --- a/ui/vnc-enc-tight.c +++ b/ui/vnc-enc-tight.c @@ -979,7 +979,7 @@ static int send_mono_rect(VncState *vs, int x, int y, } #endif - bytes = ((w + 7) / 8) * h; + bytes = (DIV_ROUND_UP(w, 8)) * h; vnc_write_u8(vs, (stream | VNC_TIGHT_EXPLICIT_FILTER) << 4); vnc_write_u8(vs, VNC_TIGHT_FILTER_PALETTE); @@ -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); |