Skip to content

Commit

Permalink
Simple refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
RazrFalcon committed Dec 3, 2023
1 parent 6beee13 commit 9818899
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions crates/resvg/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ pub fn convert(

let mut bboxes = BBoxes::default();

if let Some((_, l_bbox, o_bbox)) = fill_path {
bboxes.layer = bboxes.layer.expand(l_bbox);
if let Some((_, o_bbox)) = fill_path {
bboxes.layer = bboxes.layer.expand(o_bbox);
bboxes.object = bboxes.object.expand(o_bbox);
}
if let Some((_, l_bbox, o_bbox)) = stroke_path {
Expand All @@ -60,7 +60,7 @@ pub fn convert(
}

if upath.paint_order == usvg::PaintOrder::FillAndStroke {
if let Some((path, _, _)) = fill_path {
if let Some((path, _)) = fill_path {
children.push(Node::FillPath(path));
}

Expand All @@ -72,7 +72,7 @@ pub fn convert(
children.push(Node::StrokePath(path));
}

if let Some((path, _, _)) = fill_path {
if let Some((path, _)) = fill_path {
children.push(Node::FillPath(path));
}
}
Expand All @@ -85,7 +85,7 @@ fn convert_fill_path(
path: Rc<tiny_skia::Path>,
text_bbox: Option<tiny_skia::NonZeroRect>,
anti_alias: bool,
) -> Option<(FillPath, usvg::BBox, usvg::BBox)> {
) -> Option<(FillPath, usvg::BBox)> {
// Horizontal and vertical lines cannot be filled. Skip.
if path.bounds().width() == 0.0 || path.bounds().height() == 0.0 {
return None;
Expand All @@ -111,7 +111,7 @@ fn convert_fill_path(
path,
};

Some((path, object_bbox, object_bbox))
Some((path, object_bbox))
}

fn convert_stroke_path(
Expand Down
2 changes: 1 addition & 1 deletion crates/resvg/src/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct Group {
pub mask: Option<Mask>,
pub filters: Vec<crate::filter::Filter>,
pub isolate: bool,
/// Group's layer bounding box in canvas coordinates.
/// Group's layer bounding box in object coordinates.
pub bbox: tiny_skia::Rect,

pub children: Vec<Node>,
Expand Down

0 comments on commit 9818899

Please sign in to comment.