pub struct DrawState {
pub cumulative_matrix: [f32; 6],
/* private fields */
}Expand description
Flat draw state tracking clips and transforms. Note: PushLayer and PopLayer commands are intentionally not tracked here; layers are managed outside this struct by the caller.
Fields§
§cumulative_matrix: [f32; 6]Implementations§
Source§impl DrawState
impl DrawState
pub fn new() -> Self
Sourcepub fn push_clip(&mut self, rect: Rect) -> Rect
pub fn push_clip(&mut self, rect: Rect) -> Rect
Pushes rect as a clip, intersected with whatever is already clipping, and returns the effective
scissor.
A child clip that does not meet its parent clips away to nothing, and that case is worth spelling
out because getting it wrong is invisible in every test that does not scroll: intersect answers
None for two rects that do not overlap, and falling back to rect there hands the child its own
box as the scissor — outside everything that contains it. A widget that emits a clip of its own (an
image does, for a Cover overflow or a corner radius) therefore escaped the scroll area it lived in
the moment it scrolled out of view: it went on being drawn at its true position, outside the panel,
sliding as the content scrolled, and only looked right once its own box fell back inside the viewport.
Nothing without a clip of its own could show the bug, which is why the text and boxes beside it in
the same list were always clipped correctly.