diff options
author | Federico Mena Quintero <federico@gnome.org> | 2022-10-05 19:44:56 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2022-10-06 19:14:26 -0500 |
commit | 41390ea38cdf5bff3634c4bbf49f78a5cd3f79e5 (patch) | |
tree | 736314065763327659a0af5aafb41a5cf6343f82 | |
parent | 519fb8599483c676fd53edadd1bc37630f694a02 (diff) | |
download | librsvg-41390ea38cdf5bff3634c4bbf49f78a5cd3f79e5.tar.gz |
Shape: add a field with the path's extents
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/757>
-rw-r--r-- | src/layout.rs | 1 | ||||
-rw-r--r-- | src/shapes.rs | 3 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/layout.rs b/src/layout.rs index be858196..465b202d 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -74,6 +74,7 @@ pub struct Stroke { /// involves knowing the bounding box of the path. pub struct Shape { pub path: Rc<Path>, + pub extents: Option<Rect>, pub is_visible: bool, pub paint_order: PaintOrder, pub stroke: Stroke, diff --git a/src/shapes.rs b/src/shapes.rs index b21e6339..2d26bbde 100644 --- a/src/shapes.rs +++ b/src/shapes.rs @@ -116,8 +116,11 @@ fn draw_basic_shape( context_fill: fill_paint.clone(), }; + let extents = draw_ctx.compute_path_extents(&shape_def.path)?; + let shape = Shape { path: shape_def.path, + extents, is_visible, paint_order, stroke, |