Delete ImageReplay textures
This commit is contained in:
@@ -125,6 +125,30 @@ ol.render.webgl.ImageReplay = function(tolerance) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {olx.FrameState} frameState Frame state.
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
*/
|
||||
ol.render.webgl.ImageReplay.prototype.deleteTextures =
|
||||
function(frameState, context) {
|
||||
frameState.postRenderFunctions.push(
|
||||
goog.partial(
|
||||
/**
|
||||
* @param {WebGLRenderingContext} gl GL.
|
||||
* @param {Array.<WebGLTexture>} textures Textures.
|
||||
*/
|
||||
function(gl, textures) {
|
||||
if (!gl.isContextLost()) {
|
||||
var i, ii;
|
||||
for (i = 0, ii = textures.length; i < ii; ++i) {
|
||||
gl.deleteTexture(textures[i]);
|
||||
}
|
||||
}
|
||||
}, context.getGL(), this.textures_));
|
||||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
@@ -472,6 +496,19 @@ ol.render.webgl.ReplayGroup = function(tolerance) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {olx.FrameState} frameState Frame state.
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
*/
|
||||
ol.render.webgl.ReplayGroup.prototype.deleteTextures =
|
||||
function(frameState, context) {
|
||||
var replayKey;
|
||||
for (replayKey in this.replays_) {
|
||||
this.replays_[replayKey].deleteTextures(frameState, context);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {ol.webgl.Context} context Context.
|
||||
*/
|
||||
|
||||
@@ -153,9 +153,9 @@ ol.renderer.webgl.VectorLayer.prototype.prepareFrame =
|
||||
extent[2] = frameStateExtent[2] + xBuffer;
|
||||
extent[3] = frameStateExtent[3] + yBuffer;
|
||||
|
||||
// FIXME dispose of old replayGroup in post render
|
||||
goog.dispose(this.replayGroup_);
|
||||
this.replayGroup_ = null;
|
||||
if (!goog.isNull(this.replayGroup_)) {
|
||||
this.replayGroup_.deleteTextures(frameState, context);
|
||||
}
|
||||
|
||||
this.dirty_ = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user