Improve algorithm for finding framebuffer size
This commit is contained in:
@@ -269,11 +269,8 @@ ol.webgl.TileLayerRenderer.prototype.render = function() {
|
|||||||
var maxDimension = Math.max(
|
var maxDimension = Math.max(
|
||||||
tileBoundsSize.width * tileSize.width,
|
tileBoundsSize.width * tileSize.width,
|
||||||
tileBoundsSize.height * tileSize.height);
|
tileBoundsSize.height * tileSize.height);
|
||||||
// FIXME find a better algorithms for rounding up to the next power of two
|
var framebufferDimension =
|
||||||
var framebufferDimension = Math.max(tileSize.width, tileSize.height);
|
Math.pow(2, Math.ceil(Math.log(maxDimension) / Math.log(2)));
|
||||||
while (framebufferDimension < maxDimension) {
|
|
||||||
framebufferDimension *= 2;
|
|
||||||
}
|
|
||||||
var nTilesX = framebufferDimension / tileSize.width;
|
var nTilesX = framebufferDimension / tileSize.width;
|
||||||
var nTilesY = framebufferDimension / tileSize.height;
|
var nTilesY = framebufferDimension / tileSize.height;
|
||||||
var framebufferTileBounds = new ol.TileBounds(
|
var framebufferTileBounds = new ol.TileBounds(
|
||||||
|
|||||||
Reference in New Issue
Block a user