mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
copyRect should be synchronized with source layer/buffer's updates (as it may not be finished drawing by the time a copy is issued)
This commit is contained in:
@@ -140,14 +140,24 @@ function Layer(width, height) {
|
||||
image.src = url;
|
||||
};
|
||||
|
||||
// Run arbitrary function as soon as currently pending operations complete.
|
||||
// Future operations will not block this function from being called (unlike
|
||||
// the ready handler, which requires no pending updates)
|
||||
display.sync = function(handler) {
|
||||
var updateId = currentUpdate++;
|
||||
setUpdate(updateId, handler);
|
||||
}
|
||||
|
||||
display.copyRect = function(srcLayer, srcx, srcy, w, h, x, y) {
|
||||
var updateId = currentUpdate++;
|
||||
|
||||
// Synchronize copy operation with source layer
|
||||
srcLayer.sync(function() {
|
||||
setUpdate(updateId, function() {
|
||||
if (autosize != 0) fitRect(x, y, w, h);
|
||||
displayContext.drawImage(srcLayer, srcx, srcy, w, h, x, y, w, h);
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user