@novnc/novnc 1.2.0-test → 1.3.0-g1075cd8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +0 -6
- package/README.md +16 -6
- package/core/decoders/copyrect.js +5 -0
- package/core/decoders/hextile.js +57 -3
- package/core/decoders/jpeg.js +141 -0
- package/core/decoders/raw.js +12 -2
- package/core/decoders/tight.js +24 -8
- package/core/decoders/zrle.js +185 -0
- package/core/display.js +9 -151
- package/core/encodings.js +4 -0
- package/core/input/domkeytable.js +25 -21
- package/core/input/keyboard.js +12 -127
- package/core/input/util.js +18 -35
- package/core/input/vkeys.js +0 -1
- package/core/input/xtscancodes.js +5 -3
- package/core/ra2.js +567 -0
- package/core/rfb.js +332 -114
- package/core/util/browser.js +0 -17
- package/core/util/cursor.js +1 -11
- package/core/util/events.js +0 -4
- package/core/util/md5.js +79 -0
- package/core/websock.js +76 -17
- package/docs/API.md +46 -6
- package/docs/LIBRARY.md +3 -7
- package/lib/base64.js +5 -5
- package/lib/decoders/copyrect.js +8 -3
- package/lib/decoders/hextile.js +65 -9
- package/lib/decoders/jpeg.js +188 -0
- package/lib/decoders/raw.js +14 -5
- package/lib/decoders/rre.js +3 -3
- package/lib/decoders/tight.js +40 -22
- package/lib/decoders/tightpng.js +10 -10
- package/lib/decoders/zrle.js +234 -0
- package/lib/deflator.js +5 -5
- package/lib/des.js +3 -3
- package/lib/display.js +47 -214
- package/lib/encodings.js +8 -0
- package/lib/inflator.js +5 -5
- package/lib/input/domkeytable.js +197 -194
- package/lib/input/fixedkeys.js +2 -2
- package/lib/input/gesturehandler.js +3 -3
- package/lib/input/keyboard.js +40 -160
- package/lib/input/keysym.js +2 -2
- package/lib/input/keysymdef.js +2 -2
- package/lib/input/util.js +35 -80
- package/lib/input/vkeys.js +2 -4
- package/lib/input/xtscancodes.js +11 -5
- package/lib/ra2.js +1257 -0
- package/lib/rfb.js +656 -306
- package/lib/util/browser.js +9 -27
- package/lib/util/cursor.js +5 -17
- package/lib/util/events.js +3 -5
- package/lib/util/eventtarget.js +4 -4
- package/lib/util/int.js +1 -1
- package/lib/util/logging.js +2 -2
- package/lib/util/md5.js +103 -0
- package/lib/vendor/pako/lib/utils/common.js +2 -2
- package/lib/vendor/pako/lib/zlib/adler32.js +1 -1
- package/lib/vendor/pako/lib/zlib/constants.js +2 -2
- package/lib/vendor/pako/lib/zlib/crc32.js +1 -1
- package/lib/vendor/pako/lib/zlib/deflate.js +114 -113
- package/lib/vendor/pako/lib/zlib/gzheader.js +1 -1
- package/lib/vendor/pako/lib/zlib/inffast.js +5 -5
- package/lib/vendor/pako/lib/zlib/inflate.js +51 -49
- package/lib/vendor/pako/lib/zlib/inftrees.js +4 -4
- package/lib/vendor/pako/lib/zlib/messages.js +2 -2
- package/lib/vendor/pako/lib/zlib/trees.js +5 -5
- package/lib/vendor/pako/lib/zlib/zstream.js +1 -1
- package/lib/websock.js +107 -46
- package/package.json +2 -10
- package/core/util/polyfill.js +0 -61
- package/lib/util/polyfill.js +0 -72
- package/lib/vendor/promise.js +0 -255
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
|
+
|
|
10
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
11
|
+
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
|
+
|
|
14
|
+
/*
|
|
15
|
+
* noVNC: HTML5 VNC client
|
|
16
|
+
* Copyright (C) 2019 The noVNC Authors
|
|
17
|
+
* Licensed under MPL 2.0 (see LICENSE.txt)
|
|
18
|
+
*
|
|
19
|
+
* See README.md for usage and integration instructions.
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
var JPEGDecoder = /*#__PURE__*/function () {
|
|
23
|
+
function JPEGDecoder() {
|
|
24
|
+
_classCallCheck(this, JPEGDecoder);
|
|
25
|
+
|
|
26
|
+
// RealVNC will reuse the quantization tables
|
|
27
|
+
// and Huffman tables, so we need to cache them.
|
|
28
|
+
this._quantTables = [];
|
|
29
|
+
this._huffmanTables = [];
|
|
30
|
+
this._cachedQuantTables = [];
|
|
31
|
+
this._cachedHuffmanTables = [];
|
|
32
|
+
this._jpegLength = 0;
|
|
33
|
+
this._segments = [];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
_createClass(JPEGDecoder, [{
|
|
37
|
+
key: "decodeRect",
|
|
38
|
+
value: function decodeRect(x, y, width, height, sock, display, depth) {
|
|
39
|
+
// A rect of JPEG encodings is simply a JPEG file
|
|
40
|
+
if (!this._parseJPEG(sock.rQslice(0))) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var data = sock.rQshiftBytes(this._jpegLength);
|
|
45
|
+
|
|
46
|
+
if (this._quantTables.length != 0 && this._huffmanTables.length != 0) {
|
|
47
|
+
// If there are quantization tables and Huffman tables in the JPEG
|
|
48
|
+
// image, we can directly render it.
|
|
49
|
+
display.imageRect(x, y, width, height, "image/jpeg", data);
|
|
50
|
+
return true;
|
|
51
|
+
} else {
|
|
52
|
+
// Otherwise we need to insert cached tables.
|
|
53
|
+
var sofIndex = this._segments.findIndex(function (x) {
|
|
54
|
+
return x[1] == 0xC0 || x[1] == 0xC2;
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
if (sofIndex == -1) {
|
|
58
|
+
throw new Error("Illegal JPEG image without SOF");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var segments = this._segments.slice(0, sofIndex);
|
|
62
|
+
|
|
63
|
+
segments = segments.concat(this._quantTables.length ? this._quantTables : this._cachedQuantTables);
|
|
64
|
+
segments.push(this._segments[sofIndex]);
|
|
65
|
+
segments = segments.concat(this._huffmanTables.length ? this._huffmanTables : this._cachedHuffmanTables, this._segments.slice(sofIndex + 1));
|
|
66
|
+
var length = 0;
|
|
67
|
+
|
|
68
|
+
for (var i = 0; i < segments.length; i++) {
|
|
69
|
+
length += segments[i].length;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
var _data = new Uint8Array(length);
|
|
73
|
+
|
|
74
|
+
length = 0;
|
|
75
|
+
|
|
76
|
+
for (var _i = 0; _i < segments.length; _i++) {
|
|
77
|
+
_data.set(segments[_i], length);
|
|
78
|
+
|
|
79
|
+
length += segments[_i].length;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
display.imageRect(x, y, width, height, "image/jpeg", _data);
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, {
|
|
87
|
+
key: "_parseJPEG",
|
|
88
|
+
value: function _parseJPEG(buffer) {
|
|
89
|
+
if (this._quantTables.length != 0) {
|
|
90
|
+
this._cachedQuantTables = this._quantTables;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (this._huffmanTables.length != 0) {
|
|
94
|
+
this._cachedHuffmanTables = this._huffmanTables;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
this._quantTables = [];
|
|
98
|
+
this._huffmanTables = [];
|
|
99
|
+
this._segments = [];
|
|
100
|
+
var i = 0;
|
|
101
|
+
var bufferLength = buffer.length;
|
|
102
|
+
|
|
103
|
+
while (true) {
|
|
104
|
+
var j = i;
|
|
105
|
+
|
|
106
|
+
if (j + 2 > bufferLength) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (buffer[j] != 0xFF) {
|
|
111
|
+
throw new Error("Illegal JPEG marker received (byte: " + buffer[j] + ")");
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
var type = buffer[j + 1];
|
|
115
|
+
j += 2;
|
|
116
|
+
|
|
117
|
+
if (type == 0xD9) {
|
|
118
|
+
this._jpegLength = j;
|
|
119
|
+
|
|
120
|
+
this._segments.push(buffer.slice(i, j));
|
|
121
|
+
|
|
122
|
+
return true;
|
|
123
|
+
} else if (type == 0xDA) {
|
|
124
|
+
// start of scan
|
|
125
|
+
var hasFoundEndOfScan = false;
|
|
126
|
+
|
|
127
|
+
for (var k = j + 3; k + 1 < bufferLength; k++) {
|
|
128
|
+
if (buffer[k] == 0xFF && buffer[k + 1] != 0x00 && !(buffer[k + 1] >= 0xD0 && buffer[k + 1] <= 0xD7)) {
|
|
129
|
+
j = k;
|
|
130
|
+
hasFoundEndOfScan = true;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (!hasFoundEndOfScan) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
this._segments.push(buffer.slice(i, j));
|
|
140
|
+
|
|
141
|
+
i = j;
|
|
142
|
+
continue;
|
|
143
|
+
} else if (type >= 0xD0 && type < 0xD9 || type == 0x01) {
|
|
144
|
+
// No length after marker
|
|
145
|
+
this._segments.push(buffer.slice(i, j));
|
|
146
|
+
|
|
147
|
+
i = j;
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (j + 2 > bufferLength) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
var length = (buffer[j] << 8) + buffer[j + 1] - 2;
|
|
156
|
+
|
|
157
|
+
if (length < 0) {
|
|
158
|
+
throw new Error("Illegal JPEG length received (length: " + length + ")");
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
j += 2;
|
|
162
|
+
|
|
163
|
+
if (j + length > bufferLength) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
j += length;
|
|
168
|
+
var segment = buffer.slice(i, j);
|
|
169
|
+
|
|
170
|
+
if (type == 0xC4) {
|
|
171
|
+
// Huffman tables
|
|
172
|
+
this._huffmanTables.push(segment);
|
|
173
|
+
} else if (type == 0xDB) {
|
|
174
|
+
// Quantization tables
|
|
175
|
+
this._quantTables.push(segment);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
this._segments.push(segment);
|
|
179
|
+
|
|
180
|
+
i = j;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}]);
|
|
184
|
+
|
|
185
|
+
return JPEGDecoder;
|
|
186
|
+
}();
|
|
187
|
+
|
|
188
|
+
exports["default"] = JPEGDecoder;
|
package/lib/decoders/raw.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = void 0;
|
|
7
7
|
|
|
8
8
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
9
|
|
|
10
10
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
11
11
|
|
|
12
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
13
|
|
|
14
14
|
/*
|
|
15
15
|
* noVNC: HTML5 VNC client
|
|
@@ -29,6 +29,10 @@ var RawDecoder = /*#__PURE__*/function () {
|
|
|
29
29
|
_createClass(RawDecoder, [{
|
|
30
30
|
key: "decodeRect",
|
|
31
31
|
value: function decodeRect(x, y, width, height, sock, display, depth) {
|
|
32
|
+
if (width === 0 || height === 0) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
|
|
32
36
|
if (this._lines === 0) {
|
|
33
37
|
this._lines = height;
|
|
34
38
|
}
|
|
@@ -42,22 +46,27 @@ var RawDecoder = /*#__PURE__*/function () {
|
|
|
42
46
|
|
|
43
47
|
var curY = y + (height - this._lines);
|
|
44
48
|
var currHeight = Math.min(this._lines, Math.floor(sock.rQlen / bytesPerLine));
|
|
49
|
+
var pixels = width * currHeight;
|
|
45
50
|
var data = sock.rQ;
|
|
46
51
|
var index = sock.rQi; // Convert data if needed
|
|
47
52
|
|
|
48
53
|
if (depth == 8) {
|
|
49
|
-
var pixels = width * currHeight;
|
|
50
54
|
var newdata = new Uint8Array(pixels * 4);
|
|
51
55
|
|
|
52
56
|
for (var i = 0; i < pixels; i++) {
|
|
53
57
|
newdata[i * 4 + 0] = (data[index + i] >> 0 & 0x3) * 255 / 3;
|
|
54
58
|
newdata[i * 4 + 1] = (data[index + i] >> 2 & 0x3) * 255 / 3;
|
|
55
59
|
newdata[i * 4 + 2] = (data[index + i] >> 4 & 0x3) * 255 / 3;
|
|
56
|
-
newdata[i * 4 +
|
|
60
|
+
newdata[i * 4 + 3] = 255;
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
data = newdata;
|
|
60
64
|
index = 0;
|
|
65
|
+
} // Max sure the image is fully opaque
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
for (var _i = 0; _i < pixels; _i++) {
|
|
69
|
+
data[index + _i * 4 + 3] = 255;
|
|
61
70
|
}
|
|
62
71
|
|
|
63
72
|
display.blitImage(x, curY, width, currHeight, data, index);
|
|
@@ -75,4 +84,4 @@ var RawDecoder = /*#__PURE__*/function () {
|
|
|
75
84
|
return RawDecoder;
|
|
76
85
|
}();
|
|
77
86
|
|
|
78
|
-
exports
|
|
87
|
+
exports["default"] = RawDecoder;
|
package/lib/decoders/rre.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports["default"] = void 0;
|
|
7
7
|
|
|
8
8
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
9
9
|
|
|
10
10
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
11
11
|
|
|
12
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
12
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
13
13
|
|
|
14
14
|
/*
|
|
15
15
|
* noVNC: HTML5 VNC client
|
|
@@ -62,4 +62,4 @@ var RREDecoder = /*#__PURE__*/function () {
|
|
|
62
62
|
return RREDecoder;
|
|
63
63
|
}();
|
|
64
64
|
|
|
65
|
-
exports
|
|
65
|
+
exports["default"] = RREDecoder;
|
package/lib/decoders/tight.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof";
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports
|
|
8
|
+
exports["default"] = void 0;
|
|
9
9
|
|
|
10
10
|
var Log = _interopRequireWildcard(require("../util/logging.js"));
|
|
11
11
|
|
|
12
12
|
var _inflator = _interopRequireDefault(require("../inflator.js"));
|
|
13
13
|
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
15
|
|
|
16
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
17
|
|
|
18
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj
|
|
18
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
19
|
|
|
20
20
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
21
21
|
|
|
22
22
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
23
23
|
|
|
24
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
24
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
25
25
|
|
|
26
26
|
var TightDecoder = /*#__PURE__*/function () {
|
|
27
27
|
function TightDecoder() {
|
|
@@ -36,7 +36,7 @@ var TightDecoder = /*#__PURE__*/function () {
|
|
|
36
36
|
this._zlibs = [];
|
|
37
37
|
|
|
38
38
|
for (var i = 0; i < 4; i++) {
|
|
39
|
-
this._zlibs[i] = new _inflator
|
|
39
|
+
this._zlibs[i] = new _inflator["default"]();
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -70,7 +70,7 @@ var TightDecoder = /*#__PURE__*/function () {
|
|
|
70
70
|
ret = this._jpegRect(x, y, width, height, sock, display, depth);
|
|
71
71
|
} else if (this._ctl === 0x0A) {
|
|
72
72
|
ret = this._pngRect(x, y, width, height, sock, display, depth);
|
|
73
|
-
} else if ((this._ctl &
|
|
73
|
+
} else if ((this._ctl & 0x08) == 0) {
|
|
74
74
|
ret = this._basicRect(this._ctl, x, y, width, height, sock, display, depth);
|
|
75
75
|
} else {
|
|
76
76
|
throw new Error("Illegal tight compression received (ctl: " + this._ctl + ")");
|
|
@@ -91,7 +91,7 @@ var TightDecoder = /*#__PURE__*/function () {
|
|
|
91
91
|
|
|
92
92
|
var rQi = sock.rQi;
|
|
93
93
|
var rQ = sock.rQ;
|
|
94
|
-
display.fillRect(x, y, width, height, [rQ[rQi
|
|
94
|
+
display.fillRect(x, y, width, height, [rQ[rQi], rQ[rQi + 1], rQ[rQi + 2]], false);
|
|
95
95
|
sock.rQskipBytes(3);
|
|
96
96
|
return true;
|
|
97
97
|
}
|
|
@@ -163,6 +163,10 @@ var TightDecoder = /*#__PURE__*/function () {
|
|
|
163
163
|
var uncompressedSize = width * height * 3;
|
|
164
164
|
var data;
|
|
165
165
|
|
|
166
|
+
if (uncompressedSize === 0) {
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
|
|
166
170
|
if (uncompressedSize < 12) {
|
|
167
171
|
if (sock.rQwait("TIGHT", uncompressedSize)) {
|
|
168
172
|
return false;
|
|
@@ -183,7 +187,16 @@ var TightDecoder = /*#__PURE__*/function () {
|
|
|
183
187
|
this._zlibs[streamId].setInput(null);
|
|
184
188
|
}
|
|
185
189
|
|
|
186
|
-
|
|
190
|
+
var rgbx = new Uint8Array(width * height * 4);
|
|
191
|
+
|
|
192
|
+
for (var i = 0, j = 0; i < width * height * 4; i += 4, j += 3) {
|
|
193
|
+
rgbx[i] = data[j];
|
|
194
|
+
rgbx[i + 1] = data[j + 1];
|
|
195
|
+
rgbx[i + 2] = data[j + 2];
|
|
196
|
+
rgbx[i + 3] = 255; // Alpha
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
display.blitImage(x, y, width, height, rgbx, 0, false);
|
|
187
200
|
return true;
|
|
188
201
|
}
|
|
189
202
|
}, {
|
|
@@ -211,6 +224,10 @@ var TightDecoder = /*#__PURE__*/function () {
|
|
|
211
224
|
var uncompressedSize = rowSize * height;
|
|
212
225
|
var data;
|
|
213
226
|
|
|
227
|
+
if (uncompressedSize === 0) {
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
|
|
214
231
|
if (uncompressedSize < 12) {
|
|
215
232
|
if (sock.rQwait("TIGHT", uncompressedSize)) {
|
|
216
233
|
return false;
|
|
@@ -277,7 +294,7 @@ var TightDecoder = /*#__PURE__*/function () {
|
|
|
277
294
|
}
|
|
278
295
|
}
|
|
279
296
|
|
|
280
|
-
display.
|
|
297
|
+
display.blitImage(x, y, width, height, dest, 0, false);
|
|
281
298
|
}
|
|
282
299
|
}, {
|
|
283
300
|
key: "_paletteRect",
|
|
@@ -295,7 +312,7 @@ var TightDecoder = /*#__PURE__*/function () {
|
|
|
295
312
|
dest[i + 3] = 255;
|
|
296
313
|
}
|
|
297
314
|
|
|
298
|
-
display.
|
|
315
|
+
display.blitImage(x, y, width, height, dest, 0, false);
|
|
299
316
|
}
|
|
300
317
|
}, {
|
|
301
318
|
key: "_gradientFilter",
|
|
@@ -310,17 +327,18 @@ var TightDecoder = /*#__PURE__*/function () {
|
|
|
310
327
|
return null;
|
|
311
328
|
}
|
|
312
329
|
|
|
313
|
-
var
|
|
314
|
-
|
|
315
|
-
|
|
330
|
+
var _byte;
|
|
331
|
+
|
|
332
|
+
_byte = sock.rQshift8();
|
|
333
|
+
this._len = _byte & 0x7f;
|
|
316
334
|
|
|
317
|
-
if (
|
|
318
|
-
|
|
319
|
-
this._len |= (
|
|
335
|
+
if (_byte & 0x80) {
|
|
336
|
+
_byte = sock.rQshift8();
|
|
337
|
+
this._len |= (_byte & 0x7f) << 7;
|
|
320
338
|
|
|
321
|
-
if (
|
|
322
|
-
|
|
323
|
-
this._len |=
|
|
339
|
+
if (_byte & 0x80) {
|
|
340
|
+
_byte = sock.rQshift8();
|
|
341
|
+
this._len |= _byte << 14;
|
|
324
342
|
}
|
|
325
343
|
}
|
|
326
344
|
}
|
|
@@ -347,4 +365,4 @@ var TightDecoder = /*#__PURE__*/function () {
|
|
|
347
365
|
return TightDecoder;
|
|
348
366
|
}();
|
|
349
367
|
|
|
350
|
-
exports
|
|
368
|
+
exports["default"] = TightDecoder;
|
package/lib/decoders/tightpng.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
exports
|
|
8
|
+
exports["default"] = void 0;
|
|
7
9
|
|
|
8
10
|
var _tight = _interopRequireDefault(require("./tight.js"));
|
|
9
11
|
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
13
|
|
|
14
14
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
15
15
|
|
|
16
16
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
17
17
|
|
|
18
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
18
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
19
19
|
|
|
20
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
20
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
21
21
|
|
|
22
22
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
23
|
|
|
24
24
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
25
25
|
|
|
26
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
26
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
27
27
|
|
|
28
28
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
29
|
|
|
30
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
30
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
31
|
|
|
32
32
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
33
33
|
|
|
@@ -62,6 +62,6 @@ var TightPNGDecoder = /*#__PURE__*/function (_TightDecoder) {
|
|
|
62
62
|
}]);
|
|
63
63
|
|
|
64
64
|
return TightPNGDecoder;
|
|
65
|
-
}(_tight
|
|
65
|
+
}(_tight["default"]);
|
|
66
66
|
|
|
67
|
-
exports
|
|
67
|
+
exports["default"] = TightPNGDecoder;
|