Skip to content

Commit 845a14f

Browse files
committed
TilingSprite._renderCanvas wasn't correctly allowing for pixel rounding (thanks @ximop phaserjs#2022
1 parent 226b707 commit 845a14f

3 files changed

Lines changed: 8 additions & 12 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
305305
* BitmapText.font failed to pull the new font from the Phaser Cache, stopping it from updating properly (thanks @AbrahamAlcaina #2001)
306306
* Video.stop now removes the 'playing' event listener, which stop Videos set to loop from throwing errors after being destroyed.
307307
* Tilemap.createFromObjects has been strengthened so that will only create Sprites for matching gids/ids/names. It also only sets the Sprite width and height values if they are present in the Tiled data (thanks @pparke #2012)
308+
* TilingSprite._renderCanvas wasn't correctly allowing for pixel rounding (thanks @ximop #2022)
308309

309310
For changes in previous releases please see the extensive [Version History](https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md).
310311

src/pixi/display/Sprite.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,8 @@ PIXI.Sprite.prototype._renderCanvas = function(renderSession, matrix)
408408
if (renderSession.roundPixels)
409409
{
410410
renderSession.context.setTransform(wt.a, wt.b, wt.c, wt.d, (wt.tx * renderSession.resolution) | 0, (wt.ty * renderSession.resolution) | 0);
411-
dx = dx | 0;
412-
dy = dy | 0;
411+
dx |= 0;
412+
dy |= 0;
413413
}
414414
else
415415
{

src/pixi/extras/TilingSprite.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,7 @@ PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
239239
var wt = this.worldTransform;
240240
var resolution = renderSession.resolution;
241241

242-
context.setTransform(wt.a * resolution,
243-
wt.b * resolution,
244-
wt.c * resolution,
245-
wt.d * resolution,
246-
wt.tx * resolution,
247-
wt.ty * resolution);
242+
context.setTransform(wt.a * resolution, wt.b * resolution, wt.c * resolution, wt.d * resolution, wt.tx * resolution, wt.ty * resolution);
248243

249244
if (this.refreshTexture)
250245
{
@@ -289,10 +284,10 @@ PIXI.TilingSprite.prototype._renderCanvas = function(renderSession)
289284
// Allow for pixel rounding
290285
if (renderSession.roundPixels)
291286
{
292-
tx | 0;
293-
ty | 0;
294-
tw | 0;
295-
th | 0;
287+
tx |= 0;
288+
ty |= 0;
289+
tw |= 0;
290+
th |= 0;
296291
}
297292

298293
context.fillRect(tx, ty, tw, th);

0 commit comments

Comments
 (0)