[librsvg: 2/15] Use the primitive_units from the FilterContext; no need to get them from a parent node
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 2/15] Use the primitive_units from the FilterContext; no need to get them from a parent node
- Date: Tue, 9 Mar 2021 20:51:37 +0000 (UTC)
commit 5bf020ea801cc5c9fd39b8f8042481a20b53b681
Author: John Ledbetter <john ledbetter gmail com>
Date: Mon Mar 8 13:32:16 2021 -0600
Use the primitive_units from the FilterContext; no need to get them from a parent node
The primitiveUnits from the <filter> node have already been copied to
the FilterContext when it was built. We don't need
Primitive.get_bounds() to go looking up the tree of elements.
src/filters/mod.rs | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
---
diff --git a/src/filters/mod.rs b/src/filters/mod.rs
index 7f3d9017..0419197d 100644
--- a/src/filters/mod.rs
+++ b/src/filters/mod.rs
@@ -141,18 +141,8 @@ impl Primitive {
ctx: &'a FilterContext,
parent: Option<&Node>,
) -> Result<BoundsBuilder, FilterError> {
- let primitive_units = parent
- .and_then(|parent| {
- assert!(parent.is_element());
- match *parent.borrow_element() {
- Element::Filter(ref f) => Some(f.get_primitive_units()),
- _ => None,
- }
- })
- .unwrap_or(CoordUnits::UserSpaceOnUse);
-
// With ObjectBoundingBox, only fractions and percents are allowed.
- if primitive_units == CoordUnits::ObjectBoundingBox {
+ if ctx.primitive_units() == CoordUnits::ObjectBoundingBox {
check_units(self.x)?;
check_units(self.y)?;
check_units(self.width)?;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]