mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 20:51:29 +11:00
db59b5d570
Before this change, every command (FillColor, FillImage, BeginClip) had (or would need) stroke, (non-zero) fill and solid variants. This change adds a command for each fill mode and their parameters, reducing code duplication and adds support for stroked FillImage and BeginClip as a side-effect. The rest of the pipeline doesn't yet support Stroked FillImage and BeginClip. That's a follow-up change. Since each command includes a tag, this change adds an extra word for each fill and stroke. That waste is also addressed in a follow-up. Updates #70 Signed-off-by: Elias Naur <mail@eliasnaur.com>
44 lines
966 B
Rust
44 lines
966 B
Rust
use piet_gpu_derive::piet_gpu;
|
|
|
|
piet_gpu! {
|
|
#[gpu_write]
|
|
mod ptcl {
|
|
struct CmdStroke {
|
|
// This is really a Ref<Tile>, but we don't have cross-module
|
|
// references.
|
|
tile_ref: u32,
|
|
half_width: f32,
|
|
}
|
|
struct CmdFill {
|
|
// As above, really Ref<Tile>
|
|
tile_ref: u32,
|
|
backdrop: i32,
|
|
}
|
|
struct CmdColor {
|
|
rgba_color: u32,
|
|
}
|
|
struct CmdImage {
|
|
index: u32,
|
|
offset: [i16; 2],
|
|
}
|
|
struct CmdAlpha {
|
|
alpha: f32,
|
|
}
|
|
struct CmdJump {
|
|
new_ref: u32,
|
|
}
|
|
enum Cmd {
|
|
End,
|
|
Fill(CmdFill),
|
|
Stroke(CmdStroke),
|
|
Solid,
|
|
Alpha(CmdAlpha),
|
|
Color(CmdColor),
|
|
Image(CmdImage),
|
|
BeginClip,
|
|
EndClip,
|
|
Jump(CmdJump),
|
|
}
|
|
}
|
|
}
|