Remove unused context arg for tile.getImage()
This commit is contained in:
@@ -79,9 +79,9 @@ ol.source.TileDebug.Tile_ = function(tileCoord, tileSize, text) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Object.<number, HTMLCanvasElement>}
|
||||
* @type {HTMLCanvasElement}
|
||||
*/
|
||||
this.canvasByContext_ = {};
|
||||
this.canvas_ = null;
|
||||
|
||||
};
|
||||
ol.inherits(ol.source.TileDebug.Tile_, ol.Tile);
|
||||
@@ -89,16 +89,12 @@ ol.inherits(ol.source.TileDebug.Tile_, ol.Tile);
|
||||
|
||||
/**
|
||||
* Get the image element for this tile.
|
||||
* @param {Object=} opt_context Optional context. Only used by the DOM
|
||||
* renderer.
|
||||
* @return {HTMLCanvasElement} Image.
|
||||
*/
|
||||
ol.source.TileDebug.Tile_.prototype.getImage = function(opt_context) {
|
||||
var key = opt_context !== undefined ? ol.getUid(opt_context) : -1;
|
||||
if (key in this.canvasByContext_) {
|
||||
return this.canvasByContext_[key];
|
||||
ol.source.TileDebug.Tile_.prototype.getImage = function() {
|
||||
if (this.canvas_) {
|
||||
return this.canvas_;
|
||||
} else {
|
||||
|
||||
var tileSize = this.tileSize_;
|
||||
var context = ol.dom.createCanvasContext2D(tileSize[0], tileSize[1]);
|
||||
|
||||
@@ -111,8 +107,7 @@ ol.source.TileDebug.Tile_.prototype.getImage = function(opt_context) {
|
||||
context.font = '24px sans-serif';
|
||||
context.fillText(this.text_, tileSize[0] / 2, tileSize[1] / 2);
|
||||
|
||||
this.canvasByContext_[key] = context.canvas;
|
||||
this.canvas_ = context.canvas;
|
||||
return context.canvas;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -322,11 +322,9 @@ ol.inherits(ol.source.TileUTFGrid.Tile_, ol.Tile);
|
||||
|
||||
/**
|
||||
* Get the image element for this tile.
|
||||
* @param {Object=} opt_context Optional context. Only used for the DOM
|
||||
* renderer.
|
||||
* @return {Image} Image.
|
||||
*/
|
||||
ol.source.TileUTFGrid.Tile_.prototype.getImage = function(opt_context) {
|
||||
ol.source.TileUTFGrid.Tile_.prototype.getImage = function() {
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
@@ -140,10 +140,9 @@ ol.source.Zoomify.Tile_ = function(
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Object.<string,
|
||||
* HTMLCanvasElement|HTMLImageElement|HTMLVideoElement>}
|
||||
* @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement}
|
||||
*/
|
||||
this.zoomifyImageByContext_ = {};
|
||||
this.zoomifyImage_ = null;
|
||||
|
||||
};
|
||||
ol.inherits(ol.source.Zoomify.Tile_, ol.ImageTile);
|
||||
@@ -152,27 +151,24 @@ ol.inherits(ol.source.Zoomify.Tile_, ol.ImageTile);
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.source.Zoomify.Tile_.prototype.getImage = function(opt_context) {
|
||||
ol.source.Zoomify.Tile_.prototype.getImage = function() {
|
||||
if (this.zoomifyImage_) {
|
||||
return this.zoomifyImage_;
|
||||
}
|
||||
var tileSize = ol.DEFAULT_TILE_SIZE;
|
||||
var key = opt_context !== undefined ?
|
||||
ol.getUid(opt_context).toString() : '';
|
||||
if (key in this.zoomifyImageByContext_) {
|
||||
return this.zoomifyImageByContext_[key];
|
||||
} else {
|
||||
var image = ol.ImageTile.prototype.getImage.call(this, opt_context);
|
||||
if (this.state == ol.Tile.State.LOADED) {
|
||||
if (image.width == tileSize && image.height == tileSize) {
|
||||
this.zoomifyImageByContext_[key] = image;
|
||||
return image;
|
||||
} else {
|
||||
var context = ol.dom.createCanvasContext2D(tileSize, tileSize);
|
||||
context.drawImage(image, 0, 0);
|
||||
this.zoomifyImageByContext_[key] = context.canvas;
|
||||
return context.canvas;
|
||||
}
|
||||
} else {
|
||||
var image = ol.ImageTile.prototype.getImage.call(this);
|
||||
if (this.state == ol.Tile.State.LOADED) {
|
||||
if (image.width == tileSize && image.height == tileSize) {
|
||||
this.zoomifyImage_ = image;
|
||||
return image;
|
||||
} else {
|
||||
var context = ol.dom.createCanvasContext2D(tileSize, tileSize);
|
||||
context.drawImage(image, 0, 0);
|
||||
this.zoomifyImage_ = context.canvas;
|
||||
return context.canvas;
|
||||
}
|
||||
} else {
|
||||
return image;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user