@novnc/novnc 1.2.0-test → 1.3.0-g7ad4e60
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 +4 -4
- package/core/decoders/copyrect.js +5 -0
- package/core/decoders/hextile.js +57 -3
- package/core/decoders/raw.js +12 -2
- package/core/decoders/tight.js +24 -8
- package/core/display.js +9 -151
- 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/rfb.js +116 -109
- package/core/util/browser.js +0 -17
- package/core/util/cursor.js +1 -11
- package/core/util/events.js +0 -4
- package/core/websock.js +76 -17
- package/docs/API.md +10 -3
- package/docs/LIBRARY.md +3 -7
- package/lib/base64.js +4 -4
- package/lib/decoders/copyrect.js +7 -2
- package/lib/decoders/hextile.js +63 -7
- package/lib/decoders/raw.js +13 -4
- package/lib/decoders/rre.js +2 -2
- package/lib/decoders/tight.js +38 -20
- package/lib/decoders/tightpng.js +8 -8
- package/lib/deflator.js +4 -4
- package/lib/des.js +2 -2
- package/lib/display.js +45 -212
- package/lib/inflator.js +4 -4
- package/lib/input/domkeytable.js +197 -194
- package/lib/input/fixedkeys.js +2 -2
- package/lib/input/gesturehandler.js +2 -2
- package/lib/input/keyboard.js +38 -158
- package/lib/input/keysym.js +2 -2
- package/lib/input/keysymdef.js +2 -2
- package/lib/input/util.js +34 -79
- package/lib/input/vkeys.js +2 -4
- package/lib/input/xtscancodes.js +11 -5
- package/lib/rfb.js +292 -286
- package/lib/util/browser.js +8 -26
- package/lib/util/cursor.js +4 -16
- package/lib/util/events.js +3 -5
- package/lib/util/eventtarget.js +3 -3
- package/lib/util/int.js +1 -1
- package/lib/util/logging.js +2 -2
- 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 +113 -112
- 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 +50 -48
- package/lib/vendor/pako/lib/zlib/inftrees.js +3 -3
- package/lib/vendor/pako/lib/zlib/messages.js +2 -2
- package/lib/vendor/pako/lib/zlib/trees.js +4 -4
- package/lib/vendor/pako/lib/zlib/zstream.js +1 -1
- package/lib/websock.js +105 -44
- package/package.json +2 -7
- package/core/util/polyfill.js +0 -61
- package/lib/util/polyfill.js +0 -72
- package/lib/vendor/promise.js +0 -255
package/lib/decoders/tightpng.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
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); }
|
|
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
|
|
|
@@ -23,11 +23,11 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
|
|
|
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;
|
package/lib/deflator.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
|
var _deflate2 = require("../lib/vendor/pako/lib/zlib/deflate.js");
|
|
9
9
|
|
|
10
10
|
var _zstream = _interopRequireDefault(require("../lib/vendor/pako/lib/zlib/zstream.js"));
|
|
11
11
|
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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
|
|
|
@@ -21,7 +21,7 @@ var Deflator = /*#__PURE__*/function () {
|
|
|
21
21
|
function Deflator() {
|
|
22
22
|
_classCallCheck(this, Deflator);
|
|
23
23
|
|
|
24
|
-
this.strm = new _zstream
|
|
24
|
+
this.strm = new _zstream["default"]();
|
|
25
25
|
this.chunkSize = 1024 * 10 * 10;
|
|
26
26
|
this.outputBuffer = new Uint8Array(this.chunkSize);
|
|
27
27
|
this.windowBits = 5;
|
|
@@ -96,4 +96,4 @@ var Deflator = /*#__PURE__*/function () {
|
|
|
96
96
|
return Deflator;
|
|
97
97
|
}();
|
|
98
98
|
|
|
99
|
-
exports
|
|
99
|
+
exports["default"] = Deflator;
|
package/lib/des.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
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
|
|
|
@@ -311,4 +311,4 @@ var DES = /*#__PURE__*/function () {
|
|
|
311
311
|
return DES;
|
|
312
312
|
}();
|
|
313
313
|
|
|
314
|
-
exports
|
|
314
|
+
exports["default"] = DES;
|
package/lib/display.js
CHANGED
|
@@ -5,21 +5,19 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
|
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 _base = _interopRequireDefault(require("./base64.js"));
|
|
13
13
|
|
|
14
|
-
var _browser = require("./util/browser.js");
|
|
15
|
-
|
|
16
14
|
var _int = require("./util/int.js");
|
|
17
15
|
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
17
|
|
|
20
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
18
|
+
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); }
|
|
21
19
|
|
|
22
|
-
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
|
|
20
|
+
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; }
|
|
23
21
|
|
|
24
22
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
23
|
|
|
@@ -39,10 +37,6 @@ var Display = /*#__PURE__*/function () {
|
|
|
39
37
|
this._fbWidth = 0;
|
|
40
38
|
this._fbHeight = 0;
|
|
41
39
|
this._prevDrawStyle = "";
|
|
42
|
-
this._tile = null;
|
|
43
|
-
this._tile16x16 = null;
|
|
44
|
-
this._tileX = 0;
|
|
45
|
-
this._tileY = 0;
|
|
46
40
|
Log.Debug(">> Display.constructor"); // The visible canvas
|
|
47
41
|
|
|
48
42
|
this._target = target;
|
|
@@ -76,13 +70,7 @@ var Display = /*#__PURE__*/function () {
|
|
|
76
70
|
right: this._backbuffer.width,
|
|
77
71
|
bottom: this._backbuffer.height
|
|
78
72
|
};
|
|
79
|
-
Log.Debug("User Agent: " + navigator.userAgent);
|
|
80
|
-
|
|
81
|
-
if (!('createImageData' in this._drawCtx)) {
|
|
82
|
-
throw new Error("Canvas does not support createImageData");
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
this._tile16x16 = this._drawCtx.createImageData(16, 16);
|
|
73
|
+
Log.Debug("User Agent: " + navigator.userAgent);
|
|
86
74
|
Log.Debug("<< Display.constructor"); // ===== PROPERTIES =====
|
|
87
75
|
|
|
88
76
|
this._scale = 1.0;
|
|
@@ -94,8 +82,38 @@ var Display = /*#__PURE__*/function () {
|
|
|
94
82
|
|
|
95
83
|
|
|
96
84
|
_createClass(Display, [{
|
|
85
|
+
key: "scale",
|
|
86
|
+
get: function get() {
|
|
87
|
+
return this._scale;
|
|
88
|
+
},
|
|
89
|
+
set: function set(scale) {
|
|
90
|
+
this._rescale(scale);
|
|
91
|
+
}
|
|
92
|
+
}, {
|
|
93
|
+
key: "clipViewport",
|
|
94
|
+
get: function get() {
|
|
95
|
+
return this._clipViewport;
|
|
96
|
+
},
|
|
97
|
+
set: function set(viewport) {
|
|
98
|
+
this._clipViewport = viewport; // May need to readjust the viewport dimensions
|
|
99
|
+
|
|
100
|
+
var vp = this._viewportLoc;
|
|
101
|
+
this.viewportChangeSize(vp.w, vp.h);
|
|
102
|
+
this.viewportChangePos(0, 0);
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
key: "width",
|
|
106
|
+
get: function get() {
|
|
107
|
+
return this._fbWidth;
|
|
108
|
+
}
|
|
109
|
+
}, {
|
|
110
|
+
key: "height",
|
|
111
|
+
get: function get() {
|
|
112
|
+
return this._fbHeight;
|
|
113
|
+
} // ===== PUBLIC METHODS =====
|
|
114
|
+
|
|
115
|
+
}, {
|
|
97
116
|
key: "viewportChangePos",
|
|
98
|
-
// ===== PUBLIC METHODS =====
|
|
99
117
|
value: function viewportChangePos(deltaX, deltaY) {
|
|
100
118
|
var vp = this._viewportLoc;
|
|
101
119
|
deltaX = Math.floor(deltaX);
|
|
@@ -371,7 +389,7 @@ var Display = /*#__PURE__*/function () {
|
|
|
371
389
|
}
|
|
372
390
|
|
|
373
391
|
var img = new Image();
|
|
374
|
-
img.src = "data: " + mime + ";base64," + _base
|
|
392
|
+
img.src = "data: " + mime + ";base64," + _base["default"].encode(arr);
|
|
375
393
|
|
|
376
394
|
this._renderQPush({
|
|
377
395
|
'type': 'img',
|
|
@@ -381,61 +399,6 @@ var Display = /*#__PURE__*/function () {
|
|
|
381
399
|
'width': width,
|
|
382
400
|
'height': height
|
|
383
401
|
});
|
|
384
|
-
} // start updating a tile
|
|
385
|
-
|
|
386
|
-
}, {
|
|
387
|
-
key: "startTile",
|
|
388
|
-
value: function startTile(x, y, width, height, color) {
|
|
389
|
-
this._tileX = x;
|
|
390
|
-
this._tileY = y;
|
|
391
|
-
|
|
392
|
-
if (width === 16 && height === 16) {
|
|
393
|
-
this._tile = this._tile16x16;
|
|
394
|
-
} else {
|
|
395
|
-
this._tile = this._drawCtx.createImageData(width, height);
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
var red = color[2];
|
|
399
|
-
var green = color[1];
|
|
400
|
-
var blue = color[0];
|
|
401
|
-
var data = this._tile.data;
|
|
402
|
-
|
|
403
|
-
for (var i = 0; i < width * height * 4; i += 4) {
|
|
404
|
-
data[i] = red;
|
|
405
|
-
data[i + 1] = green;
|
|
406
|
-
data[i + 2] = blue;
|
|
407
|
-
data[i + 3] = 255;
|
|
408
|
-
}
|
|
409
|
-
} // update sub-rectangle of the current tile
|
|
410
|
-
|
|
411
|
-
}, {
|
|
412
|
-
key: "subTile",
|
|
413
|
-
value: function subTile(x, y, w, h, color) {
|
|
414
|
-
var red = color[2];
|
|
415
|
-
var green = color[1];
|
|
416
|
-
var blue = color[0];
|
|
417
|
-
var xend = x + w;
|
|
418
|
-
var yend = y + h;
|
|
419
|
-
var data = this._tile.data;
|
|
420
|
-
var width = this._tile.width;
|
|
421
|
-
|
|
422
|
-
for (var j = y; j < yend; j++) {
|
|
423
|
-
for (var i = x; i < xend; i++) {
|
|
424
|
-
var p = (i + j * width) * 4;
|
|
425
|
-
data[p] = red;
|
|
426
|
-
data[p + 1] = green;
|
|
427
|
-
data[p + 2] = blue;
|
|
428
|
-
data[p + 3] = 255;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
} // draw the current tile to the screen
|
|
432
|
-
|
|
433
|
-
}, {
|
|
434
|
-
key: "finishTile",
|
|
435
|
-
value: function finishTile() {
|
|
436
|
-
this._drawCtx.putImageData(this._tile, this._tileX, this._tileY);
|
|
437
|
-
|
|
438
|
-
this._damage(this._tileX, this._tileY, this._tile.width, this._tile.height);
|
|
439
402
|
}
|
|
440
403
|
}, {
|
|
441
404
|
key: "blitImage",
|
|
@@ -456,51 +419,13 @@ var Display = /*#__PURE__*/function () {
|
|
|
456
419
|
'height': height
|
|
457
420
|
});
|
|
458
421
|
} else {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
}, {
|
|
463
|
-
key: "blitRgbImage",
|
|
464
|
-
value: function blitRgbImage(x, y, width, height, arr, offset, fromQueue) {
|
|
465
|
-
if (this._renderQ.length !== 0 && !fromQueue) {
|
|
466
|
-
// NB(directxman12): it's technically more performant here to use preallocated arrays,
|
|
467
|
-
// but it's a lot of extra work for not a lot of payoff -- if we're using the render queue,
|
|
468
|
-
// this probably isn't getting called *nearly* as much
|
|
469
|
-
var newArr = new Uint8Array(width * height * 3);
|
|
470
|
-
newArr.set(new Uint8Array(arr.buffer, 0, newArr.length));
|
|
422
|
+
// NB(directxman12): arr must be an Type Array view
|
|
423
|
+
var data = new Uint8ClampedArray(arr.buffer, arr.byteOffset + offset, width * height * 4);
|
|
424
|
+
var img = new ImageData(data, width, height);
|
|
471
425
|
|
|
472
|
-
this.
|
|
473
|
-
'type': 'blitRgb',
|
|
474
|
-
'data': newArr,
|
|
475
|
-
'x': x,
|
|
476
|
-
'y': y,
|
|
477
|
-
'width': width,
|
|
478
|
-
'height': height
|
|
479
|
-
});
|
|
480
|
-
} else {
|
|
481
|
-
this._rgbImageData(x, y, width, height, arr, offset);
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
}, {
|
|
485
|
-
key: "blitRgbxImage",
|
|
486
|
-
value: function blitRgbxImage(x, y, width, height, arr, offset, fromQueue) {
|
|
487
|
-
if (this._renderQ.length !== 0 && !fromQueue) {
|
|
488
|
-
// NB(directxman12): it's technically more performant here to use preallocated arrays,
|
|
489
|
-
// but it's a lot of extra work for not a lot of payoff -- if we're using the render queue,
|
|
490
|
-
// this probably isn't getting called *nearly* as much
|
|
491
|
-
var newArr = new Uint8Array(width * height * 4);
|
|
492
|
-
newArr.set(new Uint8Array(arr.buffer, 0, newArr.length));
|
|
426
|
+
this._drawCtx.putImageData(img, x, y);
|
|
493
427
|
|
|
494
|
-
this.
|
|
495
|
-
'type': 'blitRgbx',
|
|
496
|
-
'data': newArr,
|
|
497
|
-
'x': x,
|
|
498
|
-
'y': y,
|
|
499
|
-
'width': width,
|
|
500
|
-
'height': height
|
|
501
|
-
});
|
|
502
|
-
} else {
|
|
503
|
-
this._rgbxImageData(x, y, width, height, arr, offset);
|
|
428
|
+
this._damage(x, y, width, height);
|
|
504
429
|
}
|
|
505
430
|
}
|
|
506
431
|
}, {
|
|
@@ -552,66 +477,13 @@ var Display = /*#__PURE__*/function () {
|
|
|
552
477
|
}, {
|
|
553
478
|
key: "_setFillColor",
|
|
554
479
|
value: function _setFillColor(color) {
|
|
555
|
-
var newStyle = 'rgb(' + color[
|
|
480
|
+
var newStyle = 'rgb(' + color[0] + ',' + color[1] + ',' + color[2] + ')';
|
|
556
481
|
|
|
557
482
|
if (newStyle !== this._prevDrawStyle) {
|
|
558
483
|
this._drawCtx.fillStyle = newStyle;
|
|
559
484
|
this._prevDrawStyle = newStyle;
|
|
560
485
|
}
|
|
561
486
|
}
|
|
562
|
-
}, {
|
|
563
|
-
key: "_rgbImageData",
|
|
564
|
-
value: function _rgbImageData(x, y, width, height, arr, offset) {
|
|
565
|
-
var img = this._drawCtx.createImageData(width, height);
|
|
566
|
-
|
|
567
|
-
var data = img.data;
|
|
568
|
-
|
|
569
|
-
for (var i = 0, j = offset; i < width * height * 4; i += 4, j += 3) {
|
|
570
|
-
data[i] = arr[j];
|
|
571
|
-
data[i + 1] = arr[j + 1];
|
|
572
|
-
data[i + 2] = arr[j + 2];
|
|
573
|
-
data[i + 3] = 255; // Alpha
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
this._drawCtx.putImageData(img, x, y);
|
|
577
|
-
|
|
578
|
-
this._damage(x, y, img.width, img.height);
|
|
579
|
-
}
|
|
580
|
-
}, {
|
|
581
|
-
key: "_bgrxImageData",
|
|
582
|
-
value: function _bgrxImageData(x, y, width, height, arr, offset) {
|
|
583
|
-
var img = this._drawCtx.createImageData(width, height);
|
|
584
|
-
|
|
585
|
-
var data = img.data;
|
|
586
|
-
|
|
587
|
-
for (var i = 0, j = offset; i < width * height * 4; i += 4, j += 4) {
|
|
588
|
-
data[i] = arr[j + 2];
|
|
589
|
-
data[i + 1] = arr[j + 1];
|
|
590
|
-
data[i + 2] = arr[j];
|
|
591
|
-
data[i + 3] = 255; // Alpha
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
this._drawCtx.putImageData(img, x, y);
|
|
595
|
-
|
|
596
|
-
this._damage(x, y, img.width, img.height);
|
|
597
|
-
}
|
|
598
|
-
}, {
|
|
599
|
-
key: "_rgbxImageData",
|
|
600
|
-
value: function _rgbxImageData(x, y, width, height, arr, offset) {
|
|
601
|
-
// NB(directxman12): arr must be an Type Array view
|
|
602
|
-
var img;
|
|
603
|
-
|
|
604
|
-
if (_browser.supportsImageMetadata) {
|
|
605
|
-
img = new ImageData(new Uint8ClampedArray(arr.buffer, arr.byteOffset, width * height * 4), width, height);
|
|
606
|
-
} else {
|
|
607
|
-
img = this._drawCtx.createImageData(width, height);
|
|
608
|
-
img.data.set(new Uint8ClampedArray(arr.buffer, arr.byteOffset, width * height * 4));
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
this._drawCtx.putImageData(img, x, y);
|
|
612
|
-
|
|
613
|
-
this._damage(x, y, img.width, img.height);
|
|
614
|
-
}
|
|
615
487
|
}, {
|
|
616
488
|
key: "_renderQPush",
|
|
617
489
|
value: function _renderQPush(action) {
|
|
@@ -657,17 +529,8 @@ var Display = /*#__PURE__*/function () {
|
|
|
657
529
|
this.blitImage(a.x, a.y, a.width, a.height, a.data, 0, true);
|
|
658
530
|
break;
|
|
659
531
|
|
|
660
|
-
case 'blitRgb':
|
|
661
|
-
this.blitRgbImage(a.x, a.y, a.width, a.height, a.data, 0, true);
|
|
662
|
-
break;
|
|
663
|
-
|
|
664
|
-
case 'blitRgbx':
|
|
665
|
-
this.blitRgbxImage(a.x, a.y, a.width, a.height, a.data, 0, true);
|
|
666
|
-
break;
|
|
667
|
-
|
|
668
532
|
case 'img':
|
|
669
|
-
|
|
670
|
-
if (a.img.complete && a.img.width !== 0 && a.img.height !== 0) {
|
|
533
|
+
if (a.img.complete) {
|
|
671
534
|
if (a.img.width !== a.width || a.img.height !== a.height) {
|
|
672
535
|
Log.Error("Decoded image has incorrect dimensions. Got " + a.img.width + "x" + a.img.height + ". Expected " + a.width + "x" + a.height + ".");
|
|
673
536
|
return;
|
|
@@ -695,39 +558,9 @@ var Display = /*#__PURE__*/function () {
|
|
|
695
558
|
this.onflush();
|
|
696
559
|
}
|
|
697
560
|
}
|
|
698
|
-
}, {
|
|
699
|
-
key: "scale",
|
|
700
|
-
get: function get() {
|
|
701
|
-
return this._scale;
|
|
702
|
-
},
|
|
703
|
-
set: function set(scale) {
|
|
704
|
-
this._rescale(scale);
|
|
705
|
-
}
|
|
706
|
-
}, {
|
|
707
|
-
key: "clipViewport",
|
|
708
|
-
get: function get() {
|
|
709
|
-
return this._clipViewport;
|
|
710
|
-
},
|
|
711
|
-
set: function set(viewport) {
|
|
712
|
-
this._clipViewport = viewport; // May need to readjust the viewport dimensions
|
|
713
|
-
|
|
714
|
-
var vp = this._viewportLoc;
|
|
715
|
-
this.viewportChangeSize(vp.w, vp.h);
|
|
716
|
-
this.viewportChangePos(0, 0);
|
|
717
|
-
}
|
|
718
|
-
}, {
|
|
719
|
-
key: "width",
|
|
720
|
-
get: function get() {
|
|
721
|
-
return this._fbWidth;
|
|
722
|
-
}
|
|
723
|
-
}, {
|
|
724
|
-
key: "height",
|
|
725
|
-
get: function get() {
|
|
726
|
-
return this._fbHeight;
|
|
727
|
-
}
|
|
728
561
|
}]);
|
|
729
562
|
|
|
730
563
|
return Display;
|
|
731
564
|
}();
|
|
732
565
|
|
|
733
|
-
exports
|
|
566
|
+
exports["default"] = Display;
|
package/lib/inflator.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
|
var _inflate2 = require("../lib/vendor/pako/lib/zlib/inflate.js");
|
|
9
9
|
|
|
10
10
|
var _zstream = _interopRequireDefault(require("../lib/vendor/pako/lib/zlib/zstream.js"));
|
|
11
11
|
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: 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
|
|
|
@@ -21,7 +21,7 @@ var Inflate = /*#__PURE__*/function () {
|
|
|
21
21
|
function Inflate() {
|
|
22
22
|
_classCallCheck(this, Inflate);
|
|
23
23
|
|
|
24
|
-
this.strm = new _zstream
|
|
24
|
+
this.strm = new _zstream["default"]();
|
|
25
25
|
this.chunkSize = 1024 * 10 * 10;
|
|
26
26
|
this.strm.output = new Uint8Array(this.chunkSize);
|
|
27
27
|
this.windowBits = 5;
|
|
@@ -84,4 +84,4 @@ var Inflate = /*#__PURE__*/function () {
|
|
|
84
84
|
return Inflate;
|
|
85
85
|
}();
|
|
86
86
|
|
|
87
|
-
exports
|
|
87
|
+
exports["default"] = Inflate;
|