Optimize tile dropping in reprioritize
This commit is contained in:
@@ -250,9 +250,8 @@ ol.TileQueue.prototype.siftDown_ = function(startIndex, index) {
|
|||||||
*/
|
*/
|
||||||
ol.TileQueue.prototype.reprioritize = function() {
|
ol.TileQueue.prototype.reprioritize = function() {
|
||||||
var heap = this.heap_;
|
var heap = this.heap_;
|
||||||
var count = heap.length;
|
var i, n = 0, node, priority, tile, tileCenter, tileSourceKey;
|
||||||
var i, priority, node, tile, tileCenter, tileSourceKey;
|
for (i = 0; i < heap.length; ++i) {
|
||||||
for (i = count - 1; i >= 0; i--) {
|
|
||||||
node = heap[i];
|
node = heap[i];
|
||||||
tile = /** @type {ol.Tile} */ (node[1]);
|
tile = /** @type {ol.Tile} */ (node[1]);
|
||||||
tileSourceKey = /** @type {string} */ (node[2]);
|
tileSourceKey = /** @type {string} */ (node[2]);
|
||||||
@@ -260,9 +259,9 @@ ol.TileQueue.prototype.reprioritize = function() {
|
|||||||
priority = this.tilePriorityFunction_(tile, tileSourceKey, tileCenter);
|
priority = this.tilePriorityFunction_(tile, tileSourceKey, tileCenter);
|
||||||
if (priority != ol.TileQueue.DROP) {
|
if (priority != ol.TileQueue.DROP) {
|
||||||
node[0] = priority;
|
node[0] = priority;
|
||||||
} else {
|
heap[n++] = node;
|
||||||
goog.array.removeAt(heap, i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
heap.length = n;
|
||||||
this.heapify_();
|
this.heapify_();
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user