Permalink
Browse files

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.
  • Loading branch information...
1 parent 34d8b84 commit 72a5596e50471039e16b49f6c15d0b02576cb7ae @kanaka committed May 17, 2012
Showing with 11 additions and 4 deletions.
  1. +3 −1 include/display.js
  2. +8 −3 include/rfb.js
View
@@ -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();
}
};
View
@@ -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;

0 comments on commit 72a5596

Please sign in to comment.