From 72a5596e50471039e16b49f6c15d0b02576cb7ae Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Thu, 17 May 2012 11:19:07 -0500 Subject: [PATCH] rfb: Use the render queue for copyrect. This will keep copyrect rendering actions in order with tight and tightPNG rendering actions (otherwise you can get visual image corruption when they are mixed together). Warning: RAW, RRE and HEXTILE still use immediate render commands so there is still the risk of out-of-order rendering if RAW, RRE, and HEXTILE are mixed with tight and tightPNG. Copyrect will work with either because the renderQ_push function will render copyrects immediately if they are the only thing being pushed on the queue. --- include/display.js | 4 +++- include/rfb.js | 11 ++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/display.js b/include/display.js index 8252ef83..ebad4641 100644 --- a/include/display.js +++ b/include/display.js @@ -590,7 +590,9 @@ that.drawImage = function(img, x, y) { that.renderQ_push = function(action) { renderQ.push(action); if (renderQ.length === 1) { - // Check if it can be rendered immediately + // If this can be rendered immediately it will be, otherwise + // the scanner will start polling the queue (every + // requestAnimationFrame interval) scan_renderQ(); } }; diff --git a/include/rfb.js b/include/rfb.js index f80d190e..4362ce14 100644 --- a/include/rfb.js +++ b/include/rfb.js @@ -1109,9 +1109,14 @@ encHandlers.COPYRECT = function display_copy_rect() { var old_x, old_y; if (ws.rQwait("COPYRECT", 4)) { return false; } - old_x = ws.rQshift16(); - old_y = ws.rQshift16(); - display.copyImage(old_x, old_y, FBU.x, FBU.y, FBU.width, FBU.height); + display.renderQ_push({ + 'type': 'copy', + 'old_x': ws.rQshift16(), + 'old_y': ws.rQshift16(), + 'x': FBU.x, + 'y': FBU.y, + 'width': FBU.width, + 'height': FBU.height}); FBU.rects -= 1; FBU.bytes = 0; return true;