Merge pull request #5227 from fredj/less_garbage

Add a temporary ol.TileCoord in ol.renderer.canvas.TileLayer
This commit is contained in:
Frédéric Junod
2016-04-14 08:33:40 +02:00

View File

@@ -43,6 +43,12 @@ ol.renderer.canvas.TileLayer = function(tileLayer) {
*/ */
this.tmpExtent_ = ol.extent.createEmpty(); this.tmpExtent_ = ol.extent.createEmpty();
/**
* @private
* @type {ol.TileCoord}
*/
this.tmpTileCoord_ = [0, 0, 0];
/** /**
* @private * @private
* @type {!goog.vec.Mat4.Number} * @type {!goog.vec.Mat4.Number}
@@ -125,7 +131,7 @@ ol.renderer.canvas.TileLayer.prototype.composeFrame = function(
// Calculate all insert points by tile widths from a common origin to avoid // Calculate all insert points by tile widths from a common origin to avoid
// gaps caused by rounding // gaps caused by rounding
var origin = ol.extent.getBottomLeft(tileGrid.getTileCoordExtent( var origin = ol.extent.getBottomLeft(tileGrid.getTileCoordExtent(
tileGrid.getTileCoordForCoordAndZ(center, currentZ))); tileGrid.getTileCoordForCoordAndZ(center, currentZ, this.tmpTileCoord_)));
var w = Math.round(ol.extent.getWidth(tileExtent) * pixelScale); var w = Math.round(ol.extent.getWidth(tileExtent) * pixelScale);
var h = Math.round(ol.extent.getHeight(tileExtent) * pixelScale); var h = Math.round(ol.extent.getHeight(tileExtent) * pixelScale);
var left = Math.round((tileExtent[0] - origin[0]) * pixelScale / w) * w + var left = Math.round((tileExtent[0] - origin[0]) * pixelScale / w) * w +