2020-05-13 03:53:54 +10:00
|
|
|
use piet_gpu_derive::piet_gpu;
|
|
|
|
|
|
|
|
piet_gpu! {
|
|
|
|
#[gpu_write]
|
|
|
|
mod annotated {
|
|
|
|
struct AnnoFill {
|
2020-11-21 04:26:02 +11:00
|
|
|
// The bbox is always first, as we take advantage of common
|
|
|
|
// layout when binning.
|
2020-05-13 03:53:54 +10:00
|
|
|
bbox: [f32; 4],
|
2020-11-21 04:26:02 +11:00
|
|
|
rgba_color: u32,
|
2020-05-13 03:53:54 +10:00
|
|
|
}
|
2020-10-09 21:43:29 +11:00
|
|
|
struct AnnoFillMask {
|
|
|
|
bbox: [f32; 4],
|
2020-11-21 04:26:02 +11:00
|
|
|
mask: f32,
|
2020-10-09 21:43:29 +11:00
|
|
|
}
|
2020-05-13 03:53:54 +10:00
|
|
|
struct AnnoStroke {
|
|
|
|
bbox: [f32; 4],
|
2020-11-21 04:26:02 +11:00
|
|
|
rgba_color: u32,
|
2020-05-13 03:53:54 +10:00
|
|
|
// 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,
|
|
|
|
}
|
2020-11-20 06:53:59 +11:00
|
|
|
struct AnnoClip {
|
|
|
|
bbox: [f32; 4],
|
|
|
|
}
|
2020-05-13 03:53:54 +10:00
|
|
|
enum Annotated {
|
|
|
|
Nop,
|
|
|
|
Stroke(AnnoStroke),
|
|
|
|
Fill(AnnoFill),
|
2020-10-09 21:43:29 +11:00
|
|
|
FillMask(AnnoFillMask),
|
|
|
|
FillMaskInv(AnnoFillMask),
|
2020-11-20 06:53:59 +11:00
|
|
|
BeginClip(AnnoClip),
|
|
|
|
EndClip(AnnoClip),
|
2020-05-13 03:53:54 +10:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|