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) {
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);