Move the temporary arrays to the module level

No need to create a new variable for each instance.
This commit is contained in:
Frederic Junod
2018-03-28 08:39:04 +02:00
parent 72641ef884
commit e9ce23a461
2 changed files with 27 additions and 32 deletions

View File

@@ -58,17 +58,17 @@ const Geometry = function() {
*/
this.simplifiedGeometryRevision = 0;
/**
* @private
* @type {module:ol/transform~Transform}
*/
this.tmpTransform_ = createTransform();
};
inherits(Geometry, BaseObject);
/**
* @type {module:ol/transform~Transform}
*/
const tmpTransform = createTransform();
/**
* Make a complete copy of the geometry.
* @abstract
@@ -254,7 +254,6 @@ Geometry.prototype.translate = function(deltaX, deltaY) {};
* @api
*/
Geometry.prototype.transform = function(source, destination) {
const tmpTransform = this.tmpTransform_;
source = getProjection(source);
const transformFn = source.getUnits() == Units.TILE_PIXELS ?
function(inCoordinates, outCoordinates, stride) {