phaser/v3/src/gameobjects/text/static/TextWebGLRenderer.js

24 lines
653 B
JavaScript
Raw Normal View History

var TextWebGLRenderer = function (renderer, src, interpolationPercentage, camera)
{
if (this.renderMask !== this.renderFlags)
{
return;
}
if (src.dirty)
{
2017-03-21 23:14:25 +00:00
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;
}
2017-03-30 12:48:24 +00:00
renderer.spriteBatch.addSpriteTexture(src, camera, src.canvasTexture, src.prevWidth, src.prevHeight);
};
module.exports = TextWebGLRenderer;