phaser/v3/src/gameobjects/text/static/TextWebGLRenderer.js
2017-03-30 09:48:24 -03:00

23 lines
653 B
JavaScript

var TextWebGLRenderer = function (renderer, src, interpolationPercentage, camera)
{
if (this.renderMask !== this.renderFlags)
{
return;
}
if (src.dirty)
{
var w = src.canvas.width;
var h = src.canvas.height;
var resize = !(src.prevWidth < w || src.prevHeight < h);
src.canvasTexture = renderer.uploadCanvasToGPU(src.canvas, src.canvasTexture, resize);
src.prevWidth = w;
src.prevHeight = h;
src.dirty = false;
}
renderer.spriteBatch.addSpriteTexture(src, camera, src.canvasTexture, src.prevWidth, src.prevHeight);
};
module.exports = TextWebGLRenderer;