[go: nahoru, domu]

Skip to content

Commit

Permalink
Fix bug in non-true-color code
Browse files Browse the repository at this point in the history
There was a bug caused by 38781d9
which prevented color map look-ups sent by rfb.js from working properly,
since display.js expected a single-item array, and rfb.js sent just them
item value itself (a number) instead.  This fixes that, and tweaks the
corresponding test to match that behavior.
  • Loading branch information
DirectXMan12 committed Aug 24, 2015
1 parent bb18014 commit a369a80
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ var Display;
if (this._true_color) {
bgr = color;
} else {
bgr = this._colourMap[color[0]];
bgr = this._colourMap[color];
}

var newStyle = 'rgb(' + bgr[2] + ',' + bgr[1] + ',' + bgr[0] + ')';
Expand Down
6 changes: 3 additions & 3 deletions tests/test.display.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,9 @@ describe('Display/Canvas Helper', function () {
it('should support drawing solid colors with color maps', function () {
display._true_color = false;
display.set_colourMap({ 0: [0xff, 0, 0], 1: [0, 0xff, 0] });
display.fillRect(0, 0, 4, 4, [1]);
display.fillRect(0, 0, 2, 2, [0]);
display.fillRect(2, 2, 2, 2, [0]);
display.fillRect(0, 0, 4, 4, 1);
display.fillRect(0, 0, 2, 2, 0);
display.fillRect(2, 2, 2, 2, 0);
expect(display).to.have.displayed(checked_data);
});

Expand Down

0 comments on commit a369a80

Please sign in to comment.