Merge pull request #7774 from fredj/memory
Pass destination extent to avoid garbage generation
This commit is contained in:
@@ -97,7 +97,7 @@ const VectorImageTile = function(tileCoord, state, sourceRevision, format,
|
||||
sourceTileGrid.getTileCoordExtent(sourceTileCoord));
|
||||
const sourceExtent = sourceTileGrid.getExtent();
|
||||
if (sourceExtent) {
|
||||
sharedExtent = getIntersection(sharedExtent, sourceExtent);
|
||||
sharedExtent = getIntersection(sharedExtent, sourceExtent, sharedExtent);
|
||||
}
|
||||
if (getWidth(sharedExtent) / resolution >= 0.5 &&
|
||||
getHeight(sharedExtent) / resolution >= 0.5) {
|
||||
|
||||
@@ -593,6 +593,8 @@ export function getIntersection(extent1, extent2, opt_extent) {
|
||||
} else {
|
||||
intersection[3] = extent2[3];
|
||||
}
|
||||
} else {
|
||||
createOrUpdateEmpty(intersection);
|
||||
}
|
||||
return intersection;
|
||||
}
|
||||
|
||||
@@ -291,6 +291,20 @@ describe('ol.extent', function() {
|
||||
expect(_ol_extent_.getIntersection(north, west)).to.eql([-180, 0, 0, 90]);
|
||||
expect(_ol_extent_.getIntersection(east, south)).to.eql([0, -90, 180, 0]);
|
||||
});
|
||||
|
||||
|
||||
it('can take an destination extent', function() {
|
||||
const world = [-180, -90, 180, 90];
|
||||
const north = [-180, 0, 180, 90];
|
||||
const none = _ol_extent_.createEmpty();
|
||||
let tmpExtent = [-180, 45, 180, 90];
|
||||
expect(_ol_extent_.getIntersection(world, north, tmpExtent)).to.eql(north);
|
||||
expect(_ol_extent_.getIntersection(world, none, tmpExtent)).to.eql(none);
|
||||
|
||||
tmpExtent = [-180, -90, 180, 90];
|
||||
expect(_ol_extent_.getIntersection(tmpExtent, north, tmpExtent)).to.eql(north);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('containsCoordinate', function() {
|
||||
|
||||
Reference in New Issue
Block a user