From eee5e63a7252ca3bf0dfcca1ce00d9ab5ddd8b30 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Mon, 28 Feb 2011 18:36:06 +0100 Subject: [PATCH] BlendMode: support DocumentView and return if an item's bounds is null. --- src/item/BlendMode.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/item/BlendMode.js b/src/item/BlendMode.js index 37f9fa3e..508f910a 100644 --- a/src/item/BlendMode.js +++ b/src/item/BlendMode.js @@ -30,15 +30,18 @@ BlendMode = { process: function(documentContext, item, param) { // TODO: use strokeBounds var itemBounds = item.bounds; + if (!itemBounds) + return; var top = Math.floor(itemBounds.top); var left = Math.floor(itemBounds.left); - var size = itemBounds.size.ceil(); + var size = itemBounds.size.ceil().add(1, 1); var width = size.width; var height = size.height; var itemCanvas = CanvasProvider.getCanvas(size); var itemContext = itemCanvas.getContext('2d'); - if(item.matrix) { + itemContext.save(); + if (item.matrix) { var matrix = item.matrix.clone(); var transMatrix = Matrix.getTranslateInstance(-left, -top); matrix.preConcatenate(transMatrix); @@ -210,6 +213,7 @@ BlendMode = { } } documentContext.putImageData(dstD, left, top); + itemContext.restore(); CanvasProvider.returnCanvas(itemCanvas); } }; \ No newline at end of file