mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 12:41:30 +11:00
Fix transform stack bugs in color glyph loader
This commit is contained in:
parent
6f9e53459a
commit
3afe2eaac2
|
@ -107,7 +107,12 @@ impl<'a> GlyphProvider<'a> {
|
||||||
for command in glyph.commands() {
|
for command in glyph.commands() {
|
||||||
match command {
|
match command {
|
||||||
Command::PushTransform(xform) => {
|
Command::PushTransform(xform) => {
|
||||||
xform_stack.push(convert_transform(xform));
|
let xform = if let Some(parent) = xform_stack.last() {
|
||||||
|
convert_transform(xform) * *parent
|
||||||
|
} else {
|
||||||
|
convert_transform(xform)
|
||||||
|
};
|
||||||
|
xform_stack.push(xform);
|
||||||
}
|
}
|
||||||
Command::PopTransform => { xform_stack.pop(); },
|
Command::PopTransform => { xform_stack.pop(); },
|
||||||
Command::PushClip(path_index) => {
|
Command::PushClip(path_index) => {
|
||||||
|
@ -128,8 +133,7 @@ impl<'a> GlyphProvider<'a> {
|
||||||
max: Point::new(bounds.max.x, bounds.max.y),
|
max: Point::new(bounds.max.x, bounds.max.y),
|
||||||
};
|
};
|
||||||
if let Some(xform) = xform_stack.last() {
|
if let Some(xform) = xform_stack.last() {
|
||||||
rect.min = rect.min.transform(xform);
|
rect = rect.transform(xform);
|
||||||
rect.max = rect.max.transform(xform);
|
|
||||||
}
|
}
|
||||||
builder.push_layer(Default::default(), rect.elements());
|
builder.push_layer(Default::default(), rect.elements());
|
||||||
}
|
}
|
||||||
|
@ -140,8 +144,7 @@ impl<'a> GlyphProvider<'a> {
|
||||||
max: Point::new(bounds.max.x, bounds.max.y),
|
max: Point::new(bounds.max.x, bounds.max.y),
|
||||||
};
|
};
|
||||||
if let Some(xform) = xform_stack.last() {
|
if let Some(xform) = xform_stack.last() {
|
||||||
rect.min = rect.min.transform(xform);
|
rect = rect.transform(xform);
|
||||||
rect.max = rect.max.transform(xform);
|
|
||||||
}
|
}
|
||||||
builder.push_layer(convert_blend(*mode), rect.elements())
|
builder.push_layer(convert_blend(*mode), rect.elements())
|
||||||
}
|
}
|
||||||
|
@ -154,7 +157,7 @@ impl<'a> GlyphProvider<'a> {
|
||||||
builder.fill(
|
builder.fill(
|
||||||
Fill::NonZero,
|
Fill::NonZero,
|
||||||
&brush,
|
&brush,
|
||||||
brush_xform,
|
brush_xform.map(|x| x * *xform),
|
||||||
convert_transformed_path(path.elements(), xform),
|
convert_transformed_path(path.elements(), xform),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue