Process-wide cache for rasterized outset box-shadow coverage. More...
Go to the source code of this file.
Process-wide cache for rasterized outset box-shadow coverage.
Drawing a CSS box shadow blurs a rounded rect every paint, which is wasteful when the same shadow is painted frame after frame — a static shadow on a repainting view, or a card that only translates or whose shadow color/opacity animates. The blurred shape is origin-agnostic: it depends on the box size, blur, spread, corner radius, shadow offset, and device scale, but not on the box's screen position or the shadow color.
This cache stores the blurred white coverage image keyed on that origin-agnostic fingerprint. The shadow path then:
Painting is on the UI thread (not the realtime audio thread), so a small mutex is acceptable; the cache is process-global with an LRU cap. Disabled or non-axis-aligned transforms fall back to the direct (uncached) shadow path, so output is unchanged when caching cannot apply.