mirror of
https://github.com/penpot/penpot.git
synced 2026-08-26 14:48:43 +00:00
🐛 Fix exclude boolean rendering in render WASM
This commit is contained in:
parent
5dff551f31
commit
babe0d3c34
@ -705,16 +705,21 @@ impl Shape {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_path_segments(&mut self, segments: Vec<Segment>) {
|
pub fn set_path_segments(&mut self, segments: Vec<Segment>) {
|
||||||
let path = Path::new(segments);
|
|
||||||
match &mut self.shape_type {
|
match &mut self.shape_type {
|
||||||
Type::Bool(Bool { bool_type, .. }) => {
|
Type::Bool(Bool { bool_type, .. }) => {
|
||||||
|
let path = match bool_type {
|
||||||
|
// Exclusion booleans are computed with even-odd semantics but
|
||||||
|
// PathData uploads do not carry the fill rule.
|
||||||
|
BoolType::Exclusion => Path::new(segments).with_even_odd(true),
|
||||||
|
_ => Path::new(segments),
|
||||||
|
};
|
||||||
self.shape_type = Type::Bool(Bool {
|
self.shape_type = Type::Bool(Bool {
|
||||||
bool_type: *bool_type,
|
bool_type: *bool_type,
|
||||||
path,
|
path,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Type::Path(_) => {
|
Type::Path(_) => {
|
||||||
self.shape_type = Type::Path(path);
|
self.shape_type = Type::Path(Path::new(segments));
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
};
|
};
|
||||||
|
|||||||
@ -262,6 +262,9 @@ impl Path {
|
|||||||
|
|
||||||
pub fn to_skia_path(&self, svg_attrs: Option<&SvgAttrs>) -> skia::Path {
|
pub fn to_skia_path(&self, svg_attrs: Option<&SvgAttrs>) -> skia::Path {
|
||||||
let mut path = self.skia_path.snapshot();
|
let mut path = self.skia_path.snapshot();
|
||||||
|
if self.is_even_odd() {
|
||||||
|
path.set_fill_type(skia::PathFillType::EvenOdd);
|
||||||
|
}
|
||||||
if let Some(attrs) = svg_attrs {
|
if let Some(attrs) = svg_attrs {
|
||||||
if attrs.fill_rule == FillRule::Evenodd {
|
if attrs.fill_rule == FillRule::Evenodd {
|
||||||
path.set_fill_type(skia::PathFillType::EvenOdd);
|
path.set_fill_type(skia::PathFillType::EvenOdd);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user