diff options
author | Federico Mena Quintero <federico@gnome.org> | 2023-02-09 13:16:12 -0600 |
---|---|---|
committer | Federico Mena Quintero <federico@gnome.org> | 2023-02-09 13:16:12 -0600 |
commit | a105d4150d5853ae2da6fd870d446d3e656e012d (patch) | |
tree | 0509b1e5d4d62a90a4f5b86ffa1f030217e1f8fc | |
parent | c5025d955b364b46a8062764e9057123d6fe8a58 (diff) | |
download | librsvg-a105d4150d5853ae2da6fd870d446d3e656e012d.tar.gz |
DropShadow::to_filter_spec - first collect the ResolvedPrimitive, then turn them into user space
This will let us extract a function to generate the primitives in the
first place.
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/793>
-rw-r--r-- | src/filter_func.rs | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/filter_func.rs b/src/filter_func.rs index 3639503e..089740ef 100644 --- a/src/filter_func.rs +++ b/src/filter_func.rs @@ -388,8 +388,7 @@ impl DropShadow { std_deviation: NumberOptionalNumber(std_dev, std_dev), ..GaussianBlur::default() }), - } - .into_user_space(params); + }; let offset = ResolvedPrimitive { primitive: Primitive { @@ -401,14 +400,12 @@ impl DropShadow { dx, dy, }), - } - .into_user_space(params); + }; let flood = ResolvedPrimitive { primitive: Primitive::default(), params: PrimitiveParams::Flood(Flood { color }), - } - .into_user_space(params); + }; let composite = ResolvedPrimitive { primitive: Primitive::default(), @@ -417,8 +414,7 @@ impl DropShadow { operator: Operator::In, ..Composite::default() }), - } - .into_user_space(params); + }; let merge = ResolvedPrimitive { primitive: Primitive::default(), @@ -431,12 +427,17 @@ impl DropShadow { }, ], }), - } - .into_user_space(params); + }; + + let resolved_primitives = vec![gaussian_blur, offset, flood, composite, merge]; + let primitives = resolved_primitives + .into_iter() + .map(|p| p.into_user_space(params)) + .collect(); FilterSpec { user_space_filter, - primitives: vec![gaussian_blur, offset, flood, composite, merge], + primitives, } } } |