diff --git a/vnc.c b/vnc.c index fcce00eddce951bba381a7778e798fce70231d51..b20fe21d7d48f27e803c3af00ef0d56f2d9ff5d2 100644 --- a/vnc.c +++ b/vnc.c @@ -258,6 +258,13 @@ static void vnc_dpy_update(DisplayState *ds, int x, int y, int w, int h) h += y; + /* round x down to ensure the loop only spans one 16-pixel block per, + iteration. otherwise, if (x % 16) != 0, the last iteration may span + two 16-pixel blocks but we only mark the first as dirty + */ + w += (x % 16); + x -= (x % 16); + for (; y < h; y++) for (i = 0; i < w; i += 16) vnc_set_bit(vs->dirty_row[y], (x + i) / 16);