JavaScript 65.5%
Python 17.8%
CSS 13%
HTML 3.7%
1/*2 * noVNC: HTML5 VNC client3 * Copyright (C) 2019 The noVNC authors4 * Licensed under MPL 2.0 (see LICENSE.txt)5 *6 * See README.md for usage and integration instructions.7 *8 */910export default class RawDecoder {11 constructor() {12 this._lines = 0;13 }1415 decodeRect(x, y, width, height, sock, display, depth) {16 if ((width === 0) || (height === 0)) {17 return true;18 }1920 if (this._lines === 0) {21 this._lines = height;22 }2324 const pixelSize = depth == 8 ? 1 : 4;25 const bytesPerLine = width * pixelSize;2627 while (this._lines > 0) {28 if (sock.rQwait("RAW", bytesPerLine)) {29 return false;30 }3132 const curY = y + (height - this._lines);3334 let data = sock.rQshiftBytes(bytesPerLine, false);3536 // Convert data if needed37 if (depth == 8) {38 const newdata = new Uint8Array(width * 4);39 for (let i = 0; i < width; i++) {40 newdata[i * 4 + 0] = ((data[i] >> 0) & 0x3) * 255 / 3;41 newdata[i * 4 + 1] = ((data[i] >> 2) & 0x3) * 255 / 3;42 newdata[i * 4 + 2] = ((data[i] >> 4) & 0x3) * 255 / 3;43 newdata[i * 4 + 3] = 255;44 }45 data = newdata;46 }4748 // Max sure the image is fully opaque49 for (let i = 0; i < width; i++) {50 data[i * 4 + 3] = 255;51 }5253 display.blitImage(x, curY, width, 1, data, 0);54 this._lines--;55 }5657 return true;58 }59}60