Skip to content

Commit a1ae174

Browse files
committed
RenderTexture.preDestroy will now release the canvas back to the CanvasPool if running in canvas mode
Also removed un-used `drawFrame` references.
1 parent 34b27fd commit a1ae174

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/gameobjects/rendertexture/RenderTexture.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ var RenderTexture = new Class({
146146
this.fill = RenderTextureWebGL.fill;
147147
this.clear = RenderTextureWebGL.clear;
148148
this.draw = RenderTextureWebGL.draw;
149-
this.drawFrame = RenderTextureWebGL.drawFrame;
150149
this.texture = this.renderer.createTexture2D(0, gl.NEAREST, gl.NEAREST, gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE, gl.RGBA, null, width, height, false);
151150
this.framebuffer = this.renderer.createFramebuffer(width, height, this.texture, false);
152151
}
@@ -155,7 +154,6 @@ var RenderTexture = new Class({
155154
this.fill = RenderTextureCanvas.fill;
156155
this.clear = RenderTextureCanvas.clear;
157156
this.draw = RenderTextureCanvas.draw;
158-
this.drawFrame = RenderTextureCanvas.drawFrame;
159157
this.canvas = CanvasPool.create2D(this, width, height);
160158
this.context = this.canvas.getContext('2d');
161159
}
@@ -253,6 +251,11 @@ var RenderTexture = new Class({
253251
*/
254252
preDestroy: function ()
255253
{
254+
if (this.canvas)
255+
{
256+
CanvasPool.remove(this.canvas);
257+
}
258+
256259
if (this.renderer && this.renderer.gl)
257260
{
258261
this.renderer.deleteTexture(this.texture);

0 commit comments

Comments
 (0)