A container that probes a child's size was still doing it with a real draw, so `Painter::measure` existed and almost nothing used it. Tracing every draw of one streamed frame: 1,083 `Widget::draw` calls over 113 distinct widgets, the worst drawn 11 times at nesting depth 7-8, every one of them mode `Draw` and none of them dirty. The cache was working -- each of the 11 was offered a genuinely different region, alternating between an oversized probe box and a real one. ScrollArea::draw was one of the two sources. It drew its whole content at a box built from a stale hint, read the length back, corrected the scroll position, and drew the content again where it belonged. The first of those is now a measurement. The other half is the measure fast path. A widget's reported size is a function of its own state and the size it was offered, not of where it was offered -- so an undirtied widget already drawn at a region of this size has already answered, and `active.size` is the answer. This is the same assumption `mov` makes one branch further down (same offered size, therefore identical output, therefore a translation); it is only stated as a size here rather than acted on as a move. Without it a measurement costs a full recursive walk, which is what made the nesting compound. A measurement now also peeks at the redraw mark instead of consuming it -- it is not the redraw the mark asked for, and swallowing it would leave the widget stale until something marked it again. 453 draws from 1,083, and the streamed frame is p50 1.18ms (from 1.22ms, and 2.20ms before this run of work). The headless phone render is byte-identical to the previous commit's on the real GPU. What is deliberately NOT here: the same change to `Span::draw`'s phase 1, which is the remaining 2x and which moves the layout by a few pixels. The layout stays intact -- it is a position difference, not a broken frame -- but which of the two is correct was not established, and the suspicion (that phase 2 now takes `mov`, and `mov` accumulates deltas where a redraw recomputes) points at a bug in `mov` rather than in `Span`. Written up in docs/IRIS_TODO.md with Iris's target shape for `Span`: no probe phase at all for `abs` children, and a `rest` child forcing a reposition pass rather than a redraw.
iris
My experimental attempt at a rust ui library (also my first ui library).
It's currently designed around using retained data structures (widgets), rather than diffing generated trees from data like xilem or iced. This is an experiment and I'm not sure if it's a good idea or not.
Examples are in examples, eg. cargo run --example tabs.
Goals, in general order:
- does what I want it to (text, images, video, animations)
- very easy to use ignoring ergonomic ref counting
- reasonably fast / efficient (a lot faster than electron, save battery life, try to beat iced and xilem)
dev details
not targeting web rn cause wanna use actual nice gpu features & entire point of this is to make desktop apps / not need a web browser
general ideas trynna use rn / experiment with:
- retained mode
- specifically designed around wgpu so there's no translation
- postfix functions for most things to prevent unreadable indentation (going very well)
- events can be done directly where you draw the widgets
- almost no macros in user code & actual LSP typechecking (variadic generics if you can hear me please save us)
- relative anchor + absolute offset coord system (+ "rest" / leftover during widget layout)
- single threaded ui & pass context around to make non async usage straightforward (pretty unsure about this)
- widgets store outside of the actual rendering so they can be moved around and swapped easily (unsure about this but seems to work good for now)
under heavy initial development so not gonna try to explain status, maybe check TODO for that; sizable chance it gets a rewrite once I know everything I need and what seems to work best
it's called iris because it's the structure around what you actually want to display and colorful