mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
BlendMode: support DocumentView and return if an item's bounds is null.
This commit is contained in:
parent
0e011dee2a
commit
eee5e63a72
1 changed files with 6 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
};
|
Loading…
Reference in a new issue