[Spice-devel] [PATCH spice-html5]Handling non top-down lz_rgb
Vincent Desprez
vincent.desprez at apwise.com
Wed Jan 16 08:54:11 PST 2013
Hi,
In order to make spice-html5 working with windows guest and qxl driver, I
made a patch to handle non top-down lz_rgb. I don’t know if it is possible
to make it more efficient but tests showed the result is responsive enough.
However I still have glitches in my screen (that I didn’t have without the
qxl driver) and cannot find where it comes from. Any idea? Of course I can
provide screenshots if needed.
Vincent
--- a/lz.js 2012-11-11 23:31:54.000000000 +0100
+++ b/lz.js 2013-01-16 15:05:56.000000000 +0100
@@ -141,6 +141,27 @@
return encoder - 1;
}
+function flip_image_data(img)
+{
+ var w = img.width;
+ var h = img.height;
+ var temp_w = w;
+ var temp_h = h;
+ var buff = new Uint8Array(img.width * img.height * 4);
+ while (temp_h--)
+ {
+ while (temp_w--)
+ {
+ buff[(temp_h * w + temp_w) * 4] = img.data[((h - temp_h - 1) *
w + temp_w) * 4];
+ buff[(temp_h * w + temp_w) * 4 + 1] = img.data[((h - temp_h -
1) * w + temp_w) * 4 + 1];
+ buff[(temp_h * w + temp_w) * 4 + 2] = img.data[((h - temp_h -
1) * w + temp_w) * 4 + 2];
+ buff[(temp_h * w + temp_w) * 4 + 3] = img.data[((h - temp_h -
1) * w + temp_w) * 4 + 3];
+ }
+ temp_w = w;
+ }
+ img.data.set(buff);
+}
+
function convert_spice_lz_rgb_to_web(context, lz_rgb)
{
var u8 = new Uint8Array(lz_rgb.data);
@@ -151,6 +172,9 @@
var ret = context.createImageData(lz_rgb.width, lz_rgb.height);
at = lz_rgb32_decompress(u8, 0, ret.data, LZ_IMAGE_TYPE_RGB32,
lz_rgb.type != LZ_IMAGE_TYPE_RGBA);
+ if (! lz_rgb.top_down)
+ flip_image_data(ret);
+
if (lz_rgb.type == LZ_IMAGE_TYPE_RGBA)
lz_rgb32_decompress(u8, at, ret.data, LZ_IMAGE_TYPE_RGBA, false);
--- a/display.js 2012-11-11 23:31:54.000000000 +0100
+++ b/display.js 2013-01-16 15:48:12.000000000 +0100
@@ -243,9 +243,6 @@
return false;
}
- if (draw_copy.data.src_bitmap.lz_rgb.top_down != 1)
- this.log_warn("FIXME: Implement non top down support
for lz_rgb");
-
var source_img =
convert_spice_lz_rgb_to_web(canvas.context,
draw_copy.data.src_bitmap.lz_rgb);
if (! source_img)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130116/731cd398/attachment.html>
More information about the Spice-devel
mailing list