Skip to content

Commit

Permalink
Merge pull request phaserjs#438 from georgiee/dev2
Browse files Browse the repository at this point in the history
Patch for PixiPatch so it renders masks again
  • Loading branch information
photonstorm committed Feb 18, 2014
2 parents 3df4746 + 16dc2c1 commit 58d2036
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions src/PixiPatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,27 +134,32 @@ PIXI.CanvasRenderer.prototype.renderDisplayObject = function(displayObject, rend
}
else if (displayObject instanceof PIXI.FilterBlock)
{
if (displayObject.open)
if(displayObject.data instanceof PIXI.Graphics)
{
this.context.save();

var cacheAlpha = displayObject.mask.alpha;
var maskTransform = displayObject.mask.worldTransform;

this.context.setTransform(maskTransform[0], maskTransform[3], maskTransform[1], maskTransform[4], maskTransform[2], maskTransform[5])

displayObject.mask.worldAlpha = 0.5;

this.context.worldAlpha = 0;

PIXI.CanvasGraphics.renderGraphicsMask(displayObject.mask, this.context);
this.context.clip();

displayObject.mask.worldAlpha = cacheAlpha;
}
else
{
this.context.restore();
var mask = displayObject.data;

if(displayObject.open)
{
this.context.save();

var cacheAlpha = mask.alpha;
var maskTransform = mask.worldTransform;

this.context.setTransform(maskTransform[0], maskTransform[3], maskTransform[1], maskTransform[4], maskTransform[2], maskTransform[5]);

mask.worldAlpha = 0.5;

this.context.worldAlpha = 0;

PIXI.CanvasGraphics.renderGraphicsMask(mask, this.context);
this.context.clip();

mask.worldAlpha = cacheAlpha;
}
else
{
this.context.restore();
}
}
}
// count++
Expand Down

0 comments on commit 58d2036

Please sign in to comment.