vello_cpu/dispatch/
mod.rs1#[cfg(feature = "multithreading")]
5pub(crate) mod multi_threaded;
6pub(crate) mod single_threaded;
7
8use crate::RenderMode;
9use crate::kurbo::{Affine, BezPath, Stroke};
10use crate::peniko::{BlendMode, Fill};
11use core::fmt::Debug;
12use vello_common::coarse::Wide;
13use vello_common::encode::EncodedPaint;
14use vello_common::filter_effects::Filter;
15use vello_common::mask::Mask;
16use vello_common::paint::Paint;
17use vello_common::strip::Strip;
18use vello_common::strip_generator::StripStorage;
19
20pub(crate) trait Dispatcher: Debug + Send + Sync {
21 fn wide(&self) -> &Wide;
22 fn generate_wide_cmd(
23 &mut self,
24 strip_buf: &[Strip],
25 paint: Paint,
26 blend_mode: BlendMode,
27 encoded_paints: &[EncodedPaint],
28 );
29 fn fill_path(
30 &mut self,
31 path: &BezPath,
32 fill_rule: Fill,
33 transform: Affine,
34 paint: Paint,
35 blend_mode: BlendMode,
36 aliasing_threshold: Option<u8>,
37 mask: Option<Mask>,
38 encoded_paints: &[EncodedPaint],
39 );
40 fn stroke_path(
41 &mut self,
42 path: &BezPath,
43 stroke: &Stroke,
44 transform: Affine,
45 paint: Paint,
46 blend_mode: BlendMode,
47 aliasing_threshold: Option<u8>,
48 mask: Option<Mask>,
49 encoded_paints: &[EncodedPaint],
50 );
51 fn push_clip_path(
52 &mut self,
53 path: &BezPath,
54 fill_rule: Fill,
55 transform: Affine,
56 aliasing_threshold: Option<u8>,
57 );
58 fn pop_clip_path(&mut self);
59 fn push_layer(
60 &mut self,
61 clip_path: Option<&BezPath>,
62 fill_rule: Fill,
63 clip_transform: Affine,
64 blend_mode: BlendMode,
65 opacity: f32,
66 aliasing_threshold: Option<u8>,
67 mask: Option<Mask>,
68 filter: Option<Filter>,
69 );
70 fn pop_layer(&mut self);
71 fn reset(&mut self);
72 fn flush(&mut self, encoded_paints: &[EncodedPaint]);
73 fn rasterize(
74 &self,
75 buffer: &mut [u8],
76 render_mode: RenderMode,
77 width: u16,
78 height: u16,
79 encoded_paints: &[EncodedPaint],
80 );
81 fn strip_storage_mut(&mut self) -> &mut StripStorage;
82}