Commit 3d625a73 authored by Ramon de Klein's avatar Ramon de Klein Committed by Solly Ross

Backport: Don't draw "blank" HEXTILE tiles with random data

Previously, if a HEXTILE tiles was received with a subencoding
of 0x00, it would draw a rectangle using data from the render
queue, which would result in random colored blocks when using
the HEXTILE encoding.  This is the result of a miscopy during
the refactoring.  It now has the correct functionality according
to the RFB protocol specification, which is to draw a rectangle
with the last set background color.

Closes #411

(cherry picked from commit 40ac6f0a)
parent 6cea5ca8
...@@ -1496,8 +1496,7 @@ var RFB; ...@@ -1496,8 +1496,7 @@ var RFB;
// Weird: ignore blanks are RAW // Weird: ignore blanks are RAW
Util.Debug(" Ignoring blank after RAW"); Util.Debug(" Ignoring blank after RAW");
} else { } else {
this._display.fillRect(x, y, w, h, rQ, rQi); this._display.fillRect(x, y, w, h, FBU.background);
rQi += this._FBU.bytes - 1;
} }
} else if (this._FBU.subencoding & 0x01) { // Raw } else if (this._FBU.subencoding & 0x01) { // Raw
this._display.blitImage(x, y, w, h, rQ, rQi); this._display.blitImage(x, y, w, h, rQ, rQi);
......
...@@ -1312,6 +1312,32 @@ describe('Remote Frame Buffer Protocol Client', function() { ...@@ -1312,6 +1312,32 @@ describe('Remote Frame Buffer Protocol Client', function() {
expect(client._display).to.have.displayed(new Uint8Array(expected)); expect(client._display).to.have.displayed(new Uint8Array(expected));
}); });
it('should handle a tile with only bg specified and an empty frame afterwards', function () {
// set the width so we can have two tiles
client._fb_width = 8;
client._display._fb_width = 8;
client._display._viewportLoc.w = 8;
var info = [{ x: 0, y: 0, width: 8, height: 4, encoding: 0x05 }];
var rect = [];
// send a bg frame
rect.push(0x02);
rect.push32(0xff00ff); // becomes 00ff00ff --> #00FF00 bg color
// send an empty frame
rect.push(0x00);
send_fbu_msg(info, [rect], client);
var expected = [];
var i;
for (i = 0; i < 16; i++) { expected.push32(0xff00ff); } // rect 1: solid
for (i = 0; i < 16; i++) { expected.push32(0xff00ff); } // rect 2: same bkground color
expect(client._display).to.have.displayed(new Uint8Array(expected));
});
it('should handle a tile with bg and coloured subrects', function () { it('should handle a tile with bg and coloured subrects', function () {
var info = [{ x: 0, y: 0, width: 4, height: 4, encoding: 0x05 }]; var info = [{ x: 0, y: 0, width: 4, height: 4, encoding: 0x05 }];
var rect = []; var rect = [];
......
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