Skip to content
This repository
Browse code

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...
commit 72a5596e50471039e16b49f6c15d0b02576cb7ae 1 parent 34d8b84
Joel Martin authored May 17, 2012
4  include/display.js
@@ -590,7 +590,9 @@ that.drawImage = function(img, x, y) {
590 590
 that.renderQ_push = function(action) {
591 591
     renderQ.push(action);
592 592
     if (renderQ.length === 1) {
593  
-        // Check if it can be rendered immediately
  593
+        // If this can be rendered immediately it will be, otherwise
  594
+        // the scanner will start polling the queue (every
  595
+        // requestAnimationFrame interval)
594 596
         scan_renderQ();
595 597
     }
596 598
 };
11  include/rfb.js
@@ -1109,9 +1109,14 @@ encHandlers.COPYRECT = function display_copy_rect() {
1109 1109
     var old_x, old_y;
1110 1110
 
1111 1111
     if (ws.rQwait("COPYRECT", 4)) { return false; }
1112  
-    old_x = ws.rQshift16();
1113  
-    old_y = ws.rQshift16();
1114  
-    display.copyImage(old_x, old_y, FBU.x, FBU.y, FBU.width, FBU.height);
  1112
+    display.renderQ_push({
  1113
+            'type': 'copy',
  1114
+            'old_x': ws.rQshift16(),
  1115
+            'old_y': ws.rQshift16(),
  1116
+            'x': FBU.x,
  1117
+            'y': FBU.y,
  1118
+            'width': FBU.width,
  1119
+            'height': FBU.height});
1115 1120
     FBU.rects -= 1;
1116 1121
     FBU.bytes = 0;
1117 1122
     return true;

0 notes on commit 72a5596

Please sign in to comment.
Something went wrong with that request. Please try again.