#6501·fyne

perf(painter/software): add fast-path for solid color rectangle and background fills

Author: hazyhaarCreated Aug 24, 2026Updated Sep 4, 2026

Checklist

  • I have searched the issue tracker for open issues that relate to the same feature, before opening a new one.
  • This issue only relates to a single feature. I will open new issues for any other features.

Is your feature request related to a problem?

When rendering widgets or capturing scenes using the software renderer (internal/painter/software), drawing basic opaque rectangular shapes (canvas.Rectangle, container backgrounds, headers) currently evaluates per-pixel drawing routines.

  • This creates unnecessary CPU overhead on large solid fill regions during software rendering, screenshot generation, and headless testing.

Is it possible to construct a solution with the existing API?

Currently, the software painter iterates over pixels through general drawing paths without a dedicated fast-path for solid opaque fills.

Describe the solution you'd like to see.

Introduce a dedicated fast-path for opaque solid color fills (e.g. filling contiguous scanline slices directly or utilizing bulk memory fill) within internal/painter/software.

Observed benchmark impact (100x100 solid rectangle):

  • Current software rectangle draw: ~56.9 µs/op (41 KB allocated, 3 allocs/op).
  • Direct scanline fast-path: ~4.3 µs/op (0 B, 0 allocs/op, ~13x speedup).
  • This significantly reduces test suite duration for visual regression tests and headless playground rendering.