pub struct ClipStack { /* private fields */ }Expand description
The clipping state: an ordered list of contributions to intersect.
The entries sit behind an Arc, so the clone every emitted object takes
of its graphics state shares them: thousands of consecutive paths under
one clip cost one reference count each, and a push copies the vector
only when it is shared. With the vector owned, the state clone was 9.6%
of vector_paths_1751’s build.
Implementations§
Source§impl ClipStack
impl ClipStack
Sourcepub fn push_path(&mut self, path: BezPath, rule: ClipRule)
pub fn push_path(&mut self, path: BezPath, rule: ClipRule)
Add a path, merging it with a containing rectangle above it.
The merge is what keeps a re W n inside a larger re W n from
producing two entries.
Sourcepub fn push_text(&mut self, runs: Vec<TextClipRun>) -> Result<(), TextClipLimit>
pub fn push_text(&mut self, runs: Vec<TextClipRun>) -> Result<(), TextClipLimit>
Add a batch of clipping text runs.
A batch taking the total past MAX_TEXT_OBJECTS is dropped
whole, not truncated — no prefix of it clips.
§Errors
TextClipLimit when the batch would take the stack past the cap.
The stack is left unchanged; a refused batch does not re-offer itself
at the next ET.
Sourcepub fn push_empty(&mut self)
pub fn push_empty(&mut self)
Add an empty clip, which blanks everything after it.
This is what a single-point path with a pending clip produces: a degenerate rectangle at the origin, whose interior is nothing.