Skip to main content

paint_subtree

Function paint_subtree 

Source
pub fn paint_subtree(widget: &mut dyn Widget, ctx: &mut dyn DrawCtx)
Expand description

Paint widget and all its descendants. The caller must ensure ctx is already translated so that (0,0) maps to widget’s bottom-left corner.

If the widget returns Some from Widget::backbuffer_cache_mut, the whole subtree (widget + children + overlay) is rendered once into a CPU Framebuffer via a software GfxCtx, cached as an Arc<Vec<u8>> on the widget, and blitted through DrawCtx::draw_image_rgba_arc. Subsequent frames that find cache.dirty == false skip the re-raster entirely and just blit the existing bitmap — identical fast path to MatterCAD’s DoubleBuffer.