Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: Cull text under textfield #15576

Merged
merged 1 commit into from
Mar 18, 2024

Conversation

adrian17
Copy link
Collaborator

@adrian17 adrian17 commented Mar 14, 2024

This should optimize cases where there's a lot of text left to be scrolled under the textfield. The speedup can be extreme if there are hundreds of pointlessly-drawn lines.

(However, note that this doesn't help with the opposite case - when you scroll to the bottom, it'll still draw all the text :/ )

The perfect solution might be to implement all 4 types of culling (lines under/above* textfield/screen), but with all the transforms, height metrics etc etc this was the only one I could confidently implement - and even in this one I'm not convinced I didn't skip any edge cases.

(Note that due to how scrollV works, lines above the textfield could be skipped without even iterating over them. In fact... maybe FP (and us) could deduce in-bounds for each glyph, thus making us not require masking at all?)

@adrian17
Copy link
Collaborator Author

Here's a demonstration.
This was recorded with text masking disabled, so text outside the textfield is visible - except lines culled by this PR.
Right textfield is normal, left textfield has scrollV = 3.

ruffle_desktop_2024-03-14_19-19-17.mp4

@adrian17 adrian17 force-pushed the cull-text-under-textfield branch from 5e18e33 to 7217832 Compare March 14, 2024 18:22
@adrian17 adrian17 force-pushed the cull-text-under-textfield branch from 7217832 to 390f5ee Compare March 14, 2024 19:55
@adrian17 adrian17 force-pushed the cull-text-under-textfield branch from 390f5ee to dca90a8 Compare March 18, 2024 20:46
@adrian17 adrian17 enabled auto-merge (rebase) March 18, 2024 20:46
@adrian17 adrian17 merged commit 3c2d629 into ruffle-rs:master Mar 18, 2024
16 checks passed
@adrian17 adrian17 deleted the cull-text-under-textfield branch October 27, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants