JavaScript 65.5%
Python 17.8%
CSS 13%
HTML 3.7%
1/*2 * noVNC: HTML5 VNC client3 * Copyright (C) 2024 The noVNC authors4 * Licensed under MPL 2.0 (see LICENSE.txt)5 *6 * See README.md for usage and integration instructions.7 *8 */910import Inflator from "../inflator.js";1112export default class ZlibDecoder {13 constructor() {14 this._zlib = new Inflator();15 this._length = 0;16 }1718 decodeRect(x, y, width, height, sock, display, depth) {19 if ((width === 0) || (height === 0)) {20 return true;21 }2223 if (this._length === 0) {24 if (sock.rQwait("ZLIB", 4)) {25 return false;26 }2728 this._length = sock.rQshift32();29 }3031 if (sock.rQwait("ZLIB", this._length)) {32 return false;33 }3435 let data = new Uint8Array(sock.rQshiftBytes(this._length, false));36 this._length = 0;3738 this._zlib.setInput(data);39 data = this._zlib.inflate(width * height * 4);40 this._zlib.setInput(null);4142 // Max sure the image is fully opaque43 for (let i = 0; i < width * height; i++) {44 data[i * 4 + 3] = 255;45 }4647 display.blitImage(x, y, width, height, data, 0);4849 return true;50 }51}52