Add/use display.drawImage which is viewport relative.
Fixes https://github.com/kanaka/noVNC/issues/163 When using an encoding with raw images (tight, tightPNG) we need to draw those image relative to the viewport so that clipping works when the viewport isn't at 0, 0.
This commit is contained in:
parent
a117514183
commit
bc28395abf
|
@ -577,6 +577,12 @@ that.blitStringImage = function(str, x, y) {
|
||||||
img.src = str;
|
img.src = str;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Wrap ctx.drawImage but relative to viewport
|
||||||
|
that.drawImage = function(img, x, y) {
|
||||||
|
c_ctx.drawImage(img, x - viewport.x, y - viewport.y);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
that.changeCursor = function(pixels, mask, hotx, hoty, w, h) {
|
that.changeCursor = function(pixels, mask, hotx, hoty, w, h) {
|
||||||
if (conf.cursor_uri === false) {
|
if (conf.cursor_uri === false) {
|
||||||
Util.Warn("changeCursor called but no cursor data URI support");
|
Util.Warn("changeCursor called but no cursor data URI support");
|
||||||
|
|
|
@ -1562,7 +1562,7 @@ scan_tight_imgQ = function() {
|
||||||
} else if (data.type === 'rgb') {
|
} else if (data.type === 'rgb') {
|
||||||
display.blitRgbImage(data.x, data.y, data.width, data.height, data.img.data, 0);
|
display.blitRgbImage(data.x, data.y, data.width, data.height, data.img.data, 0);
|
||||||
} else {
|
} else {
|
||||||
ctx.drawImage(data.img, data.x, data.y);
|
display.drawImage(data.img, data.x, data.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTimeout(scan_tight_imgQ, scan_imgQ_rate);
|
setTimeout(scan_tight_imgQ, scan_imgQ_rate);
|
||||||
|
|
Loading…
Reference in New Issue