[librsvg: 2/8] draw_text: make the stroke code path similar to the fill code path




commit d51a04fde47118c89bb183bb6bd56beb6bd53c64
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Jun 1 18:29:56 2021 -0500

    draw_text: make the stroke code path similar to the fill code path

 src/drawing_ctx.rs | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index a91ec8c6..cd76076f 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -1366,6 +1366,8 @@ impl DrawingCtx {
             return Ok(saved_cr.draw_ctx.empty_bbox());
         }
 
+        // Fill
+
         let paint_source = values
             .fill()
             .0
@@ -1384,7 +1386,7 @@ impl DrawingCtx {
                 };
             })?;
 
-        let mut need_layout_path = false;
+        // Stroke
 
         let paint_source = values
             .stroke()
@@ -1397,25 +1399,21 @@ impl DrawingCtx {
             .set_paint_source(&paint_source, acquired_nodes)
             .map(|had_paint_server| {
                 if had_paint_server {
-                    need_layout_path = true;
+                    pangocairo::functions::update_layout(&cr, &layout);
+                    pangocairo::functions::layout_path(&cr, &layout);
+
+                    let (x0, y0, x1, y1) = cr.stroke_extents();
+                    let r = Rect::new(x0, y0, x1, y1);
+                    let ib = BoundingBox::new()
+                        .with_transform(transform)
+                        .with_ink_rect(r);
+                    bbox.insert(&ib);
+                    if values.is_visible() {
+                        cr.stroke();
+                    }
                 }
             })?;
 
-        if need_layout_path {
-            pangocairo::functions::update_layout(&cr, &layout);
-            pangocairo::functions::layout_path(&cr, &layout);
-
-            let (x0, y0, x1, y1) = cr.stroke_extents();
-            let r = Rect::new(x0, y0, x1, y1);
-            let ib = BoundingBox::new()
-                .with_transform(transform)
-                .with_ink_rect(r);
-            bbox.insert(&ib);
-            if values.is_visible() {
-                cr.stroke();
-            }
-        }
-
         Ok(bbox)
     }
 


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