Merge pull request #2630 from fredj/misc
Improve ol.structs.LRUCache type annotation
This commit is contained in:
@@ -107,7 +107,7 @@ ol.renderer.webgl.Map = function(container, map) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.structs.LRUCache}
|
* @type {ol.structs.LRUCache.<ol.renderer.webgl.TextureCacheEntry|null>}
|
||||||
*/
|
*/
|
||||||
this.textureCache_ = new ol.structs.LRUCache();
|
this.textureCache_ = new ol.structs.LRUCache();
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ ol.renderer.webgl.Map = function(container, map) {
|
|||||||
Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution;
|
Math.sqrt(deltaX * deltaX + deltaY * deltaY) / tileResolution;
|
||||||
}, this),
|
}, this),
|
||||||
/**
|
/**
|
||||||
* @param {Array} element Element.
|
* @param {Array.<*>} element Element.
|
||||||
* @return {string} Key.
|
* @return {string} Key.
|
||||||
*/
|
*/
|
||||||
function(element) {
|
function(element) {
|
||||||
@@ -189,8 +189,8 @@ ol.renderer.webgl.Map.prototype.bindTileTexture =
|
|||||||
var gl = this.getGL();
|
var gl = this.getGL();
|
||||||
var tileKey = tile.getKey();
|
var tileKey = tile.getKey();
|
||||||
if (this.textureCache_.containsKey(tileKey)) {
|
if (this.textureCache_.containsKey(tileKey)) {
|
||||||
var textureCacheEntry = /** @type {ol.renderer.webgl.TextureCacheEntry} */
|
var textureCacheEntry = this.textureCache_.get(tileKey);
|
||||||
(this.textureCache_.get(tileKey));
|
goog.asserts.assert(!goog.isNull(textureCacheEntry));
|
||||||
gl.bindTexture(goog.webgl.TEXTURE_2D, textureCacheEntry.texture);
|
gl.bindTexture(goog.webgl.TEXTURE_2D, textureCacheEntry.texture);
|
||||||
if (textureCacheEntry.magFilter != magFilter) {
|
if (textureCacheEntry.magFilter != magFilter) {
|
||||||
gl.texParameteri(
|
gl.texParameteri(
|
||||||
@@ -283,7 +283,7 @@ ol.renderer.webgl.Map.prototype.disposeInternal = function() {
|
|||||||
if (!gl.isContextLost()) {
|
if (!gl.isContextLost()) {
|
||||||
this.textureCache_.forEach(
|
this.textureCache_.forEach(
|
||||||
/**
|
/**
|
||||||
* @param {ol.renderer.webgl.TextureCacheEntry} textureCacheEntry
|
* @param {?ol.renderer.webgl.TextureCacheEntry} textureCacheEntry
|
||||||
* Texture cache entry.
|
* Texture cache entry.
|
||||||
*/
|
*/
|
||||||
function(textureCacheEntry) {
|
function(textureCacheEntry) {
|
||||||
@@ -307,8 +307,7 @@ ol.renderer.webgl.Map.prototype.expireCache_ = function(map, frameState) {
|
|||||||
var textureCacheEntry;
|
var textureCacheEntry;
|
||||||
while (this.textureCache_.getCount() - this.textureCacheFrameMarkerCount_ >
|
while (this.textureCache_.getCount() - this.textureCacheFrameMarkerCount_ >
|
||||||
ol.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK) {
|
ol.WEBGL_TEXTURE_CACHE_HIGH_WATER_MARK) {
|
||||||
textureCacheEntry = /** @type {?ol.renderer.webgl.TextureCacheEntry} */
|
textureCacheEntry = this.textureCache_.peekLast();
|
||||||
(this.textureCache_.peekLast());
|
|
||||||
if (goog.isNull(textureCacheEntry)) {
|
if (goog.isNull(textureCacheEntry)) {
|
||||||
if (+this.textureCache_.peekLastKey() == frameState.index) {
|
if (+this.textureCache_.peekLastKey() == frameState.index) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ ol.structs.LRUCache.prototype.getKeys = function() {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Array} Values.
|
* @return {Array.<T>} Values.
|
||||||
*/
|
*/
|
||||||
ol.structs.LRUCache.prototype.getValues = function() {
|
ol.structs.LRUCache.prototype.getValues = function() {
|
||||||
var values = new Array(this.count_);
|
var values = new Array(this.count_);
|
||||||
|
|||||||
Reference in New Issue
Block a user