mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-05 19:28:25 +00:00
Icon(imageVector = …) calls rememberVectorPainter, and a VectorPainter rasterises its paths into a cached graphics layer per instance, so the feed re-rasterised the same glyphs once per card. A font glyph is a blit from the shared text atlas, shared across every call site for free. tools/icon-font/build_icon_font.py converts the Kotlin ImageVector DSL to SVG paths and builds a TTF with fontTools. Font metrics mirror the bundled Material Symbols font (upem 960, ascent 1056, descent -96, advance 960) so glyphs align with existing call sites; generated outlines land within a few units of Google's own. Measured on the uniform-corpus feed benchmark (SM-T220, three arms A/B/A, 0.2% identical-arm noise floor, gate 18/18/18 cards): frame duration P90 -10.7% frame overrun P90 -17.4% DrawReactions 114.8 -> 76.7 ms/iteration For reference, ablating the reaction icons entirely gives frame P90 -13.5%, so this captures ~84% of the available headroom. It supersedes the shared-VectorPainter approach (-8.2%), which needed CompositionLocal plumbing and hand-scoping to avoid cross-size cache thrashing; glyphs are atlas-shared automatically. Artwork is unchanged: this converts Amethyst's existing vectors rather than substituting Google's glyphs. Verified on device by pixel comparison -- unconverted icons are 0-diff, and the converted ones differ only by sub-pixel antialiasing between the text and vector rasterisers. Stroked icons are deliberately NOT converted. A glyph outline can only be filled, so converting Zap (strokeLineWidth 1.2) turned a thin outline bolt into a solid one; the build script now detects a stroke and skips the icon, leaving Following, Zap and ZapSplit on their ImageVectors. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1CzYQvWyHfipSW7x3j4Yo