vello/piet-gpu-types/src/annotated.rs
Elias Naur 8db77e180e support stroked fills for clips, images
This change completes general support for stroked fills for clips and
images.

Annotated_size increases from 28 to 32, because of the linewidth field
added to AnnoImage. Stroked image fills are presumably rare, and if
memory pressure turns out to be a bottleneck, we could replace the
linewidth field with a separate AnnoLinewidth elements.

Updates #70

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-03-19 16:43:33 +01:00

36 lines
923 B
Rust

use piet_gpu_derive::piet_gpu;
piet_gpu! {
#[gpu_write]
mod annotated {
struct AnnoImage {
bbox: [f32; 4],
linewidth: f32,
index: u32,
offset: [i16; 2],
}
struct AnnoColor {
bbox: [f32; 4],
// For stroked fills.
// For the nonuniform scale case, this needs to be a 2x2 matrix.
// That's expected to be uncommon, so we could special-case it.
linewidth: f32,
rgba_color: u32,
}
struct AnnoBeginClip {
bbox: [f32; 4],
linewidth: f32,
}
struct AnnoEndClip {
bbox: [f32; 4],
}
enum Annotated {
Nop,
Color(TagFlags, AnnoColor),
Image(TagFlags, AnnoImage),
BeginClip(TagFlags, AnnoBeginClip),
EndClip(AnnoEndClip),
}
}
}