mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 12:41:30 +11:00
fix fragment transform logic
This commit is contained in:
parent
d7773bf877
commit
2e8be24fc9
|
@ -61,7 +61,7 @@ impl From<(f32, f32)> for Point {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Affine transformation matrix.
|
/// Affine transformation matrix.
|
||||||
#[derive(Copy, Clone, Debug, Pod, Zeroable)]
|
#[derive(Copy, Clone, PartialEq, Debug, Pod, Zeroable)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct Affine {
|
pub struct Affine {
|
||||||
pub xx: f32,
|
pub xx: f32,
|
||||||
|
|
|
@ -160,11 +160,13 @@ impl<'a> Builder<'a> {
|
||||||
pub fn append(&mut self, fragment: &Fragment, transform: Option<Affine>) {
|
pub fn append(&mut self, fragment: &Fragment, transform: Option<Affine>) {
|
||||||
let drawdata_base = self.scene.drawdata_stream.len();
|
let drawdata_base = self.scene.drawdata_stream.len();
|
||||||
let mut cur_transform = self.scene.transform_stream.last().copied();
|
let mut cur_transform = self.scene.transform_stream.last().copied();
|
||||||
if cur_transform.is_none() {
|
if let Some(transform) = transform {
|
||||||
if let Some(transform) = transform {
|
if cur_transform.is_none() {
|
||||||
self.encode_transform(transform);
|
|
||||||
cur_transform = Some(Affine::IDENTITY);
|
cur_transform = Some(Affine::IDENTITY);
|
||||||
}
|
}
|
||||||
|
self.encode_transform(transform);
|
||||||
|
} else if cur_transform != Some(Affine::IDENTITY) {
|
||||||
|
self.encode_transform(Affine::IDENTITY);
|
||||||
}
|
}
|
||||||
self.scene.append(&fragment.data, &transform);
|
self.scene.append(&fragment.data, &transform);
|
||||||
match &mut self.resources {
|
match &mut self.resources {
|
||||||
|
|
Loading…
Reference in a new issue