1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-28 19:21:10 +00:00

spice-html5 updated.

This commit is contained in:
catborise 2018-08-08 14:00:35 +03:00
parent 12c80c5021
commit b05a252d7c
36 changed files with 1356 additions and 1415 deletions
static/js/spice-html5

16
static/js/spice-html5/lz.js Normal file → Executable file
View file

@ -141,6 +141,19 @@ function lz_rgb32_decompress(in_buf, at, out_buf, type, default_alpha)
return encoder - 1;
}
function flip_image_data(img)
{
var wb = img.width * 4;
var h = img.height;
var temp_h = h;
var buff = new Uint8Array(img.width * img.height * 4);
while (temp_h--)
{
buff.set(img.data.subarray(temp_h * wb, (temp_h + 1) * wb), (h - temp_h - 1) * wb);
}
img.data.set(buff);
}
function convert_spice_lz_to_web(context, lz_image)
{
var at;
@ -150,6 +163,9 @@ function convert_spice_lz_to_web(context, lz_image)
var ret = context.createImageData(lz_image.width, lz_image.height);
at = lz_rgb32_decompress(u8, 0, ret.data, LZ_IMAGE_TYPE_RGB32, lz_image.type != LZ_IMAGE_TYPE_RGBA);
if (!lz_image.top_down)
flip_image_data(ret);
if (lz_image.type == LZ_IMAGE_TYPE_RGBA)
lz_rgb32_decompress(u8, at, ret.data, LZ_IMAGE_TYPE_RGBA, false);
}