Skip to main content

CommandBucketer

Struct CommandBucketer 

Source
pub(crate) struct CommandBucketer {
    viewport: RectU16,
    pub(super) clip_bboxes: Vec<RectU16>,
    pub(super) rows: RetainVec<RowState>,
    pub(crate) paint_fill_attrs: Vec<PaintFillAttrs>,
    pub(crate) layer_fill_attrs: Vec<LayerFillAttrs>,
    pub(crate) filter_paints: Vec<EncodedPaint>,
    pub(super) active_layers: Vec<ActiveLayer>,
    occupied_rows_pool: VecPool<usize>,
    occupied_rows_bool_scratch: Vec<bool>,
    pub(super) next_draw_id: u32,
}
Expand description

A bucketer that groups commands into strip-row-sized buckets.

Fields§

§viewport: RectU16

The viewport of the root/filter layer we are currently bucketing.

§clip_bboxes: Vec<RectU16>

The currently active stack of clip bboxes (from layer clips), always anchored at the (0, 0) origin, regardless of the viewport, tracked for two reasons:

  • So we can clamp fill commands to the bbox and avoid unnecessary rendering work.
  • In case we have a filter layer with a clip, it all happens in three steps:
    1. We first push a new intermediate layer with the clip.
    2. We composite the whole filter layer cropped to the active clip bbox. Note that the filter layer itself is not affected by the clip bbox, as filter layers should always be fully rendered before applying clipping. However, by limiting the composition to the coarse clip bbox we might be able to save a lot of work if only a small part of the filter layer is visible.
    3. Pop the intermediate layer, which will take care of doing the fine-grained clipping (e.g. applying anti-aliasing from the clip path).
§rows: RetainVec<RowState>

The actual render commands for each strip row.

Since this is essentially a 2D-array, we use RetainVec to preserve inner allocations upon resetting.

§paint_fill_attrs: Vec<PaintFillAttrs>§layer_fill_attrs: Vec<LayerFillAttrs>§filter_paints: Vec<EncodedPaint>§active_layers: Vec<ActiveLayer>

Keeping track of currently active layers to enable lazy layer pushing.

§occupied_rows_pool: VecPool<usize>

A vector pool for keeping track of occupied rows in a layer.

§occupied_rows_bool_scratch: Vec<bool>

Scratch space used when replaying clip strips while popping clipped layers.

§next_draw_id: u32

A counter to assign monotonically increasing IDs to draws to enable depth buffer rendering.

Implementations§

Source§

impl CommandBucketer

Source

pub(crate) fn from_wh(width: u16, height: u16) -> Self

Source

pub(crate) fn new(viewport: RectU16) -> Self

Source

fn bbox_span(bbox: RectU16) -> Span

Source

pub(crate) fn rows(&self) -> &[RowState]

Source

pub(crate) fn width(&self) -> u16

Source

fn viewport_origin(&self) -> (u16, u16)

Source

pub(crate) fn reset(&mut self, viewport: RectU16)

Source

fn next_draw_id(&mut self) -> u32

Source

pub(super) fn ensure_row_layers(&mut self, row_idx: usize)

Source

pub(crate) fn bucket_commands( &mut self, nodes: &[Node], draws: &[RecordedFill], layers: &[RecordedLayer], strips: &[Strip], encoded_paints: &[EncodedPaint], filter_ctx: &FilterContext, )

Source

pub(crate) fn push_layer(&mut self, props: &LayerProps)

Source

pub(crate) fn pop_layer(&mut self, strips: &[Strip])

Source

pub(crate) fn generate_filter_layer_fill( &mut self, pixmap: Arc<Pixmap>, placement: FilterLayerPlacement, static_paint_count: usize, )

Source

pub(crate) fn generate_fill( &mut self, strip_buf: &[Strip], attrs: &PaintFillAttrs, encoded_paints: &[EncodedPaint], )

Source

pub(crate) fn generate<F, A>( &mut self, strip_buf: &[Strip], fill_cmd: F, alpha_fill_cmd: A, )
where F: FnMut(&mut Self, GeneratedFill), A: FnMut(&mut Self, GeneratedAlphaFill),

Source

fn push_fill( &mut self, fill: GeneratedFill, attrs_idx: u32, draw_id: Option<u32>, )

Note: If depth-culling should be disabled, pass None to draw_id.

Trait Implementations§

Source§

impl Debug for CommandBucketer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.