Skip to main content

Module ops

Module ops 

Source
Expand description

Low-level 32-bit pixel primitives.

Canvas is generic over PixelOps, so a kernel build monomorphises to the SSE2/AVX2 backend and a host test instantiates ScalarOps. There is no dyn dispatch on the hot path and no alloc-backed trait object.

Every public drawing call enters PixelOps::guard first. The kernel adapter returns an FpuGuard that preserves the caller’s SSE state; the scalar backend returns a zero-sized guard. The invariant therefore lives in the API instead of in the memory of each caller, which is where it used to live (each fill_rect opened with let _fpu = FpuGuard::save(); by convention).

Structs§

NoGuard
The default no-op guard, used by ScalarOps.
ScalarOps
Portable scalar backend. This is the reference implementation used by host tests; it is also correct on any architecture.

Traits§

PixelGuard
Marker for the RAII value returned by PixelOps::guard.
PixelOps
Raw 32-bit pixel operations.

Functions§

blend_word
Blend two packed 32-bit words byte by byte.