summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Mannehed <samuel@cendio.se>2020-01-30 11:40:44 +0100
committerSamuel Mannehed <samuel@cendio.se>2020-01-30 11:48:17 +0100
commit71bb3fdfa58954ca7b0d7be43d974316c727ff4c (patch)
treeeb5abe05ac5da81c3f1b775e1da1aab4dd647eea
parenteb05b45b70d1704c59b6808f4c78968b578c4182 (diff)
downloadnovnc-71bb3fdfa58954ca7b0d7be43d974316c727ff4c.tar.gz
Fix color channels for VMware alpha cursors
The red and blue channels were incorrectly swapped.
-rw-r--r--core/rfb.js4
-rw-r--r--tests/test.rfb.js6
2 files changed, 5 insertions, 5 deletions
diff --git a/core/rfb.js b/core/rfb.js
index e3e3a0f..1d9f2fb 100644
--- a/core/rfb.js
+++ b/core/rfb.js
@@ -1651,9 +1651,9 @@ export default class RFB extends EventTargetMixin {
for (let pixel = 0; pixel < (w * h); pixel++) {
let data = this._sock.rQshift32();
- rgba[(pixel * 4) ] = data >> 8 & 0xff; //r
+ rgba[(pixel * 4) ] = data >> 24 & 0xff; //r
rgba[(pixel * 4) + 1 ] = data >> 16 & 0xff; //g
- rgba[(pixel * 4) + 2 ] = data >> 24 & 0xff; //b
+ rgba[(pixel * 4) + 2 ] = data >> 8 & 0xff; //b
rgba[(pixel * 4) + 3 ] = data & 0xff; //a
}
diff --git a/tests/test.rfb.js b/tests/test.rfb.js
index 17320e4..ba35b9c 100644
--- a/tests/test.rfb.js
+++ b/tests/test.rfb.js
@@ -2243,7 +2243,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
});
it('should update the cursor when type is alpha', function () {
- let data = [0xee, 0x55, 0xff, 0x00, // bgra
+ let data = [0xee, 0x55, 0xff, 0x00, // rgba
0x00, 0xff, 0x00, 0xff,
0x00, 0xff, 0x00, 0x22,
0x00, 0xff, 0x00, 0x22,
@@ -2261,12 +2261,12 @@ describe('Remote Frame Buffer Protocol Client', function () {
push8(rect, data[i]);
}
- let expected_rgba = [0xff, 0x55, 0xee, 0x00,
+ let expected_rgba = [0xee, 0x55, 0xff, 0x00,
0x00, 0xff, 0x00, 0xff,
0x00, 0xff, 0x00, 0x22,
0x00, 0xff, 0x00, 0x22,
0x00, 0xff, 0x00, 0x22,
- 0xff, 0x00, 0x00, 0xee];
+ 0x00, 0x00, 0xff, 0xee];
send_fbu_msg([{ x: hotx, y: hoty,
width: w, height: h,