[librsvg: 27/31] Shape now has its visibility




commit afe49489418f8941b3acc548d872ebfc4b9a07f2
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Jun 2 20:23:38 2021 -0500

    Shape now has its visibility

 src/drawing_ctx.rs | 4 ++--
 src/shapes.rs      | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index 6edf90ed..0f53f7ea 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -1221,7 +1221,7 @@ impl DrawingCtx {
                     PathHelper::new(&cr, transform, &shape.path, shape.stroke.line_cap);
 
                 if clipping {
-                    if values.is_visible() {
+                    if shape.is_visible {
                         cr.set_fill_rule(cairo::FillRule::from(shape.clip_rule));
                         path_helper.set()?;
                     }
@@ -1240,7 +1240,7 @@ impl DrawingCtx {
                 let stroke_paint = shape.stroke_paint.to_user_space(&bbox, view_params, values);
                 let fill_paint = shape.fill_paint.to_user_space(&bbox, view_params, values);
 
-                if values.is_visible() {
+                if shape.is_visible {
                     for &target in &shape.paint_order.targets {
                         // fill and stroke operations will preserve the path.
                         // markers operation will clear the path.
diff --git a/src/shapes.rs b/src/shapes.rs
index 336cf9d7..54e2558a 100644
--- a/src/shapes.rs
+++ b/src/shapes.rs
@@ -35,6 +35,7 @@ struct ShapeDef {
 pub struct Shape {
     pub path: Rc<SvgPath>,
     pub markers: Markers,
+    pub is_visible: bool,
     pub paint_order: PaintOrder,
     pub stroke: Stroke,
     pub stroke_paint: PaintSource,
@@ -70,6 +71,7 @@ macro_rules! impl_draw {
                 let params = NormalizeParams::new(values, &view_params);
                 let shape_def = self.make_shape(&params);
 
+                let is_visible = values.is_visible();
                 let paint_order = values.paint_order();
 
                 let stroke = Stroke::new(values, &params);
@@ -93,6 +95,7 @@ macro_rules! impl_draw {
                 let shape = Shape {
                     path: shape_def.path,
                     markers: shape_def.markers,
+                    is_visible,
                     paint_order,
                     stroke,
                     stroke_paint,


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