broadway: Use zlib compression for broadway buffers

This imports the MIT licensed js unzip from:
https://github.com/imaya/zlib.js

and uses it to decompress in js on the client side.
This commit is contained in:
Alexander Larsson
2013-11-07 13:54:54 +01:00
parent 5ef114ba42
commit 149b3af105
5 changed files with 58 additions and 35 deletions

View File

@ -329,7 +329,7 @@ function copyRect(src, srcX, srcY, dest, destX, destY, width, height)
}
}
function cmdPutBuffer(id, w, h, data)
function cmdPutBuffer(id, w, h, compressed)
{
var surface = surfaces[id];
var context = surface.canvas.getContext("2d");
@ -345,7 +345,8 @@ function cmdPutBuffer(id, w, h, data)
var src = 0;
var dest = 0;
//log("put buffer " + w + "x" + h + " size: " + data.length);
var inflate = new Zlib.RawInflate(compressed);
var data = inflate.decompress();
while (src < data.length) {
var b = data[src++];