mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-11 04:51:32 +11:00
07e07c7544
As described in #62, the non-deterministic scene monoid may result in slightly different transformations for path segments in an otherwise closed path. This change ensures consistent transformation across paths in three steps. First, absolute transformations computed by the scene monoid is stored along with path segments and annotated elements. Second, elements.comp no longer transforms path segments. Instead, each segment is stored untransformed along with a reference to its absolute transformation. Finally, path_coarse performs the transformation of path segments. Because all segments in a path share a single transformation reference, the inconsistency in #62 is avoided. Fixes #62 Signed-off-by: Elias Naur <mail@eliasnaur.com>
35 lines
960 B
Rust
35 lines
960 B
Rust
use piet_gpu_derive::piet_gpu;
|
|
|
|
piet_gpu! {
|
|
#[gpu_write]
|
|
mod pathseg {
|
|
struct PathFillCubic {
|
|
p0: [f32; 2],
|
|
p1: [f32; 2],
|
|
p2: [f32; 2],
|
|
p3: [f32; 2],
|
|
path_ix: u32,
|
|
// trans_ix is 1-based, 0 means no transformation.
|
|
trans_ix: u32,
|
|
// A note: the layout of this struct is shared with
|
|
// PathStrokeCubic. In that case, we actually write
|
|
// [0.0, 0.0] as the stroke field, to minimize divergence.
|
|
}
|
|
struct PathStrokeCubic {
|
|
p0: [f32; 2],
|
|
p1: [f32; 2],
|
|
p2: [f32; 2],
|
|
p3: [f32; 2],
|
|
path_ix: u32,
|
|
trans_ix: u32,
|
|
// halfwidth in both x and y for binning
|
|
stroke: [f32; 2],
|
|
}
|
|
enum PathSeg {
|
|
Nop,
|
|
FillCubic(PathFillCubic),
|
|
StrokeCubic(PathStrokeCubic),
|
|
}
|
|
}
|
|
}
|