Refactor FlxBitmapText rendering in renderTile #3394
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, FlxBitmapText, on text/size/font changes, would cache the position of every character it draws, this includes caching each border character individually, but this did very to actually reduce rendering time, the real bottle-neck came from clipping each frame to the clipRect. By removing this caching in renderTile, we open up the possibility for better features, such as per character text effects
To stress test I added this to my test state
I noticed a huge perf difference with the following code:
A 98% reduction in render time
I also tried multiline with a cliprect


Old:
New:
A 99.6% reduction in rendering time
I also tested all of these without a clipRect and with renderBlit and found no difference in performance (all tests ran at 120fps with 100 draw calls per frame)