From b17b9c6f034166fd02d9472ceaf97edc0905d519 Mon Sep 17 00:00:00 2001 From: Antoine Vandecreme Date: Tue, 23 Feb 2016 13:49:11 -0500 Subject: [PATCH] Fix edge smoothing with png tiles. Fix #854 --- src/tile.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/tile.js b/src/tile.js index 9abb14b6..94f58cc2 100644 --- a/src/tile.js +++ b/src/tile.js @@ -280,6 +280,17 @@ $.Tile.prototype = { context.globalAlpha = this.opacity; + if (typeof scale === 'number' && scale !== 1) { + // draw tile at a different scale + position = position.times(scale); + size = size.times(scale); + } + + if (translate instanceof $.Point) { + // shift tile position slightly + position = position.plus(translate); + } + //if we are supposed to be rendering fully opaque rectangle, //ie its done fading or fading is turned off, and if we are drawing //an image with an alpha channel, then the only way @@ -301,17 +312,6 @@ $.Tile.prototype = { // changes as we are rendering the image drawingHandler({context: context, tile: this, rendered: rendered}); - if (typeof scale === 'number' && scale !== 1) { - // draw tile at a different scale - position = position.times(scale); - size = size.times(scale); - } - - if (translate instanceof $.Point) { - // shift tile position slightly - position = position.plus(translate); - } - context.drawImage( rendered.canvas, 0,