Revision 23bfe28f

b/ui/vnc.c
2383 2383
    uint8_t *guest_row;
2384 2384
    uint8_t *server_row;
2385 2385
    int cmp_bytes;
2386
    unsigned long width_mask[VNC_DIRTY_WORDS];
2387 2386
    VncState *vs;
2388 2387
    int has_dirty = 0;
2389 2388

  
......
2399 2398
     * Check and copy modified bits from guest to server surface.
2400 2399
     * Update server dirty map.
2401 2400
     */
2402
    bitmap_set(width_mask, 0, (ds_get_width(vd->ds) / 16));
2403
    bitmap_clear(width_mask, (ds_get_width(vd->ds) / 16),
2404
                 VNC_DIRTY_WORDS * BITS_PER_LONG);
2405 2401
    cmp_bytes = 16 * ds_get_bytes_per_pixel(vd->ds);
2406 2402
    guest_row  = vd->guest.ds->data;
2407 2403
    server_row = vd->server->data;
2408 2404
    for (y = 0; y < vd->guest.ds->height; y++) {
2409
        if (bitmap_intersects(vd->guest.dirty[y], width_mask, VNC_DIRTY_WORDS)) {
2405
        if (!bitmap_empty(vd->guest.dirty[y], VNC_DIRTY_BITS)) {
2410 2406
            int x;
2411 2407
            uint8_t *guest_ptr;
2412 2408
            uint8_t *server_ptr;
b/ui/vnc.h
79 79
                                void *last_fg,
80 80
                                int *has_bg, int *has_fg);
81 81

  
82
/* VNC_MAX_WIDTH must be a multiple of 16. */
82 83
#define VNC_MAX_WIDTH 2560
83 84
#define VNC_MAX_HEIGHT 2048
84
#define VNC_DIRTY_WORDS (VNC_MAX_WIDTH / (16 * BITS_PER_LONG))
85

  
86
/* VNC_DIRTY_BITS is the number of bits in the dirty bitmap. */
87
#define VNC_DIRTY_BITS (VNC_MAX_WIDTH / 16)
85 88

  
86 89
#define VNC_STAT_RECT  64
87 90
#define VNC_STAT_COLS (VNC_MAX_WIDTH / VNC_STAT_RECT)
......
114 117
struct VncSurface
115 118
{
116 119
    struct timeval last_freq_check;
117
    unsigned long dirty[VNC_MAX_HEIGHT][VNC_DIRTY_WORDS];
120
    DECLARE_BITMAP(dirty[VNC_MAX_HEIGHT], VNC_MAX_WIDTH / 16);
118 121
    VncRectStat stats[VNC_STAT_ROWS][VNC_STAT_COLS];
119 122
    DisplaySurface *ds;
120 123
};
......
234 237
    int csock;
235 238

  
236 239
    DisplayState *ds;
237
    unsigned long dirty[VNC_MAX_HEIGHT][VNC_DIRTY_WORDS];
240
    DECLARE_BITMAP(dirty[VNC_MAX_HEIGHT], VNC_DIRTY_BITS);
238 241
    uint8_t **lossy_rect; /* Not an Array to avoid costly memcpy in
239 242
                           * vnc-jobs-async.c */
240 243

  

Also available in: Unified diff