mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 20:51:29 +11:00
d14895b107
I realized there's a problem with encoding clip bboxes relative to the current transform (see #36 for a more detailed explanation), so this is changing it to absolute bboxes. This more or less gets clips working. There are optimization opportunities (all-clear and all-opaque mask tiles), and it doesn't deal with overflow of the blend stack, but it seems to basically work.
37 lines
972 B
Rust
37 lines
972 B
Rust
use piet_gpu_derive::piet_gpu;
|
|
|
|
piet_gpu! {
|
|
#[gpu_write]
|
|
mod annotated {
|
|
struct AnnoFill {
|
|
// The bbox is always first, as we take advantage of common
|
|
// layout when binning.
|
|
bbox: [f32; 4],
|
|
rgba_color: u32,
|
|
}
|
|
struct AnnoFillMask {
|
|
bbox: [f32; 4],
|
|
mask: f32,
|
|
}
|
|
struct AnnoStroke {
|
|
bbox: [f32; 4],
|
|
rgba_color: u32,
|
|
// 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,
|
|
}
|
|
struct AnnoClip {
|
|
bbox: [f32; 4],
|
|
}
|
|
enum Annotated {
|
|
Nop,
|
|
Stroke(AnnoStroke),
|
|
Fill(AnnoFill),
|
|
FillMask(AnnoFillMask),
|
|
FillMaskInv(AnnoFillMask),
|
|
BeginClip(AnnoClip),
|
|
EndClip(AnnoClip),
|
|
}
|
|
}
|
|
}
|