fixed damagebounds calculation

This commit is contained in:
Alt, Michael 2019-12-17 09:13:30 +01:00
parent 768f85084b
commit 6ceaafbc18
2 changed files with 35 additions and 24 deletions

View File

@ -56,9 +56,20 @@ export default class Display {
this._backbuffer = document.createElement('canvas'); this._backbuffer = document.createElement('canvas');
this._drawCtx = this._backbuffer.getContext('2d'); this._drawCtx = this._backbuffer.getContext('2d');
this._damageBounds = { left: 0, top: 0,
if (this._rotate === 'left' || this._rotate === 'right') {
this._damageBounds = {
left: 0, top: 0,
right: this._backbuffer.height,
bottom: this._backbuffer.width
};
} else {
this._damageBounds = {
left: 0, top: 0,
right: this._backbuffer.width, right: this._backbuffer.width,
bottom: this._backbuffer.height }; bottom: this._backbuffer.height
};
}
Log.Debug("User Agent: " + navigator.userAgent); Log.Debug("User Agent: " + navigator.userAgent);
@ -77,7 +88,7 @@ export default class Display {
// ===== EVENT HANDLERS ===== // ===== EVENT HANDLERS =====
this.onflush = () => {}; // A flush request has finished this.onflush = () => { }; // A flush request has finished
} }
// ===== PROPERTIES ===== // ===== PROPERTIES =====
@ -156,8 +167,8 @@ export default class Display {
viewportChangeSize(width, height) { viewportChangeSize(width, height) {
if (!this._clipViewport || if (!this._clipViewport ||
typeof(width) === "undefined" || typeof (width) === "undefined" ||
typeof(height) === "undefined") { typeof (height) === "undefined") {
Log.Debug("Setting viewport to full display region"); Log.Debug("Setting viewport to full display region");
width = this._fb_width; width = this._fb_width;
@ -468,8 +479,8 @@ export default class Display {
// draw the current tile to the screen // draw the current tile to the screen
finishTile() { finishTile() {
var x0 = this._tile_x - this._viewportLoc.x; var x0 = this._tile_x;
var y0 = this._tile_y - this._viewportLoc.y; var y0 = this._tile_y;
if (this._rotate === 'right') { if (this._rotate === 'right') {
var a = x0; var a = x0;
x0 = this._fb_width - y0 - 1; x0 = this._fb_width - y0 - 1;
@ -635,8 +646,8 @@ export default class Display {
if (this._rotate === 'right') { if (this._rotate === 'right') {
var j = offset; var j = offset;
for(var yv = 0; yv < height; yv++) { for (var yv = 0; yv < height; yv++) {
for(var xv = 0; xv < width; xv++) { for (var xv = 0; xv < width; xv++) {
var doff = ((xv * height) + (width - yv - 1)) * 4; var doff = ((xv * height) + (width - yv - 1)) * 4;
data[doff] = arr[j + 2]; data[doff] = arr[j + 2];
data[doff + 1] = arr[j + 1]; data[doff + 1] = arr[j + 1];
@ -647,8 +658,8 @@ export default class Display {
} }
} else if (this._rotate === 'left') { } else if (this._rotate === 'left') {
var j = offset; var j = offset;
for(var yv = height - 1; yv >= 0; yv--) { for (var yv = height - 1; yv >= 0; yv--) {
for(var xv = width - 1; xv >= 0; xv--) { for (var xv = width - 1; xv >= 0; xv--) {
var doff = ((xv * height) + (width - yv - 1)) * 4; //((height - xv - 1) + (width * yv)) * 4; var doff = ((xv * height) + (width - yv - 1)) * 4; //((height - xv - 1) + (width * yv)) * 4;
data[doff] = arr[j + 2]; data[doff] = arr[j + 2];
data[doff + 1] = arr[j + 1]; data[doff + 1] = arr[j + 1];

View File

@ -1,6 +1,6 @@
{ {
"name": "@gbrehmer/novnc", "name": "@gbrehmer/novnc",
"version": "1.1.0-patch9", "version": "1.1.0-patch10",
"description": "An HTML5 VNC client", "description": "An HTML5 VNC client",
"browser": "lib/rfb", "browser": "lib/rfb",
"directories": { "directories": {