[librsvg: 3/5] Converting a filter function to a FilterSpec is infallible; don't return a Result there
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 3/5] Converting a filter function to a FilterSpec is infallible; don't return a Result there
- Date: Sat, 24 Sep 2022 01:46:59 +0000 (UTC)
commit 7f3ea3f7e63d2834dacaaa91aab87a8c2125ff45
Author: Federico Mena Quintero <federico gnome org>
Date: Fri Sep 23 20:17:18 2022 -0500
Converting a filter function to a FilterSpec is infallible; don't return a Result there
Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/753>
src/filter.rs | 2 +-
src/filter_func.rs | 28 ++++++++++++----------------
2 files changed, 13 insertions(+), 17 deletions(-)
---
diff --git a/src/filter.rs b/src/filter.rs
index 94b354f93..bb6fd765a 100644
--- a/src/filter.rs
+++ b/src/filter.rs
@@ -116,7 +116,7 @@ impl FilterValue {
),
FilterValue::Function(ref func) => {
- func.to_filter_spec(user_space_params, current_color)
+ Ok(func.to_filter_spec(user_space_params, current_color))
}
}
}
diff --git a/src/filter_func.rs b/src/filter_func.rs
index e931c8b17..26dcd8103 100644
--- a/src/filter_func.rs
+++ b/src/filter_func.rs
@@ -24,7 +24,7 @@ use crate::filters::{
gaussian_blur::GaussianBlur,
merge::{Merge, MergeNode},
offset::Offset,
- FilterResolveError, FilterSpec, Input, Primitive, PrimitiveParams, ResolvedPrimitive,
+ FilterSpec, Input, Primitive, PrimitiveParams, ResolvedPrimitive,
};
use crate::length::*;
use crate::paint_server::resolve_color;
@@ -638,22 +638,18 @@ impl Parse for FilterFunction {
impl FilterFunction {
// If this function starts actually returning an Err, remove this Clippy exception:
#[allow(clippy::unnecessary_wraps)]
- pub fn to_filter_spec(
- &self,
- params: &NormalizeParams,
- current_color: RGBA,
- ) -> Result<FilterSpec, FilterResolveError> {
+ pub fn to_filter_spec(&self, params: &NormalizeParams, current_color: RGBA) -> FilterSpec {
match self {
- FilterFunction::Blur(v) => Ok(v.to_filter_spec(params)),
- FilterFunction::Brightness(v) => Ok(v.to_filter_spec(params)),
- FilterFunction::Contrast(v) => Ok(v.to_filter_spec(params)),
- FilterFunction::DropShadow(v) => Ok(v.to_filter_spec(params, current_color)),
- FilterFunction::Grayscale(v) => Ok(v.to_filter_spec(params)),
- FilterFunction::HueRotate(v) => Ok(v.to_filter_spec(params)),
- FilterFunction::Invert(v) => Ok(v.to_filter_spec(params)),
- FilterFunction::Opacity(v) => Ok(v.to_filter_spec(params)),
- FilterFunction::Saturate(v) => Ok(v.to_filter_spec(params)),
- FilterFunction::Sepia(v) => Ok(v.to_filter_spec(params)),
+ FilterFunction::Blur(v) => v.to_filter_spec(params),
+ FilterFunction::Brightness(v) => v.to_filter_spec(params),
+ FilterFunction::Contrast(v) => v.to_filter_spec(params),
+ FilterFunction::DropShadow(v) => v.to_filter_spec(params, current_color),
+ FilterFunction::Grayscale(v) => v.to_filter_spec(params),
+ FilterFunction::HueRotate(v) => v.to_filter_spec(params),
+ FilterFunction::Invert(v) => v.to_filter_spec(params),
+ FilterFunction::Opacity(v) => v.to_filter_spec(params),
+ FilterFunction::Saturate(v) => v.to_filter_spec(params),
+ FilterFunction::Sepia(v) => v.to_filter_spec(params),
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]