mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2025-07-13 06:04:26 +02:00
RemoteDesktop: support 16 bits color space
This commit is contained in:
@ -11,19 +11,20 @@
|
||||
return api = {
|
||||
createBuffer: Module.cwrap('create_buffer', 'number', ['number', 'number']),
|
||||
destroyBuffer: Module.cwrap('destroy_buffer', '', ['number']),
|
||||
updateBuffer: Module.cwrap("update", 'number', ['number', 'number', 'number', 'number', 'number', 'number']),
|
||||
decodeBuffer: Module.cwrap("decode", 'number', ['number', 'number', 'number', 'number'])
|
||||
updateBuffer: Module.cwrap("update", 'number', ['number', 'number', 'number', 'number', 'number']),
|
||||
decodeBuffer: Module.cwrap("decode", 'number', ['number', 'number', 'number'])
|
||||
};
|
||||
};
|
||||
|
||||
wasm_update = function(msg) {
|
||||
var datain, dataout, flag, h, p, po, size, tmp, w, x, y;
|
||||
var bbp, datain, dataout, flag, h, p, po, size, tmp, w, x, y;
|
||||
datain = new Uint8Array(msg);
|
||||
x = datain[1] | (datain[2] << 8);
|
||||
y = datain[3] | (datain[4] << 8);
|
||||
w = datain[5] | (datain[6] << 8);
|
||||
h = datain[7] | (datain[8] << 8);
|
||||
flag = datain[9];
|
||||
flag = datain[9] & 0x01;
|
||||
bbp = datain[9] & 0xFE;
|
||||
msg = {};
|
||||
msg.pixels = void 0;
|
||||
msg.x = x;
|
||||
@ -31,13 +32,10 @@
|
||||
msg.w = w;
|
||||
msg.h = h;
|
||||
size = w * h * 4;
|
||||
tmp = new Uint8Array(size);
|
||||
if (flag === 0) {
|
||||
tmp.set(datain.subarray(10), 0);
|
||||
msg.pixels = tmp.buffer;
|
||||
postMessage(msg, [msg.pixels]);
|
||||
if (size === 0) {
|
||||
return;
|
||||
}
|
||||
tmp = new Uint8Array(size);
|
||||
p = api.createBuffer(datain.length);
|
||||
Module.HEAP8.set(datain, p);
|
||||
po = api.decodeBuffer(p, datain.length, size);
|
||||
@ -45,12 +43,14 @@
|
||||
tmp.set(dataout, 0);
|
||||
msg.pixels = tmp.buffer;
|
||||
postMessage(msg, [msg.pixels]);
|
||||
api.destroyBuffer(po);
|
||||
return api.destroyBuffer(p);
|
||||
api.destroyBuffer(p);
|
||||
if (flag !== 0x0 || bbp !== 32) {
|
||||
return api.destroyBuffer(po);
|
||||
}
|
||||
};
|
||||
|
||||
onmessage = function(e) {
|
||||
if (e.data.depth) {
|
||||
if (e.data.width) {
|
||||
return resolution = e.data;
|
||||
} else {
|
||||
return wasm_update(e.data);
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user