Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ cargo-gpu-install = { version = "0.10.0-alpha.1", default-features = false }
qrcodegen = "1.8"
lzma-rust2 = { version = "0.16", default-features = false, features = ["std", "encoder", "optimization", "xz"] }
scraper = "0.25"
linesweeper = "0.3"
linesweeper = "0.4"
smallvec = "1.13.2"
zip = { version = "8", default-features = false }

Expand Down
16 changes: 12 additions & 4 deletions node-graph/nodes/path-bool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ impl linesweeper::topology::WindingNumber for WindingNumber {
elems[tag] = if positive { 1 } else { -1 };
Self { elems }
}

fn of_tag(&self, (tag, out_of): Self::Tag) -> Self {
let mut elems = SmallVec::with_capacity(out_of);
elems.resize(out_of, 0);
if let (Some(slot), Some(&value)) = (elems.get_mut(tag), self.elems.get(tag)) {
*slot = value;
} else {
log::warn!("WindingNumber::of_tag: tag {tag} out of bounds (out_of {out_of}, len {})", self.elems.len());
}
Self { elems }
}
Comment thread
Keavon marked this conversation as resolved.
}

impl std::ops::AddAssign for WindingNumber {
Expand Down Expand Up @@ -162,11 +173,8 @@ fn boolean_operation_on_vector_list(vector: &List<Vector>, boolean_operation: Bo
}
};
let contours = top.contours(|winding| winding.is_inside(boolean_operation));

// TODO: Linesweeper emits contours in the opposite winding direction from the rest of Kurbo's and Graphite's vector graphics system (clockwise in screen coordinates).
// TODO: Report this upstream to Linesweeper and remove this `.reverse()` workaround once fixed.
for subpath in from_bez_paths(contours.contours().map(|c| &c.path)) {
row.element_mut().append_subpath(subpath.reverse(), false);
row.element_mut().append_subpath(subpath, false);
}

list.push(row);
Expand Down
Loading