Skip to content

Commit f7ff183

Browse files
committed
Merge branch 'main' into update
# Conflicts: # Cargo.lock
2 parents f41eaa9 + 848ed58 commit f7ff183

File tree

6 files changed

+60
-54
lines changed

6 files changed

+60
-54
lines changed

Cargo.lock

+36-36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/usvg/codegen/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ path = "main.rs"
1212
[dependencies]
1313
phf = "0.7.22"
1414
phf_codegen = "0.7.22"
15-
itertools = "0.7"
15+
itertools = "0.14"

crates/usvg/src/parser/converter.rs

+7-17
Original file line numberDiff line numberDiff line change
@@ -931,29 +931,19 @@ fn convert_path(
931931
None => return,
932932
};
933933

934-
match raw_paint_order.order {
935-
[PaintOrderKind::Markers, _, _] => {
936-
if let Some(markers_node) = marker {
937-
parent.children.push(Node::Group(Box::new(markers_node)));
938-
}
939-
934+
match (raw_paint_order.order, marker) {
935+
([PaintOrderKind::Markers, _, _], Some(markers_node)) => {
936+
parent.children.push(Node::Group(Box::new(markers_node)));
940937
parent.children.push(Node::Path(Box::new(path.clone())));
941938
}
942-
[first, PaintOrderKind::Markers, last] => {
939+
([first, PaintOrderKind::Markers, last], Some(markers_node)) => {
943940
append_single_paint_path(first, &path, parent);
944-
945-
if let Some(markers_node) = marker {
946-
parent.children.push(Node::Group(Box::new(markers_node)));
947-
}
948-
941+
parent.children.push(Node::Group(Box::new(markers_node)));
949942
append_single_paint_path(last, &path, parent);
950943
}
951-
[_, _, PaintOrderKind::Markers] => {
944+
([_, _, PaintOrderKind::Markers], Some(markers_node)) => {
952945
parent.children.push(Node::Path(Box::new(path.clone())));
953-
954-
if let Some(markers_node) = marker {
955-
parent.children.push(Node::Group(Box::new(markers_node)));
956-
}
946+
parent.children.push(Node::Group(Box::new(markers_node)));
957947
}
958948
_ => parent.children.push(Node::Path(Box::new(path.clone()))),
959949
}
Loading
Loading

crates/usvg/tests/write.rs

+5
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,8 @@ fn preserve_text_with_complex_text_decoration() {
203203
fn preserve_text_with_nested_baseline_shift() {
204204
resave_with_text("preserve-text-with-nested-baseline-shift");
205205
}
206+
207+
#[test]
208+
fn optimize_paths_without_markers() {
209+
resave("optimize-paths-without-markers");
210+
}

0 commit comments

Comments
 (0)