Commit 48617e27 authored by Joel Martin's avatar Joel Martin

Fix Copy-Rect encoding.

parent f6515e3e
...@@ -143,6 +143,11 @@ rfbImage: function(x, y, width, height, arr) { ...@@ -143,6 +143,11 @@ rfbImage: function(x, y, width, height, arr) {
}, },
copyImage: function(old_x, old_y, new_x, new_y, width, height) {
Canvas.ctx.drawImage($(Canvas.id), old_x, old_y, width, height,
new_x, new_y, width, height);
},
/* Translate DOM key event to keysym value */ /* Translate DOM key event to keysym value */
getKeysym: function(e) { getKeysym: function(e) {
evt = e.event || window.event; evt = e.event || window.event;
......
...@@ -228,32 +228,34 @@ normal_msg: function (data) { ...@@ -228,32 +228,34 @@ normal_msg: function (data) {
FBU.y = data.shift16(); FBU.y = data.shift16();
FBU.width = data.shift16(); FBU.width = data.shift16();
FBU.height = data.shift16(); FBU.height = data.shift16();
FBU.encoding = data.shift32(); FBU.encoding = parseInt(data.shift32(), 10);
//debug("encoding: " + FBU.encoding);
//debug('New rect: ' + FBU.x + "," + FBU.y + " -> " + (FBU.x + FBU.width) + "," + (FBU.y + FBU.height)); //debug('New rect: ' + FBU.x + "," + FBU.y + " -> " + (FBU.x + FBU.width) + "," + (FBU.y + FBU.height));
switch (FBU.encoding) { switch (FBU.encoding) {
case 0: // Raw case 0: // Raw
FBU.bytes = FBU.width * FBU.height * RFB.fb_Bpp; FBU.bytes = FBU.width * FBU.height * RFB.fb_Bpp;
break; break;
case 1: // Copy-Rect case 1: // Copy-Rect
fbu_bytes = 4; FBU.bytes = 4;
break; break;
} }
} else { } else {
if (data.length >= FBU.bytes) { if (data.length >= FBU.bytes) {
//debug('Done rect: ' + FBU.x + "," + FBU.y + " -> " + (FBU.x + FBU.width) + "," + (FBU.y + FBU.height)); //debug('Done rect:');
FBU.arr = FBU.arr.concat(data.shiftBytes(FBU.bytes)) FBU.arr = FBU.arr.concat(data.shiftBytes(FBU.bytes))
FBU.bytes = 0; FBU.bytes = 0;
switch (FBU.encoding) { switch (FBU.encoding) {
case 0: // Raw case 0: // Raw
debug('Raw-Rect: ' + FBU.x + "," + FBU.y + " -> " + (FBU.x + FBU.width) + "," + (FBU.y + FBU.height)); //debug('Raw-Rect: (' + FBU.x + "," + FBU.y + ")X(" + (FBU.x + FBU.width) + "," + (FBU.y + FBU.height) + ")");
Canvas.rfbImage(FBU.x, FBU.y, FBU.width, FBU.height, FBU.arr); Canvas.rfbImage(FBU.x, FBU.y, FBU.width, FBU.height, FBU.arr);
break; break;
case 1: // Copy-Rect case 1: // Copy-Rect
debug('Copy-Rect: ' + FBU.x + "," + FBU.y + " -> " + (FBU.x + FBU.width) + "," + (FBU.y + FBU.height)); var old_x = FBU.arr.shift16();
var new_x = FBU.arr.shift16(); var old_y = FBU.arr.shift16();
var new_y = FBU.arr.shift16(); //debug('Copy-Rect: (' + old_x + "," + old_y + ")X(" + (FBU.x + FBU.width) + "," + (FBU.y + FBU.height) + ") -> (" + FBU.x + "," + FBU.y + ")");
Canvas.ctx.drawImage(Canvas.c, FBU.x, FBU.y, FBU.width, FBU.height, new_x, new_y, FBU.width, FBU.height);
Canvas.copyImage(old_x, old_y, FBU.x, FBU.y, FBU.width, FBU.height);
break; break;
} }
FBU.arr = []; FBU.arr = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment