[librsvg: 5/15] FilterContext: remove get_computed_values_from_node_being_filtered()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 5/15] FilterContext: remove get_computed_values_from_node_being_filtered()
- Date: Thu, 8 Apr 2021 22:52:27 +0000 (UTC)
commit f4d3b27073836691993aef34863daefcca925f01
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Apr 7 19:11:46 2021 -0500
FilterContext: remove get_computed_values_from_node_being_filtered()
This is only used when resolving a filter primitive, so we can use the
original value in the caller.
src/filters/context.rs | 10 ----------
src/filters/mod.rs | 8 ++++++--
2 files changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/src/filters/context.rs b/src/filters/context.rs
index 398e0565..adc97732 100644
--- a/src/filters/context.rs
+++ b/src/filters/context.rs
@@ -48,9 +48,6 @@ pub enum FilterInput {
/// The filter rendering context.
pub struct FilterContext {
- /// Values from the node which referenced this filter.
- computed_from_node_being_filtered: ComputedValues,
-
/// Paint source for primitives which have an input value equal to `StrokePaint`.
stroke_paint: UserSpacePaintSource,
/// Paint source for primitives which have an input value equal to `FillPaint`.
@@ -173,7 +170,6 @@ impl FilterContext {
};
Ok(Self {
- computed_from_node_being_filtered: computed_from_node_being_filtered.clone(),
stroke_paint,
fill_paint,
source_surface: source_surface.clone(),
@@ -189,12 +185,6 @@ impl FilterContext {
})
}
- /// Returns the computed values from the node that referenced this filter.
- #[inline]
- pub fn get_computed_values_from_node_being_filtered(&self) -> &ComputedValues {
- &self.computed_from_node_being_filtered
- }
-
/// Returns the surface corresponding to the source graphic.
#[inline]
pub fn source_graphic(&self) -> &SharedImageSurface {
diff --git a/src/filters/mod.rs b/src/filters/mod.rs
index 66729353..d278421c 100644
--- a/src/filters/mod.rs
+++ b/src/filters/mod.rs
@@ -135,6 +135,7 @@ impl Primitive {
fn resolve(
&self,
ctx: &FilterContext,
+ values: &ComputedValues,
draw_ctx: &DrawingCtx,
) -> Result<ResolvedPrimitive, FilterError> {
// With ObjectBoundingBox, only fractions and percents are allowed.
@@ -146,7 +147,6 @@ impl Primitive {
}
let params = draw_ctx.push_coord_units(ctx.primitive_units());
- let values = ctx.get_computed_values_from_node_being_filtered();
let x = self.x.map(|l| l.normalize(values, ¶ms));
let y = self.y.map(|l| l.normalize(values, ¶ms));
@@ -294,7 +294,11 @@ pub fn render(
if let Err(err) = filter
.resolve(&c)
.and_then(|(primitive, params)| {
- let resolved_primitive = primitive.resolve(&filter_ctx, draw_ctx)?;
+ let resolved_primitive = primitive.resolve(
+ &filter_ctx,
+ computed_from_node_being_filtered,
+ draw_ctx,
+ )?;
Ok((resolved_primitive, params))
})
.and_then(|(resolved_primitive, params)| {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]