Skip to content

Commit

Permalink
#92 convert pixel data to a byte array as early as possible
Browse files Browse the repository at this point in the history
  • Loading branch information
totaam committed Aug 19, 2021
1 parent f1d2cf9 commit 5e66fd7
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions html5/js/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -2778,11 +2778,19 @@ XpraClient.prototype._process_window_icon = function(packet, ctx) {
* Window Painting
*/
XpraClient.prototype._process_draw = function(packet, ctx) {
//ensure that the pixel data is in a byte array:
const coding = packet[6];
let img_data = packet[7];
const raw_buffers = [];
if (coding!="scroll") {
if (!(img_data instanceof Uint8Array)) {
//the legacy bencoder can give us a string here
img_data = Utilities.StringToUint8(img_data);
packet[7] = img_data;
}
raw_buffers.push(img_data.buffer);
}
if (ctx.decode_worker) {
let raw_buffers = [];
if ("buffer" in packet[7]) {
raw_buffers.push(packet[7].buffer);
}
ctx.decode_worker.postMessage({'cmd': 'decode', 'packet' : packet}, raw_buffers);
//the worker draw event will call do_process_draw
}
Expand Down

0 comments on commit 5e66fd7

Please sign in to comment.