Rendering PipelineBaseline · Widely

Paint & Rasterization

Mental Model

Paint does not draw pixels directly; it records ordered vector instructions (DisplayItem lists) on the main thread. Rasterization then splits layers into bitmap tiles and fills those pixels on worker threads or the GPU before compositing.

Interactive Simulator

From DisplayItems to GPU Bitmap Tiles

Follow how vector paint commands become tiled GPU textures.

DisplayList
Tiling
Raster
GPU Upload
Step 1 / 3: 1. Paint Record Emission

Main thread walks the box tree in stacking order and emits DisplayItems (fillRect, drawText, clip).

.card { background: #111; box-shadow: 0 8px 24px #0006; }
Internal State / Memory
displayItems
24
mainThreadMs
1.8
pixelsDrawnYet
0

Under the Hood

Paint is an architect drafting blueprints; Rasterization is the print shop turning those blueprints into tiled posters.

  1. DisplayList Recording: The engine traverses boxes by CSS Stacking Context order and appends draw calls (backgrounds, borders, text glyphs).
  2. Tile Splitting: Layers are divided into square tiles so the engine only rasterizes regions near the viewport.
  3. Raster & Upload: Skia or GPU shaders fill tile bitmaps and upload them as textures for GPU Compositor Layers.
CSS
/* Triggers Paint only (skips Layout) when color changes */
.status-badge {
  background-color: #16a34a;
  contain: paint; /* Clips descendants and isolates invalidation */
}

/* Heavy blur multiplies rasterization time per tile */
.expensive-frost { backdrop-filter: blur(24px); }

Problem Genealogy

  • 2008–2013: Single-threaded software painting forced the main thread to rasterize every pixel synchronously, stalling input during scrolls.
  • 2014+ (Impl-side Painting): Browsers decoupled DisplayList recording on the main thread from multi-threaded / GPU tile rasterization.

Production Pitfalls

Production Pitfall
  • Giant box-shadow and filter: blur(): Large blur radii expand paint invalidation rects and force multi-pass shader sampling per tile.
  • Animating background-color on huge containers: Even without Layout, repaints re-rasterize every covered tile on each frame.
When Not to Use
  • When not to use heavy paint effects: Avoid animating box-shadow, border-radius, or backdrop-filter at 60fps; animate opacity on a pre-rendered pseudo-element instead.

Connections & Logical Next Steps

Seen in Architecture Autopsies