The Dynamic Bitmap Text Canvas Renderer was creating a new data object every frame for the callback. It now uses the callbackData object instead, like the WebGL renderer does.

This commit is contained in:
Richard Davey 2018-10-25 14:11:23 +01:00
parent 4c73be9dbd
commit 7441ff90ae
2 changed files with 11 additions and 2 deletions

View file

@ -18,6 +18,7 @@
* `PluginManager.install` returns `null` if the plugin failed to install in all cases.
* `PluginFile` will now install the plugin into the _current_ Scene as long as the `start` or `mapping` arguments are provided.
* MATH_CONST no longer requires or sets the Random Data Generator, this is now done in the Game Config, allowing you to require the math constants without pulling in a whole copy of the RNG with it.
* The Dynamic Bitmap Text Canvas Renderer was creating a new data object every frame for the callback. It now uses the `callbackData` object instead, like the WebGL renderer does.
### Bug Fixes

View file

@ -36,6 +36,7 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc
var textureFrame = src.frame;
var displayCallback = src.displayCallback;
var callbackData = src.callbackData;
var cameraScrollX = camera.scrollX * src.scrollFactorX;
var cameraScrollY = camera.scrollY * src.scrollFactorY;
@ -61,7 +62,6 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc
var lastGlyph = null;
var lastCharCode = 0;
// var ctx = renderer.currentContext;
var image = src.frame.source.image;
var textureX = textureFrame.cutX;
@ -121,7 +121,15 @@ var DynamicBitmapTextCanvasRenderer = function (renderer, src, interpolationPerc
if (displayCallback)
{
var output = displayCallback({ tint: { topLeft: 0, topRight: 0, bottomLeft: 0, bottomRight: 0 }, index: index, charCode: charCode, x: x, y: y, scale: scale, rotation: 0, data: glyph.data });
callbackData.index = index;
callbackData.charCode = charCode;
callbackData.x = x;
callbackData.y = y;
callbackData.scale = scale;
callbackData.rotation = rotation;
callbackData.data = glyph.data;
var output = displayCallback(callbackData);
x = output.x;
y = output.y;