Layer should preserve composite operation through resize.

This commit is contained in:
Michael Jumper
2012-02-15 12:26:56 -08:00
parent ebc5caac28
commit 3019b4d5cd

View File

@@ -116,7 +116,6 @@ Guacamole.Layer = function(width, height) {
*/ */
function resize(newWidth, newHeight) { function resize(newWidth, newHeight) {
// Only preserve old data if width/height are both non-zero // Only preserve old data if width/height are both non-zero
var oldData = null; var oldData = null;
if (width != 0 && height != 0) { if (width != 0 && height != 0) {
@@ -135,6 +134,9 @@ Guacamole.Layer = function(width, height) {
} }
// Preserve composite operation
var oldCompositeOperation = displayContext.globalCompositeOperation;
// Resize canvas // Resize canvas
display.width = newWidth; display.width = newWidth;
display.height = newHeight; display.height = newHeight;
@@ -145,8 +147,12 @@ Guacamole.Layer = function(width, height) {
0, 0, width, height, 0, 0, width, height,
0, 0, width, height); 0, 0, width, height);
// Restore composite operation
displayContext.globalCompositeOperation = oldCompositeOperation;
width = newWidth; width = newWidth;
height = newHeight; height = newHeight;
} }
/** /**