rewrite quic.js to be a native javascript implementation

There remain a few TODOs including implementing more than just rgb32 images

Signed-off-by: Aric Stewart <aric@codeweavers.com>
This commit is contained in:
Aric Stewart 2012-09-13 18:32:38 +03:00 committed by Alon Levy
parent 7ebc4d019a
commit b4ab3ac5e9
7 changed files with 1136 additions and 34606 deletions

8
TODO
View File

@ -28,9 +28,6 @@ Medium Tasks:
. Use the 'real' DataView if we have it
. Remove main() from quic.c and respin it
- It's causing unneeded bloat and memory use.
. Consider passing a status change event back to the front end
(e.g. indicators for numlock, connection status, all that jazz)
@ -71,11 +68,6 @@ Big Tasks:
. Profile the whole mess
- Initial profiling suggests image decompression is the big hog
. Quic: faster implementations
* current implementation is approximately 13x slower
than equivalent C code. Should be able to do
much better than that.
. Implement agent support
. Build a test suite for measuring performance

View File

@ -50,9 +50,6 @@ function stripAlpha(d)
d.data[i + 3] = 255;
}
// FIXME - this is a hack for quic.js, I should fix this...
var global_ctx;
/*----------------------------------------------------------------------------
** SpiceDisplayConn
** Drive the Spice Display Channel
@ -108,16 +105,19 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg)
if (draw_copy.data.src_bitmap.descriptor.type == SPICE_IMAGE_TYPE_QUIC)
{
var canvas = this.surfaces[draw_copy.base.surface_id].canvas;
if (! draw_copy.data.src_bitmap.quic)
{
this.log_warn("FIXME: DrawCopy could not handle this QUIC file.");
return false;
}
var source_img = convert_spice_quic_to_web(canvas.context,
draw_copy.data.src_bitmap.quic);
return this.draw_copy_helper(
{ base: draw_copy.base,
src_area: draw_copy.data.src_area,
image_data: draw_copy.data.src_bitmap.quic.imgData,
image_data: source_img,
tag: "copyquic." + draw_copy.data.src_bitmap.quic.type,
has_alpha: (draw_copy.data.src_bitmap.quic.type == QUIC_IMAGE_TYPE_RGBA ? true : false) ,
descriptor : draw_copy.data.src_bitmap.descriptor
@ -404,7 +404,6 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg)
/* This .save() is done entirely to enable SPICE_MSG_DISPLAY_RESET */
canvas.context.save();
global_ctx = canvas.context; // FIXME - this is a hack entirely for the emscripten quic.js
document.getElementById(this.parent.screen_id).appendChild(canvas);
document.getElementById(this.parent.screen_id).setAttribute('width', m.surface.width);
document.getElementById(this.parent.screen_id).setAttribute('height', m.surface.height);

View File

@ -1,8 +0,0 @@
./emcc -o quic.js --shell-file quic.shell quic.c
echo Okay, quic.js is partly ready. Three things to do:
echo 1. In function _quic_decode_js, after the call to simple_quic_decode,
echo add the code as given by quic.shell
echo 2. Delete the run() 3 line block near the bottom.
echo 3. Add the getQuic() function to the bottom (see quic.shell)

7364
quic.c

File diff suppressed because one or more lines are too long

28148
quic.js

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -236,14 +236,8 @@ SpiceImage.prototype =
if (this.descriptor.type == SPICE_IMAGE_TYPE_QUIC)
{
var tmparr = [];
var i;
this.quicr_length = dv.getUint32(at, true); at += 4;
var qdv = new Uint8Array(mb.slice(at));
for (i = 0; i < qdv.length; i++)
tmparr[i] = qdv[i];
this.quic = getQuic(tmparr);
at += qdv.length;
this.quic = new SpiceQuic;
at = this.quic.from_dv(dv, at, mb);
}
return at;
},