Remove unused context handling for ol.Image

This commit is contained in:
Andreas Hocevar
2017-09-06 16:25:42 +02:00
parent 2925a9ceb3
commit 73e88fc465
4 changed files with 5 additions and 27 deletions
+2 -23
View File
@@ -6,7 +6,6 @@ goog.require('ol.ImageState');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.obj');
/** /**
@@ -41,12 +40,6 @@ ol.Image = function(extent, resolution, pixelRatio, attributions, src,
this.image_.crossOrigin = crossOrigin; this.image_.crossOrigin = crossOrigin;
} }
/**
* @private
* @type {Object.<number, (HTMLCanvasElement|Image|HTMLVideoElement)>}
*/
this.imageByContext_ = {};
/** /**
* @private * @private
* @type {Array.<ol.EventsKey>} * @type {Array.<ol.EventsKey>}
@@ -73,22 +66,8 @@ ol.inherits(ol.Image, ol.ImageBase);
* @inheritDoc * @inheritDoc
* @api * @api
*/ */
ol.Image.prototype.getImage = function(opt_context) { ol.Image.prototype.getImage = function() {
if (opt_context !== undefined) { return this.image_;
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_;
}
}; };
+1 -2
View File
@@ -79,10 +79,9 @@ ol.ImageBase.prototype.getExtent = function() {
/** /**
* @abstract * @abstract
* @param {Object=} opt_context Object.
* @return {HTMLCanvasElement|Image|HTMLVideoElement} Image. * @return {HTMLCanvasElement|Image|HTMLVideoElement} Image.
*/ */
ol.ImageBase.prototype.getImage = function(opt_context) {}; ol.ImageBase.prototype.getImage = function() {};
/** /**
+1 -1
View File
@@ -87,6 +87,6 @@ ol.ImageCanvas.prototype.load = function() {
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.ImageCanvas.prototype.getImage = function(opt_context) { ol.ImageCanvas.prototype.getImage = function() {
return this.canvas_; return this.canvas_;
}; };
+1 -1
View File
@@ -127,7 +127,7 @@ ol.reproj.Image.prototype.disposeInternal = function() {
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.reproj.Image.prototype.getImage = function(opt_context) { ol.reproj.Image.prototype.getImage = function() {
return this.canvas_; return this.canvas_;
}; };