Repository navigation
Let go of a rich-text run's color once nothing draws with it - #344
Merged
Merged
Conversation
A run's own color (ContentRun::color or background, a link's) was registered as a color style when the text was drawn, and never let go: a run whose color changed every frame added a style a frame. - The text system keeps a color style for each run color, shared by the runs in it, and lets go of one nothing has drawn with for 16 frames. - A cached scope's capture notes the run colors it used; showing it again keeps them. One that went makes the scope draw again, so a reused slot never shows in an old capture. - A theme reload, which clears every style, empties the pool.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A rich-text run with its own color added a color style each time that color changed, and none was ever let go. The style table grew without limit under an animated run color. This is what's left of the growth #307 fixed for app colors.
What went wrong
ContentRun::color,ContentRun::backgroundand a link's colors are drawn with color styles.RegisterColorStyle):The fix
SkribidiContext::RunColorStyle):CreateColorStyleand shared by the runs in that color.DestroyColorStyle). The text system's sweep does it, every 8 frames.ReplayAtlasToucheskeeps them.ClearAllfrees every style. The pool sees the newStyleManager::Generationand forgets its slots.RegisterColorStyleTests
ARunColorThatChangesEveryFrameDoesNotGrowTheStylesdraws 250 frames of a changing run color and background. It failed before the fix.ACachedScopeKeepsItsRunColorsUntilOneGoes:RegisterColorStyle(color)'s. A run color now has a style of its own, so they check that it shows the same color: the sameVisualColorStyle, pointing at the same atlas texel.gui_core_testsgui_vulkan_tests,gui_d3d12_testsandgui_sdlgpu_testsgui_gpu_testson Vulkan, Direct3D 12 and SDL GPU