mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 13:13:43 +00:00
Moved canvas to texture on Text to TExtWebGLRenderer
This commit is contained in:
parent
58e4912633
commit
84bc90f7ba
2 changed files with 14 additions and 10 deletions
|
@ -68,6 +68,7 @@ var Text = new Class({
|
|||
this.canvasTexture = null;
|
||||
this.prevWidth = this.canvas.width;
|
||||
this.prevHeight = this.canvas.height;
|
||||
this.dirty = false;
|
||||
|
||||
if (text !== '')
|
||||
{
|
||||
|
@ -258,16 +259,7 @@ var Text = new Class({
|
|||
}
|
||||
}
|
||||
|
||||
if (this.state.game.config.renderType === Phaser.WEBGL)
|
||||
{
|
||||
this.canvasTexture = this.state.game.renderer.uploadCanvasToGPU(
|
||||
this.canvas,
|
||||
this.canvasTexture,
|
||||
!(this.prevWidth < canvas.width || this.prevHeight < canvas.height)
|
||||
);
|
||||
this.prevWidth = canvas.width;
|
||||
this.prevHeight = canvas.height;
|
||||
}
|
||||
this.dirty = true;
|
||||
|
||||
return this;
|
||||
},
|
||||
|
|
|
@ -5,6 +5,18 @@ var TextWebGLRenderer = function (renderer, src, interpolationPercentage, camera
|
|||
return;
|
||||
}
|
||||
|
||||
if (src.dirty)
|
||||
{
|
||||
src.canvasTexture = renderer.uploadCanvasToGPU(
|
||||
src.canvas,
|
||||
src.canvasTexture,
|
||||
!(src.prevWidth < src.canvas.width || src.prevHeight < src.canvas.height)
|
||||
);
|
||||
src.prevWidth = src.canvas.width;
|
||||
src.prevHeight = src.canvas.height;
|
||||
src.dirty = false;
|
||||
}
|
||||
|
||||
renderer.spriteBatch.addSpriteTexture(src, camera, src.canvasTexture, src.prevWidth, src.prevHeight);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue