From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=52226 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PGaSe-0000Ak-Qn for qemu-devel@nongnu.org; Thu, 11 Nov 2010 11:57:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PGaSc-0005cR-QL for qemu-devel@nongnu.org; Thu, 11 Nov 2010 11:57:20 -0500 Received: from relay2-v.mail.gandi.net ([217.70.178.76]:54309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PGaSc-0005cA-IN for qemu-devel@nongnu.org; Thu, 11 Nov 2010 11:57:18 -0500 From: Corentin Chary Date: Thu, 11 Nov 2010 17:56:59 +0100 Message-Id: <1289494624-12807-11-git-send-email-corentincj@iksaif.net> In-Reply-To: <1289494624-12807-1-git-send-email-corentincj@iksaif.net> References: <1289494624-12807-1-git-send-email-corentincj@iksaif.net> Subject: [Qemu-devel] [PATCH v2 10/15] vnc: fix lossy rect refreshing List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Qemu-development List Cc: Corentin Chary , Anthony Liguori , Alexander Graf , Andre Przywara The for loop in send_lossy_rect was totally wrong, and we can't call vnc_set_bits() because it does not really do what it should. Use vnc_set_bit() directly instead. Signed-off-by: Corentin Chary --- ui/vnc.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ui/vnc.c b/ui/vnc.c index 227efb6..fc2be61 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -2296,8 +2296,8 @@ void vnc_sent_lossy_rect(VncState *vs, int x, int y, int w, int h) x /= VNC_STAT_RECT; y /= VNC_STAT_RECT; - for (j = y; j <= y + h; j++) { - for (i = x; i <= x + w; i++) { + for (j = y; j <= h; j++) { + for (i = x; i <= w; i++) { vs->lossy_rect[j][i] = 1; } } @@ -2314,7 +2314,7 @@ static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y) x = x / VNC_STAT_RECT * VNC_STAT_RECT; QTAILQ_FOREACH(vs, &vd->clients, next) { - int j ; + int j, i; /* kernel send buffers are full -> refresh later */ if (vs->output.offset) @@ -2322,12 +2322,16 @@ static int vnc_refresh_lossy_rect(VncDisplay *vd, int x, int y) if (!vs->lossy_rect[sty][stx]) continue ; + vs->lossy_rect[sty][stx] = 0; for (j = 0; j < VNC_STAT_RECT; ++j) { - vnc_set_bits(vs->dirty[y + j], x / 16, VNC_STAT_RECT / 16); + for (i = x / 16; i < VNC_STAT_RECT / 16 + x / 16; ++i) { + vnc_set_bit(vs->dirty[y + j], i); + } } has_dirty++; } + return has_dirty; } -- 1.7.3.2