[librsvg: 5/31] Pass the resolved currentColor down to to_filter_spec()
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 5/31] Pass the resolved currentColor down to to_filter_spec()
- Date: Thu, 3 Jun 2021 02:27:10 +0000 (UTC)
commit 91ac0fe3716dbc484ee0dcdf43de8a6b11bc705f
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Jun 2 15:34:09 2021 -0500
Pass the resolved currentColor down to to_filter_spec()
src/drawing_ctx.rs | 8 +++++++-
src/filter.rs | 5 +++--
src/filter_func.rs | 3 ++-
3 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/drawing_ctx.rs b/src/drawing_ctx.rs
index adffb4b3..169cb650 100644
--- a/src/drawing_ctx.rs
+++ b/src/drawing_ctx.rs
@@ -877,7 +877,13 @@ impl DrawingCtx {
if let Ok(specs) = filter_list
.iter()
.map(|filter_value| {
- filter_value.to_filter_spec(acquired_nodes, values, self, node_name)
+ filter_value.to_filter_spec(
+ acquired_nodes,
+ values,
+ values.color().0,
+ self,
+ node_name,
+ )
})
.collect::<Result<Vec<FilterSpec>, _>>()
{
diff --git a/src/filter.rs b/src/filter.rs
index 72a10624..960649de 100644
--- a/src/filter.rs
+++ b/src/filter.rs
@@ -1,6 +1,6 @@
//! The `filter` element.
-use cssparser::Parser;
+use cssparser::{Parser, RGBA};
use markup5ever::{expanded_name, local_name, namespace_url, ns};
use std::slice::Iter;
@@ -114,6 +114,7 @@ impl FilterValue {
&self,
acquired_nodes: &mut AcquiredNodes<'_>,
values: &ComputedValues,
+ current_color: RGBA,
draw_ctx: &DrawingCtx,
node_being_filtered_name: &str,
) -> Result<FilterSpec, FilterResolveError> {
@@ -125,7 +126,7 @@ impl FilterValue {
node_being_filtered_name,
),
- FilterValue::Function(ref func) => func.to_filter_spec(values, draw_ctx),
+ FilterValue::Function(ref func) => func.to_filter_spec(values, current_color, draw_ctx),
}
}
}
diff --git a/src/filter_func.rs b/src/filter_func.rs
index ea98731f..e434d120 100644
--- a/src/filter_func.rs
+++ b/src/filter_func.rs
@@ -645,6 +645,7 @@ impl FilterFunction {
pub fn to_filter_spec(
&self,
values: &ComputedValues,
+ current_color: RGBA,
draw_ctx: &DrawingCtx,
) -> Result<FilterSpec, FilterResolveError> {
// userSpaceonUse is the default for primitive_units
@@ -655,7 +656,7 @@ impl FilterFunction {
FilterFunction::Blur(v) => Ok(v.to_filter_spec(¶ms)),
FilterFunction::Brightness(v) => Ok(v.to_filter_spec(¶ms)),
FilterFunction::Contrast(v) => Ok(v.to_filter_spec(¶ms)),
- FilterFunction::DropShadow(v) => Ok(v.to_filter_spec(¶ms, values.color().0)),
+ FilterFunction::DropShadow(v) => Ok(v.to_filter_spec(¶ms, current_color)),
FilterFunction::Grayscale(v) => Ok(v.to_filter_spec(¶ms)),
FilterFunction::HueRotate(v) => Ok(v.to_filter_spec(¶ms)),
FilterFunction::Invert(v) => Ok(v.to_filter_spec(¶ms)),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]