[librsvg: 3/15] Remove the `parent` argument from Primitive::get_bounds
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 3/15] Remove the `parent` argument from Primitive::get_bounds
- Date: Tue, 9 Mar 2021 20:51:37 +0000 (UTC)
commit 97412729ab74ebc47f0f22fe1d4e417b91163e91
Author: John Ledbetter <john ledbetter gmail com>
Date: Mon Mar 8 13:38:22 2021 -0600
Remove the `parent` argument from Primitive::get_bounds
Now, the `node` argument is unused in most of the render()
implementations, except for the ones that look at the children of a
filter primitive element, like the lighting and merge ones.
src/filters/blend.rs | 2 +-
src/filters/color_matrix.rs | 2 +-
src/filters/component_transfer.rs | 2 +-
src/filters/composite.rs | 2 +-
src/filters/convolve_matrix.rs | 2 +-
src/filters/displacement_map.rs | 2 +-
src/filters/flood.rs | 5 +----
src/filters/gaussian_blur.rs | 2 +-
src/filters/image.rs | 2 +-
src/filters/lighting.rs | 2 +-
src/filters/merge.rs | 2 +-
src/filters/mod.rs | 8 ++------
src/filters/morphology.rs | 2 +-
src/filters/offset.rs | 2 +-
src/filters/tile.rs | 5 +----
src/filters/turbulence.rs | 5 +----
16 files changed, 17 insertions(+), 30 deletions(-)
---
diff --git a/src/filters/blend.rs b/src/filters/blend.rs
index 7eac4b59..6889f5b4 100755
--- a/src/filters/blend.rs
+++ b/src/filters/blend.rs
@@ -82,7 +82,7 @@ impl FilterRender for FeBlend {
let input_2 = ctx.get_input(acquired_nodes, draw_ctx, self.in2.as_ref())?;
let bounds = self
.base
- .get_bounds(ctx, node.parent().as_ref())?
+ .get_bounds(ctx)?
.add_input(&input)
.add_input(&input_2)
.into_irect(ctx, draw_ctx);
diff --git a/src/filters/color_matrix.rs b/src/filters/color_matrix.rs
index b6a0a843..2a54063e 100644
--- a/src/filters/color_matrix.rs
+++ b/src/filters/color_matrix.rs
@@ -148,7 +148,7 @@ impl FilterRender for FeColorMatrix {
let input = self.base.get_input(ctx, acquired_nodes, draw_ctx)?;
let bounds = self
.base
- .get_bounds(ctx, node.parent().as_ref())?
+ .get_bounds(ctx)?
.add_input(&input)
.into_irect(ctx, draw_ctx);
diff --git a/src/filters/component_transfer.rs b/src/filters/component_transfer.rs
index a0a7186f..0d89a262 100644
--- a/src/filters/component_transfer.rs
+++ b/src/filters/component_transfer.rs
@@ -287,7 +287,7 @@ impl FilterRender for FeComponentTransfer {
let input = self.base.get_input(ctx, acquired_nodes, draw_ctx)?;
let bounds = self
.base
- .get_bounds(ctx, node.parent().as_ref())?
+ .get_bounds(ctx)?
.add_input(&input)
.into_irect(ctx, draw_ctx);
diff --git a/src/filters/composite.rs b/src/filters/composite.rs
index 5e001960..f7195d45 100644
--- a/src/filters/composite.rs
+++ b/src/filters/composite.rs
@@ -82,7 +82,7 @@ impl FilterRender for FeComposite {
let input_2 = ctx.get_input(acquired_nodes, draw_ctx, self.in2.as_ref())?;
let bounds = self
.base
- .get_bounds(ctx, node.parent().as_ref())?
+ .get_bounds(ctx)?
.add_input(&input)
.add_input(&input_2)
.into_irect(ctx, draw_ctx);
diff --git a/src/filters/convolve_matrix.rs b/src/filters/convolve_matrix.rs
index 329254e7..e3e407a4 100644
--- a/src/filters/convolve_matrix.rs
+++ b/src/filters/convolve_matrix.rs
@@ -132,7 +132,7 @@ impl FilterRender for FeConvolveMatrix {
let input = self.base.get_input(ctx, acquired_nodes, draw_ctx)?;
let mut bounds = self
.base
- .get_bounds(ctx, node.parent().as_ref())?
+ .get_bounds(ctx)?
.add_input(&input)
.into_irect(ctx, draw_ctx);
let original_bounds = bounds;
diff --git a/src/filters/displacement_map.rs b/src/filters/displacement_map.rs
index 95c8b884..95829da6 100644
--- a/src/filters/displacement_map.rs
+++ b/src/filters/displacement_map.rs
@@ -79,7 +79,7 @@ impl FilterRender for FeDisplacementMap {
let displacement_input = ctx.get_input(acquired_nodes, draw_ctx, self.in2.as_ref())?;
let bounds = self
.base
- .get_bounds(ctx, node.parent().as_ref())?
+ .get_bounds(ctx)?
.add_input(&input)
.add_input(&displacement_input)
.into_irect(ctx, draw_ctx);
diff --git a/src/filters/flood.rs b/src/filters/flood.rs
index 1cbd1e77..d91092f0 100644
--- a/src/filters/flood.rs
+++ b/src/filters/flood.rs
@@ -36,10 +36,7 @@ impl FilterRender for FeFlood {
_acquired_nodes: &mut AcquiredNodes<'_>,
draw_ctx: &mut DrawingCtx,
) -> Result<FilterResult, FilterError> {
- let bounds = self
- .base
- .get_bounds(ctx, node.parent().as_ref())?
- .into_irect(ctx, draw_ctx);
+ let bounds = self.base.get_bounds(ctx)?.into_irect(ctx, draw_ctx);
let cascaded = CascadedValues::new_from_node(node);
let values = cascaded.get();
diff --git a/src/filters/gaussian_blur.rs b/src/filters/gaussian_blur.rs
index cdbee9e8..7d4d905a 100644
--- a/src/filters/gaussian_blur.rs
+++ b/src/filters/gaussian_blur.rs
@@ -196,7 +196,7 @@ impl FilterRender for FeGaussianBlur {
let input = self.base.get_input(ctx, acquired_nodes, draw_ctx)?;
let bounds = self
.base
- .get_bounds(ctx, node.parent().as_ref())?
+ .get_bounds(ctx)?
.add_input(&input)
.into_irect(ctx, draw_ctx);
diff --git a/src/filters/image.rs b/src/filters/image.rs
index cce27e4c..a7fabc31 100644
--- a/src/filters/image.rs
+++ b/src/filters/image.rs
@@ -126,7 +126,7 @@ impl FilterRender for FeImage {
acquired_nodes: &mut AcquiredNodes<'_>,
draw_ctx: &mut DrawingCtx,
) -> Result<FilterResult, FilterError> {
- let bounds_builder = self.base.get_bounds(ctx, node.parent().as_ref())?;
+ let bounds_builder = self.base.get_bounds(ctx)?;
let (bounds, unclipped_bounds) = bounds_builder.into_rect(ctx, draw_ctx);
let href = self.href.as_ref().ok_or(FilterError::InvalidInput)?;
diff --git a/src/filters/lighting.rs b/src/filters/lighting.rs
index 48708d70..36466d85 100644
--- a/src/filters/lighting.rs
+++ b/src/filters/lighting.rs
@@ -434,7 +434,7 @@ macro_rules! impl_lighting_filter {
let input = self.base.get_input(ctx, acquired_nodes, draw_ctx)?;
let mut bounds = self
.base
- .get_bounds(ctx, node.parent().as_ref())?
+ .get_bounds(ctx)?
.add_input(&input)
.into_irect(ctx, draw_ctx);
let original_bounds = bounds;
diff --git a/src/filters/merge.rs b/src/filters/merge.rs
index 29e8ec3a..296055d0 100644
--- a/src/filters/merge.rs
+++ b/src/filters/merge.rs
@@ -84,7 +84,7 @@ impl FilterRender for FeMerge {
draw_ctx: &mut DrawingCtx,
) -> Result<FilterResult, FilterError> {
// Compute the filter bounds, taking each child node's input into account.
- let mut bounds = self.base.get_bounds(ctx, node.parent().as_ref())?;
+ let mut bounds = self.base.get_bounds(ctx)?;
for child in node.children().filter(|c| c.is_element()) {
let elt = child.borrow_element();
diff --git a/src/filters/mod.rs b/src/filters/mod.rs
index 0419197d..a2d4a762 100644
--- a/src/filters/mod.rs
+++ b/src/filters/mod.rs
@@ -9,7 +9,7 @@ use crate::bbox::BoundingBox;
use crate::coord_units::CoordUnits;
use crate::document::AcquiredNodes;
use crate::drawing_ctx::DrawingCtx;
-use crate::element::{Draw, Element, ElementResult, SetAttributes};
+use crate::element::{Draw, ElementResult, SetAttributes};
use crate::error::{ParseError, RenderingError};
use crate::length::*;
use crate::node::{CascadedValues, Node, NodeBorrow};
@@ -136,11 +136,7 @@ impl Primitive {
/// Validates attributes and returns the `BoundsBuilder` for bounds computation.
#[inline]
- fn get_bounds<'a>(
- &self,
- ctx: &'a FilterContext,
- parent: Option<&Node>,
- ) -> Result<BoundsBuilder, FilterError> {
+ fn get_bounds<'a>(&self, ctx: &'a FilterContext) -> Result<BoundsBuilder, FilterError> {
// With ObjectBoundingBox, only fractions and percents are allowed.
if ctx.primitive_units() == CoordUnits::ObjectBoundingBox {
check_units(self.x)?;
diff --git a/src/filters/morphology.rs b/src/filters/morphology.rs
index f60611d9..96989435 100644
--- a/src/filters/morphology.rs
+++ b/src/filters/morphology.rs
@@ -75,7 +75,7 @@ impl FilterRender for FeMorphology {
let input = self.base.get_input(ctx, acquired_nodes, draw_ctx)?;
let bounds = self
.base
- .get_bounds(ctx, node.parent().as_ref())?
+ .get_bounds(ctx)?
.add_input(&input)
.into_irect(ctx, draw_ctx);
diff --git a/src/filters/offset.rs b/src/filters/offset.rs
index 4fdc6c85..23a91a55 100644
--- a/src/filters/offset.rs
+++ b/src/filters/offset.rs
@@ -56,7 +56,7 @@ impl FilterRender for FeOffset {
let input = self.base.get_input(ctx, acquired_nodes, draw_ctx)?;
let bounds = self
.base
- .get_bounds(ctx, node.parent().as_ref())?
+ .get_bounds(ctx)?
.add_input(&input)
.into_irect(ctx, draw_ctx);
diff --git a/src/filters/tile.rs b/src/filters/tile.rs
index 98ac37e1..855a94ef 100644
--- a/src/filters/tile.rs
+++ b/src/filters/tile.rs
@@ -39,10 +39,7 @@ impl FilterRender for FeTile {
let input = self.base.get_input(ctx, acquired_nodes, draw_ctx)?;
// feTile doesn't consider its inputs in the filter primitive subregion calculation.
- let bounds = self
- .base
- .get_bounds(ctx, node.parent().as_ref())?
- .into_irect(ctx, draw_ctx);
+ let bounds = self.base.get_bounds(ctx)?.into_irect(ctx, draw_ctx);
let surface = match input {
FilterInput::StandardInput(input_surface) => input_surface,
diff --git a/src/filters/turbulence.rs b/src/filters/turbulence.rs
index 99567cb9..3d7cb888 100644
--- a/src/filters/turbulence.rs
+++ b/src/filters/turbulence.rs
@@ -331,10 +331,7 @@ impl FilterRender for FeTurbulence {
_acquired_nodes: &mut AcquiredNodes<'_>,
draw_ctx: &mut DrawingCtx,
) -> Result<FilterResult, FilterError> {
- let bounds = self
- .base
- .get_bounds(ctx, node.parent().as_ref())?
- .into_irect(ctx, draw_ctx);
+ let bounds = self.base.get_bounds(ctx)?.into_irect(ctx, draw_ctx);
let affine = ctx.paffine().invert().unwrap();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]