[librsvg: 2/9] Shape: add a field with the path's extents




commit 41390ea38cdf5bff3634c4bbf49f78a5cd3f79e5
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Oct 5 19:44:56 2022 -0500

    Shape: add a field with the path's extents
    
    Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/757>

 src/layout.rs | 1 +
 src/shapes.rs | 3 +++
 2 files changed, 4 insertions(+)
---
diff --git a/src/layout.rs b/src/layout.rs
index be858196a..465b202d8 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 b21e63394..2d26bbdec 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,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]