Tweaked Graphics to only flush SpriteBatch if it has children to render

This commit is contained in:
Mat Groves 2014-01-15 11:48:14 +00:00
parent aeac4a5f4e
commit 73aa9dca93
3 changed files with 25 additions and 15 deletions

View file

@ -7414,15 +7414,20 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
PIXI.WebGLGraphics.renderGraphics(this, renderSession);
renderSession.spriteBatch.start();
// simple render children!
for(var i=0, j=this.children.length; i<j; i++)
// only rende rif it has children!
if(this.children.length)
{
this.children[i]._renderWebGL(renderSession);
}
renderSession.spriteBatch.start();
renderSession.spriteBatch.stop();
// simple render children!
for(var i=0, j=this.children.length; i<j; i++)
{
this.children[i]._renderWebGL(renderSession);
}
renderSession.spriteBatch.stop();
}
if(this._filters)renderSession.filterManager.popFilter();
if(this._mask)renderSession.maskManager.popMask(renderSession);

File diff suppressed because one or more lines are too long

View file

@ -331,15 +331,20 @@ PIXI.Graphics.prototype._renderWebGL = function(renderSession)
PIXI.WebGLGraphics.renderGraphics(this, renderSession);
renderSession.spriteBatch.start();
// simple render children!
for(var i=0, j=this.children.length; i<j; i++)
// only rende rif it has children!
if(this.children.length)
{
this.children[i]._renderWebGL(renderSession);
}
renderSession.spriteBatch.start();
renderSession.spriteBatch.stop();
// simple render children!
for(var i=0, j=this.children.length; i<j; i++)
{
this.children[i]._renderWebGL(renderSession);
}
renderSession.spriteBatch.stop();
}
if(this._filters)renderSession.filterManager.popFilter();
if(this._mask)renderSession.maskManager.popMask(renderSession);