TileLayer - globalCompositionOperation set once

This might fix a safari issue; it also avoids repeatedly setting the
[same] composition operation and saving/loading context states.
This commit is contained in:
Paul 2014-12-09 20:21:31 -08:00
parent 1bf3f08d8d
commit 92a20a5f5f

View file

@ -70,6 +70,9 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) {
*/
this.context = this.canvas.getContext('2d');
// Required for canvas-shifting to avoid alpha artifacts
this.context.globalCompositeOperation = 'copy';
/**
* Required Pixi var.
* @property {PIXI.BaseTexture} baseTexture
@ -673,10 +676,7 @@ Phaser.TilemapLayer.prototype.shiftCanvas = function (context, x, y)
sy = 0;
}
context.save();
context.globalCompositeOperation = 'copy';
context.drawImage(canvas, dx, dy, copyW, copyH, sx, sy, copyW, copyH);
context.restore();
};
/**