mirror of
https://github.com/kasmtech/KasmVNC.git
synced 2025-02-02 19:49:12 +01:00
Split api of inflate
Added ability to read data chunk wise.
This commit is contained in:
parent
dbe2930758
commit
9ca647667b
@ -174,7 +174,9 @@ export default class TightDecoder {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = this._zlibs[streamId].inflate(data, uncompressedSize);
|
this._zlibs[streamId].setInput(data);
|
||||||
|
data = this._zlibs[streamId].inflate(uncompressedSize);
|
||||||
|
this._zlibs[streamId].setInput(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
display.blitRgbImage(x, y, width, height, data, 0, false);
|
display.blitRgbImage(x, y, width, height, data, 0, false);
|
||||||
@ -219,7 +221,9 @@ export default class TightDecoder {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = this._zlibs[streamId].inflate(data, uncompressedSize);
|
this._zlibs[streamId].setInput(data);
|
||||||
|
data = this._zlibs[streamId].inflate(uncompressedSize);
|
||||||
|
this._zlibs[streamId].setInput(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert indexed (palette based) image data to RGB
|
// Convert indexed (palette based) image data to RGB
|
||||||
|
@ -19,12 +19,20 @@ export default class Inflate {
|
|||||||
inflateInit(this.strm, this.windowBits);
|
inflateInit(this.strm, this.windowBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
inflate(data, expected) {
|
setInput(data) {
|
||||||
|
if (!data) {
|
||||||
|
//FIXME: flush remaining data.
|
||||||
|
this.strm.input = null;
|
||||||
|
this.strm.avail_in = 0;
|
||||||
|
this.strm.next_in = 0;
|
||||||
|
} else {
|
||||||
this.strm.input = data;
|
this.strm.input = data;
|
||||||
this.strm.avail_in = this.strm.input.length;
|
this.strm.avail_in = this.strm.input.length;
|
||||||
this.strm.next_in = 0;
|
this.strm.next_in = 0;
|
||||||
this.strm.next_out = 0;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inflate(expected) {
|
||||||
// resize our output buffer if it's too small
|
// resize our output buffer if it's too small
|
||||||
// (we could just use multiple chunks, but that would cause an extra
|
// (we could just use multiple chunks, but that would cause an extra
|
||||||
// allocation each time to flatten the chunks)
|
// allocation each time to flatten the chunks)
|
||||||
@ -33,6 +41,7 @@ export default class Inflate {
|
|||||||
this.strm.output = new Uint8Array(this.chunkSize);
|
this.strm.output = new Uint8Array(this.chunkSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.strm.next_out = 0;
|
||||||
this.strm.avail_out = this.chunkSize;
|
this.strm.avail_out = this.chunkSize;
|
||||||
|
|
||||||
let ret = inflate(this.strm, 0); // Flush argument not used.
|
let ret = inflate(this.strm, 0); // Flush argument not used.
|
||||||
|
Loading…
Reference in New Issue
Block a user