Skip to content

Commit 92a20a5

Browse files
committed
TileLayer - globalCompositionOperation set once
This might fix a safari issue; it also avoids repeatedly setting the [same] composition operation and saving/loading context states.
1 parent 1bf3f08 commit 92a20a5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/tilemap/TilemapLayer.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ Phaser.TilemapLayer = function (game, tilemap, index, width, height) {
7070
*/
7171
this.context = this.canvas.getContext('2d');
7272

73+
// Required for canvas-shifting to avoid alpha artifacts
74+
this.context.globalCompositeOperation = 'copy';
75+
7376
/**
7477
* Required Pixi var.
7578
* @property {PIXI.BaseTexture} baseTexture
@@ -673,10 +676,7 @@ Phaser.TilemapLayer.prototype.shiftCanvas = function (context, x, y)
673676
sy = 0;
674677
}
675678

676-
context.save();
677-
context.globalCompositeOperation = 'copy';
678679
context.drawImage(canvas, dx, dy, copyW, copyH, sx, sy, copyW, copyH);
679-
context.restore();
680680
};
681681

682682
/**

0 commit comments

Comments
 (0)