[librsvg: 25/31] Shape now has its FillRule and ClipRule




commit 680e0f9e595e99b9c8a0a077b336302483f7e440
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Jun 2 20:13:16 2021 -0500

    Shape now has its FillRule and ClipRule

 src/drawing_ctx.rs | 4 ++--
 src/shapes.rs      | 8 +++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index 35ee0900..a81c62f3 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -1222,7 +1222,7 @@ impl DrawingCtx {
 
                 if clipping {
                     if values.is_visible() {
-                        cr.set_fill_rule(cairo::FillRule::from(values.clip_rule()));
+                        cr.set_fill_rule(cairo::FillRule::from(shape.clip_rule));
                         path_helper.set()?;
                     }
                     return Ok(dc.empty_bbox());
@@ -1232,7 +1232,7 @@ impl DrawingCtx {
 
                 setup_cr_for_stroke(&cr, &shape.stroke);
 
-                cr.set_fill_rule(cairo::FillRule::from(values.fill_rule()));
+                cr.set_fill_rule(cairo::FillRule::from(shape.fill_rule));
 
                 path_helper.set()?;
                 let bbox = compute_stroke_and_fill_box(&cr, &shape.stroke, &shape.stroke_paint);
diff --git a/src/shapes.rs b/src/shapes.rs
index a19b07c3..23e4ec7d 100644
--- a/src/shapes.rs
+++ b/src/shapes.rs
@@ -18,7 +18,7 @@ use crate::paint_server::PaintSource;
 use crate::parsers::{optional_comma, Parse, ParseValue};
 use crate::path_builder::{LargeArc, Path as SvgPath, PathBuilder, Sweep};
 use crate::path_parser;
-use crate::property_defs::ShapeRendering;
+use crate::property_defs::{ClipRule, FillRule, ShapeRendering};
 use crate::xml::Attributes;
 
 #[derive(Copy, Clone, PartialEq)]
@@ -38,6 +38,8 @@ pub struct Shape {
     pub stroke: Stroke,
     pub stroke_paint: PaintSource,
     pub fill_paint: PaintSource,
+    pub fill_rule: FillRule,
+    pub clip_rule: ClipRule,
     pub shape_rendering: ShapeRendering,
 }
 
@@ -81,6 +83,8 @@ macro_rules! impl_draw {
                     values.color().0,
                 );
 
+                let fill_rule = values.fill_rule();
+                let clip_rule = values.clip_rule();
                 let shape_rendering = values.shape_rendering();
 
                 let shape = Shape {
@@ -89,6 +93,8 @@ macro_rules! impl_draw {
                     stroke,
                     stroke_paint,
                     fill_paint,
+                    fill_rule,
+                    clip_rule,
                     shape_rendering,
                 };
                 draw_ctx.draw_shape(&view_params, &shape, node, acquired_nodes, values, clipping)


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