fix for video mode resizing

This commit is contained in:
matt 2021-04-18 06:36:53 -04:00
parent 41daa6042c
commit ed0744497d
1 changed files with 10 additions and 6 deletions

View File

@ -393,9 +393,13 @@ export default class Display {
} }
} }
drawImage(img, x, y) { drawImage(img, x, y, w, h) {
this._drawCtx.drawImage(img, x, y); if (img.width != w || img.height != h) {
this._damage(x, y, img.width, img.height); this._drawCtx.drawImage(img, x, y, w, h);
} else {
this._drawCtx.drawImage(img, x, y);
}
this._damage(x, y, w, h);
} }
autoscale(containerWidth, containerHeight) { autoscale(containerWidth, containerHeight) {
@ -483,13 +487,13 @@ export default class Display {
break; break;
case 'img': case 'img':
if (a.img.complete) { 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 " + Log.Error("Decoded image has incorrect dimensions. Got " +
a.img.width + "x" + a.img.height + ". Expected " + a.img.width + "x" + a.img.height + ". Expected " +
a.width + "x" + a.height + "."); a.width + "x" + a.height + ".");
return; return;
} }*/
this.drawImage(a.img, a.x, a.y); this.drawImage(a.img, a.x, a.y, a.width, a.height);
} else { } else {
a.img._noVNCDisplay = this; a.img._noVNCDisplay = this;
a.img.addEventListener('load', this._resumeRenderQ); a.img.addEventListener('load', this._resumeRenderQ);