Commit 7f4f41b0 authored by Joel Martin's avatar Joel Martin

Don't shift off subencoding in hextile.

parent 8fe2c2f9
......@@ -183,7 +183,7 @@ setTile: function(img, x, y, w, h, color) {
putTile: function(img) {
if (Canvas.prefer_js) {
Canvas.rgbxImage(img.x, img.y, img.width, img.height, img.data);
Canvas.rgbxImage(img.x, img.y, img.width, img.height, img.data, 0);
//Canvas.ctx.putImageData(img, img.x, img.y);
} else {
// No-op, under gecko already done by setTile
......@@ -191,18 +191,18 @@ putTile: function(img) {
},
rgbxImage: function(x, y, width, height, arr) {
var img, i, data;
rgbxImage: function(x, y, width, height, arr, offset) {
var img, i, j, data;
//console.log("rfbxImage: img: " + img + " x: " + x + " y: " + y + " width: " + width + " height: " + height);
/* Old firefox and Opera don't support createImageData */
img = Canvas.ctx.getImageData(0, 0, width, height);
//console.log("rfbxImage: img: " + img + " x: " + x + " y: " + y + " width: " + width + " height: " + height);
//img.data = arr.slice();
data = img.data;
for (i=0; i < (width * height); i++) {
data[i*4 + 0] = arr[i*4 + 0];
data[i*4 + 1] = arr[i*4 + 1];
data[i*4 + 2] = arr[i*4 + 2];
data[i*4 + 3] = 255; // Set Alpha
for (i=0; i < (width * height * 4); i=i+4) {
j=i+offset;
data[i + 0] = arr[j + 0];
data[i + 1] = arr[j + 1];
data[i + 2] = arr[j + 2];
data[i + 3] = 255; // Set Alpha
}
Canvas.ctx.putImageData(img, x, y);
......
......@@ -459,7 +459,7 @@ display_raw: function () {
cur_y = FBU.y + (FBU.height - FBU.lines);
cur_height = Math.min(FBU.lines,
Math.floor(RQ.length/(FBU.width * RFB.fb_Bpp)));
Canvas.rgbxImage(FBU.x, cur_y, FBU.width, cur_height, RQ);
Canvas.rgbxImage(FBU.x, cur_y, FBU.width, cur_height, RQ, 0);
RQ.shiftBytes(FBU.width * cur_height * RFB.fb_Bpp);
FBU.lines -= cur_height;
......@@ -601,19 +601,18 @@ display_hextile: function() {
}
/* We know the encoding and have a whole tile */
FBU.subencoding = RQ.shift8();
FBU.bytes--;
FBU.subencoding = RQ[0];
idx = 1;
if (FBU.subencoding === 0) {
if (FBU.lastsubencoding & 0x01) {
/* Weird: ignore blanks after RAW */
console.log(" Ignoring blank after RAW");
continue;
} else {
Canvas.fillRect(x, y, w, h, FBU.background);
}
Canvas.fillRect(x, y, w, h, FBU.background);
} else if (FBU.subencoding & 0x01) { // Raw
Canvas.rgbxImage(x, y, w, h, RQ);
Canvas.rgbxImage(x, y, w, h, RQ, idx);
} else {
idx = 0;
if (FBU.subencoding & 0x02) { // Background
FBU.background = RQ.slice(idx, idx + RFB.fb_Bpp);
idx += RFB.fb_Bpp;
......
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