SPB Git forge

spb/admin-ka

Public
41commits 1branches 0releases
172.9 MBsize
maindefault branch
19 days agolast push
JavaScript 65.5% Python 17.8% CSS 13% HTML 3.7%
2.9 KB · 66 lines javascript
Raw Blame History
1"use strict";23Object.defineProperty(exports, "__esModule", {4  value: true5});6exports["default"] = void 0;7function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }8function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }9function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }10function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }11function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }12function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }13/*14 * noVNC: HTML5 VNC client15 * Copyright (C) 2019 The noVNC authors16 * Licensed under MPL 2.0 (see LICENSE.txt)17 *18 * See README.md for usage and integration instructions.19 *20 */21var RawDecoder = exports["default"] = /*#__PURE__*/function () {22  function RawDecoder() {23    _classCallCheck(this, RawDecoder);24    this._lines = 0;25  }26  return _createClass(RawDecoder, [{27    key: "decodeRect",28    value: function decodeRect(x, y, width, height, sock, display, depth) {29      if (width === 0 || height === 0) {30        return true;31      }32      if (this._lines === 0) {33        this._lines = height;34      }35      var pixelSize = depth == 8 ? 1 : 4;36      var bytesPerLine = width * pixelSize;37      while (this._lines > 0) {38        if (sock.rQwait("RAW", bytesPerLine)) {39          return false;40        }41        var curY = y + (height - this._lines);42        var data = sock.rQshiftBytes(bytesPerLine, false);4344        // Convert data if needed45        if (depth == 8) {46          var newdata = new Uint8Array(width * 4);47          for (var i = 0; i < width; i++) {48            newdata[i * 4 + 0] = (data[i] >> 0 & 0x3) * 255 / 3;49            newdata[i * 4 + 1] = (data[i] >> 2 & 0x3) * 255 / 3;50            newdata[i * 4 + 2] = (data[i] >> 4 & 0x3) * 255 / 3;51            newdata[i * 4 + 3] = 255;52          }53          data = newdata;54        }5556        // Max sure the image is fully opaque57        for (var _i = 0; _i < width; _i++) {58          data[_i * 4 + 3] = 255;59        }60        display.blitImage(x, curY, width, 1, data, 0);61        this._lines--;62      }63      return true;64    }65  }]);66}();