[librsvg: 4/12] Line: extract a make_path_builder function



commit 85e5a72c93619e25e3ba1765cd019df91e1ceaf4
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Dec 10 10:11:12 2019 -0600

    Line: extract a make_path_builder function

 rsvg_internals/src/shapes.rs | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/rsvg_internals/src/shapes.rs b/rsvg_internals/src/shapes.rs
index 77090639..a5c702f9 100644
--- a/rsvg_internals/src/shapes.rs
+++ b/rsvg_internals/src/shapes.rs
@@ -309,7 +309,17 @@ impl NodeTrait for Line {
         clipping: bool,
     ) -> Result<BoundingBox, RenderingError> {
         let values = cascaded.get();
+        let builder = self.make_path_builder(values, draw_ctx);
+        render_path_builder(&builder, draw_ctx, node, values, true, clipping)
+    }
+}
 
+impl Line {
+    fn make_path_builder(
+        &self,
+        values: &ComputedValues,
+        draw_ctx: &mut DrawingCtx,
+    ) -> PathBuilder {
         let mut builder = PathBuilder::new();
 
         let params = draw_ctx.get_view_params();
@@ -322,7 +332,7 @@ impl NodeTrait for Line {
         builder.move_to(x1, y1);
         builder.line_to(x2, y2);
 
-        render_path_builder(&builder, draw_ctx, node, values, true, clipping)
+        builder
     }
 }
 


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