MCPcopy Create free account
hub / github.com/apache/cloudstack / decodeRect

Method decodeRect

systemvm/agent/noVNC/core/decoders/zlib.js:18–50  ·  view source on GitHub ↗
(x, y, width, height, sock, display, depth)

Source from the content-addressed store, hash-verified

16 }
17
18 decodeRect(x, y, width, height, sock, display, depth) {
19 if ((width === 0) || (height === 0)) {
20 return true;
21 }
22
23 if (this._length === 0) {
24 if (sock.rQwait("ZLIB", 4)) {
25 return false;
26 }
27
28 this._length = sock.rQshift32();
29 }
30
31 if (sock.rQwait("ZLIB", this._length)) {
32 return false;
33 }
34
35 let data = new Uint8Array(sock.rQshiftBytes(this._length, false));
36 this._length = 0;
37
38 this._zlib.setInput(data);
39 data = this._zlib.inflate(width * height * 4);
40 this._zlib.setInput(null);
41
42 // Max sure the image is fully opaque
43 for (let i = 0; i < width * height; i++) {
44 data[i * 4 + 3] = 255;
45 }
46
47 display.blitImage(x, y, width, height, data, 0);
48
49 return true;
50 }
51}

Callers

nothing calls this directly

Calls 6

rQwaitMethod · 0.80
rQshift32Method · 0.80
rQshiftBytesMethod · 0.80
setInputMethod · 0.80
inflateMethod · 0.80
blitImageMethod · 0.80

Tested by

no test coverage detected