vello_cpu/dispatch/
mod.rs1#[cfg(feature = "multithreading")]
5pub(crate) mod multi_threaded;
6pub(crate) mod single_threaded;
7
8use crate::RasterizerSettings;
9use crate::kurbo::{Affine, BezPath, Rect, Stroke};
10use crate::peniko::{BlendMode, Fill};
11use core::fmt::Debug;
12use vello_common::encode::EncodedPaint;
13use vello_common::filter::FilterData;
14use vello_common::mask::Mask;
15use vello_common::paint::{ImageResolver, Paint};
16use vello_common::pixmap::PixmapMut;
17
18pub(crate) trait Dispatcher: Debug + Send {
19 fn has_layers(&self) -> bool;
20 fn fill_path(
21 &mut self,
22 path: &BezPath,
23 fill_rule: Fill,
24 transform: Affine,
25 paint: Paint,
26 blend_mode: BlendMode,
27 aliasing_threshold: Option<u8>,
28 mask: Option<Mask>,
29 );
30 fn stroke_path(
31 &mut self,
32 path: &BezPath,
33 stroke: &Stroke,
34 transform: Affine,
35 paint: Paint,
36 blend_mode: BlendMode,
37 aliasing_threshold: Option<u8>,
38 mask: Option<Mask>,
39 );
40 fn fill_rect_fast(
42 &mut self,
43 rect: &Rect,
44 paint: Paint,
45 blend_mode: BlendMode,
46 mask: Option<Mask>,
47 );
48 fn push_clip_path(
49 &mut self,
50 path: &BezPath,
51 fill_rule: Fill,
52 transform: Affine,
53 aliasing_threshold: Option<u8>,
54 );
55 fn pop_clip_path(&mut self);
56 fn push_layer(
57 &mut self,
58 clip_path: Option<&BezPath>,
59 fill_rule: Fill,
60 clip_transform: Affine,
61 blend_mode: BlendMode,
62 opacity: f32,
63 aliasing_threshold: Option<u8>,
64 mask: Option<Mask>,
65 filter_data: Option<FilterData>,
66 );
67 fn pop_layer(&mut self);
68 fn reset(&mut self, width: u16, height: u16);
69 fn flush(&mut self);
70 fn rasterize(
71 &self,
72 target: PixmapMut<'_>,
73 scene_width: u16,
74 scene_height: u16,
75 settings: RasterizerSettings,
76 encoded_paints: &[EncodedPaint],
77 image_resolver: &dyn ImageResolver,
78 );
79 fn is_multi_threaded(&self) -> bool;
80}