Merge pull request #7230 from ahocevar/image-context

Remove unused context handling for ol.Image
This commit is contained in:
Andreas Hocevar
2017-09-07 09:06:05 +02:00
committed by GitHub
4 changed files with 5 additions and 27 deletions

View File

@@ -6,7 +6,6 @@ goog.require('ol.ImageState');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.extent');
goog.require('ol.obj');
/**
@@ -41,12 +40,6 @@ ol.Image = function(extent, resolution, pixelRatio, attributions, src,
this.image_.crossOrigin = crossOrigin;
}
/**
* @private
* @type {Object.<number, (HTMLCanvasElement|Image|HTMLVideoElement)>}
*/
this.imageByContext_ = {};
/**
* @private
* @type {Array.<ol.EventsKey>}
@@ -73,22 +66,8 @@ ol.inherits(ol.Image, ol.ImageBase);
* @inheritDoc
* @api
*/
ol.Image.prototype.getImage = function(opt_context) {
if (opt_context !== undefined) {
var image;
var key = ol.getUid(opt_context);
if (key in this.imageByContext_) {
return this.imageByContext_[key];
} else if (ol.obj.isEmpty(this.imageByContext_)) {
image = this.image_;
} else {
image = /** @type {Image} */ (this.image_.cloneNode(false));
}
this.imageByContext_[key] = image;
return image;
} else {
return this.image_;
}
ol.Image.prototype.getImage = function() {
return this.image_;
};

View File

@@ -79,10 +79,9 @@ ol.ImageBase.prototype.getExtent = function() {
/**
* @abstract
* @param {Object=} opt_context Object.
* @return {HTMLCanvasElement|Image|HTMLVideoElement} Image.
*/
ol.ImageBase.prototype.getImage = function(opt_context) {};
ol.ImageBase.prototype.getImage = function() {};
/**

View File

@@ -87,6 +87,6 @@ ol.ImageCanvas.prototype.load = function() {
/**
* @inheritDoc
*/
ol.ImageCanvas.prototype.getImage = function(opt_context) {
ol.ImageCanvas.prototype.getImage = function() {
return this.canvas_;
};

View File

@@ -127,7 +127,7 @@ ol.reproj.Image.prototype.disposeInternal = function() {
/**
* @inheritDoc
*/
ol.reproj.Image.prototype.getImage = function(opt_context) {
ol.reproj.Image.prototype.getImage = function() {
return this.canvas_;
};