Repository navigation
Conversation
The four Chrome caption painters rebuilt their whole 16x16 glyph (dozens of cubicTo/lineTo calls) on every paint. The geometry depends on neither the color nor the paint size, so each painter now keeps it in a lazily initialized static final Path; the color stays in the per-paint Paint. Tests check that each glyph still fills and leaves empty its characteristic points in both themes, that a glyph draws the same Path object across repaints, and that glyph types do not share a Path.
This was referenced Nov 10, 2026
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.
Problem
The four built-in Chrome caption painters (minimize, maximize, restore, close) rebuild their complete 16x16 glyph, dozens of
cubicTo/lineTocalls, on everypaint, although the geometry is constant.Change
Each painter keeps its glyph in a lazily initialized
static final Path. The geometry depends on neither the color nor the paint size (the icon is always laid out at 16x16 and never scaled or mirrored), so there is nothing to invalidate: the device pixel ratio is applied by the canvas transform, and the color stays in the per-paintPaint. Memory is bounded to fourPathobjects per isolate. Rendering output is unchanged; the gain is small per frame and was not benchmarked.Tests
New
test/window_caption_path_cache_test.dart: for each glyph, in light and dark themes, the painted path fills and leaves empty characteristic points (geometry unchanged; these assertions also pass against the old painters), the samePathinstance is drawn across repaints (fails against the old painters), and glyph types do not share aPath.dart format --set-exit-if-changed .,flutter analyze(package and example) andflutter test(package and example) pass locally (Flutter 3.47.7, Windows), and the full CI workflow passes on the identical commit in my fork.Related
Part of a set of independent PRs, each based on
mainand mergeable on its own: widgets #598, #599 (this), #600, #601; legacy bridge #602, #603, #604, #605, #606.Touches
window_caption_button.dartlike #598 (caption button states); the two merge cleanly in either order.