mirror of
https://github.com/photonstorm/phaser
synced 2024-12-11 22:03:09 +00:00
RenderTexture.preDestroy
will now release the canvas back to the CanvasPool if running in canvas mode
Also removed un-used `drawFrame` references.
This commit is contained in:
parent
34b27fd57a
commit
a1ae1744ac
1 changed files with 5 additions and 2 deletions
|
@ -146,7 +146,6 @@ var RenderTexture = new Class({
|
||||||
this.fill = RenderTextureWebGL.fill;
|
this.fill = RenderTextureWebGL.fill;
|
||||||
this.clear = RenderTextureWebGL.clear;
|
this.clear = RenderTextureWebGL.clear;
|
||||||
this.draw = RenderTextureWebGL.draw;
|
this.draw = RenderTextureWebGL.draw;
|
||||||
this.drawFrame = RenderTextureWebGL.drawFrame;
|
|
||||||
this.texture = this.renderer.createTexture2D(0, gl.NEAREST, gl.NEAREST, gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE, gl.RGBA, null, width, height, false);
|
this.texture = this.renderer.createTexture2D(0, gl.NEAREST, gl.NEAREST, gl.CLAMP_TO_EDGE, gl.CLAMP_TO_EDGE, gl.RGBA, null, width, height, false);
|
||||||
this.framebuffer = this.renderer.createFramebuffer(width, height, this.texture, false);
|
this.framebuffer = this.renderer.createFramebuffer(width, height, this.texture, false);
|
||||||
}
|
}
|
||||||
|
@ -155,7 +154,6 @@ var RenderTexture = new Class({
|
||||||
this.fill = RenderTextureCanvas.fill;
|
this.fill = RenderTextureCanvas.fill;
|
||||||
this.clear = RenderTextureCanvas.clear;
|
this.clear = RenderTextureCanvas.clear;
|
||||||
this.draw = RenderTextureCanvas.draw;
|
this.draw = RenderTextureCanvas.draw;
|
||||||
this.drawFrame = RenderTextureCanvas.drawFrame;
|
|
||||||
this.canvas = CanvasPool.create2D(this, width, height);
|
this.canvas = CanvasPool.create2D(this, width, height);
|
||||||
this.context = this.canvas.getContext('2d');
|
this.context = this.canvas.getContext('2d');
|
||||||
}
|
}
|
||||||
|
@ -253,6 +251,11 @@ var RenderTexture = new Class({
|
||||||
*/
|
*/
|
||||||
preDestroy: function ()
|
preDestroy: function ()
|
||||||
{
|
{
|
||||||
|
if (this.canvas)
|
||||||
|
{
|
||||||
|
CanvasPool.remove(this.canvas);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.renderer && this.renderer.gl)
|
if (this.renderer && this.renderer.gl)
|
||||||
{
|
{
|
||||||
this.renderer.deleteTexture(this.texture);
|
this.renderer.deleteTexture(this.texture);
|
||||||
|
|
Loading…
Reference in a new issue