From ed0744497d974826b52891335bb9be36af43ac9b Mon Sep 17 00:00:00 2001 From: matt Date: Sun, 18 Apr 2021 06:36:53 -0400 Subject: [PATCH] fix for video mode resizing --- core/display.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/core/display.js b/core/display.js index 701eba4a..30fa2891 100644 --- a/core/display.js +++ b/core/display.js @@ -393,9 +393,13 @@ export default class Display { } } - drawImage(img, x, y) { - this._drawCtx.drawImage(img, x, y); - this._damage(x, y, img.width, img.height); + drawImage(img, x, y, w, h) { + if (img.width != w || img.height != h) { + this._drawCtx.drawImage(img, x, y, w, h); + } else { + this._drawCtx.drawImage(img, x, y); + } + this._damage(x, y, w, h); } autoscale(containerWidth, containerHeight) { @@ -483,13 +487,13 @@ export default class Display { break; case 'img': if (a.img.complete) { - if (a.img.width !== a.width || a.img.height !== a.height) { + /* if (a.img.width !== a.width || a.img.height !== a.height) { Log.Error("Decoded image has incorrect dimensions. Got " + a.img.width + "x" + a.img.height + ". Expected " + a.width + "x" + a.height + "."); return; - } - this.drawImage(a.img, a.x, a.y); + }*/ + this.drawImage(a.img, a.x, a.y, a.width, a.height); } else { a.img._noVNCDisplay = this; a.img.addEventListener('load', this._resumeRenderQ);