[librsvg: 1/6] filters: rename Filter trait to FilterEffect
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 1/6] filters: rename Filter trait to FilterEffect
- Date: Fri, 1 Nov 2019 18:35:19 +0000 (UTC)
commit e0766c3e2f6c20b9ef13f0f261882a1f6430e120
Author: Paolo Borelli <pborelli gnome org>
Date: Fri Nov 1 09:36:06 2019 +0100
filters: rename Filter trait to FilterEffect
This avoids name clash with the <filter> element and is consistent
with the "fe" prefix of all filters.
rsvg_internals/src/filters/blend.rs | 6 +++---
rsvg_internals/src/filters/color_matrix.rs | 6 +++---
rsvg_internals/src/filters/component_transfer.rs | 6 +++---
rsvg_internals/src/filters/composite.rs | 6 +++---
rsvg_internals/src/filters/convolve_matrix.rs | 6 +++---
rsvg_internals/src/filters/displacement_map.rs | 6 +++---
rsvg_internals/src/filters/flood.rs | 6 +++---
rsvg_internals/src/filters/gaussian_blur.rs | 6 +++---
rsvg_internals/src/filters/image.rs | 6 +++---
rsvg_internals/src/filters/light/lighting.rs | 8 ++++----
rsvg_internals/src/filters/merge.rs | 6 +++---
rsvg_internals/src/filters/mod.rs | 14 +++++++-------
rsvg_internals/src/filters/morphology.rs | 6 +++---
rsvg_internals/src/filters/offset.rs | 6 +++---
rsvg_internals/src/filters/tile.rs | 6 +++---
rsvg_internals/src/filters/turbulence.rs | 6 +++---
rsvg_internals/src/node.rs | 6 +++---
17 files changed, 56 insertions(+), 56 deletions(-)
---
diff --git a/rsvg_internals/src/filters/blend.rs b/rsvg_internals/src/filters/blend.rs
index 03a91477..7e287215 100755
--- a/rsvg_internals/src/filters/blend.rs
+++ b/rsvg_internals/src/filters/blend.rs
@@ -10,7 +10,7 @@ use crate::surface_utils::shared_surface::SharedImageSurface;
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::input::Input;
-use super::{Filter, FilterError, PrimitiveWithInput};
+use super::{FilterEffect, FilterError, PrimitiveWithInput};
/// Enumeration of the possible blending modes.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
@@ -53,7 +53,7 @@ impl Default for Blend {
}
impl NodeTrait for Blend {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
self.base.set_atts(parent, pbag)?;
@@ -72,7 +72,7 @@ impl NodeTrait for Blend {
}
}
-impl Filter for Blend {
+impl FilterEffect for Blend {
fn render(
&self,
_node: &RsvgNode,
diff --git a/rsvg_internals/src/filters/color_matrix.rs b/rsvg_internals/src/filters/color_matrix.rs
index 36596c36..6ed0b5df 100644
--- a/rsvg_internals/src/filters/color_matrix.rs
+++ b/rsvg_internals/src/filters/color_matrix.rs
@@ -14,7 +14,7 @@ use crate::surface_utils::{
use crate::util::clamp;
use super::context::{FilterContext, FilterOutput, FilterResult};
-use super::{Filter, FilterError, PrimitiveWithInput};
+use super::{FilterEffect, FilterError, PrimitiveWithInput};
/// Color matrix operation types.
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
@@ -43,7 +43,7 @@ impl Default for ColorMatrix {
}
impl NodeTrait for ColorMatrix {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
self.base.set_atts(parent, pbag)?;
@@ -155,7 +155,7 @@ impl NodeTrait for ColorMatrix {
}
}
-impl Filter for ColorMatrix {
+impl FilterEffect for ColorMatrix {
fn render(
&self,
_node: &RsvgNode,
diff --git a/rsvg_internals/src/filters/component_transfer.rs
b/rsvg_internals/src/filters/component_transfer.rs
index 368403b2..06348e9c 100644
--- a/rsvg_internals/src/filters/component_transfer.rs
+++ b/rsvg_internals/src/filters/component_transfer.rs
@@ -18,7 +18,7 @@ use crate::surface_utils::{
use crate::util::clamp;
use super::context::{FilterContext, FilterOutput, FilterResult};
-use super::{Filter, FilterError, PrimitiveWithInput};
+use super::{FilterEffect, FilterError, PrimitiveWithInput};
/// The `feComponentTransfer` filter primitive.
pub struct ComponentTransfer {
@@ -36,7 +36,7 @@ impl Default for ComponentTransfer {
}
impl NodeTrait for ComponentTransfer {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
#[inline]
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
@@ -289,7 +289,7 @@ macro_rules! func_or_default {
};
}
-impl Filter for ComponentTransfer {
+impl FilterEffect for ComponentTransfer {
fn render(
&self,
node: &RsvgNode,
diff --git a/rsvg_internals/src/filters/composite.rs b/rsvg_internals/src/filters/composite.rs
index a3033fde..b30a4a4c 100644
--- a/rsvg_internals/src/filters/composite.rs
+++ b/rsvg_internals/src/filters/composite.rs
@@ -18,7 +18,7 @@ use crate::util::clamp;
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::input::Input;
-use super::{Filter, FilterError, PrimitiveWithInput};
+use super::{FilterEffect, FilterError, PrimitiveWithInput};
/// Enumeration of the possible compositing operations.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
@@ -59,7 +59,7 @@ impl Default for Composite {
}
impl NodeTrait for Composite {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
self.base.set_atts(parent, pbag)?;
@@ -129,7 +129,7 @@ pub fn composite_arithmetic(
}
}
-impl Filter for Composite {
+impl FilterEffect for Composite {
fn render(
&self,
_node: &RsvgNode,
diff --git a/rsvg_internals/src/filters/convolve_matrix.rs b/rsvg_internals/src/filters/convolve_matrix.rs
index 8ff9519a..b792025e 100644
--- a/rsvg_internals/src/filters/convolve_matrix.rs
+++ b/rsvg_internals/src/filters/convolve_matrix.rs
@@ -19,7 +19,7 @@ use crate::surface_utils::{
use crate::util::clamp;
use super::context::{FilterContext, FilterOutput, FilterResult};
-use super::{Filter, FilterError, PrimitiveWithInput};
+use super::{FilterEffect, FilterError, PrimitiveWithInput};
/// The `feConvolveMatrix` filter primitive.
pub struct ConvolveMatrix {
@@ -55,7 +55,7 @@ impl Default for ConvolveMatrix {
}
impl NodeTrait for ConvolveMatrix {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
self.base.set_atts(parent, pbag)?;
@@ -224,7 +224,7 @@ impl NodeTrait for ConvolveMatrix {
}
}
-impl Filter for ConvolveMatrix {
+impl FilterEffect for ConvolveMatrix {
fn render(
&self,
_node: &RsvgNode,
diff --git a/rsvg_internals/src/filters/displacement_map.rs b/rsvg_internals/src/filters/displacement_map.rs
index e4809e2f..e608cfd1 100644
--- a/rsvg_internals/src/filters/displacement_map.rs
+++ b/rsvg_internals/src/filters/displacement_map.rs
@@ -9,7 +9,7 @@ use crate::property_bag::PropertyBag;
use crate::surface_utils::{iterators::Pixels, shared_surface::SharedImageSurface};
use super::context::{FilterContext, FilterOutput, FilterResult};
-use super::{Filter, FilterError, Input, PrimitiveWithInput};
+use super::{FilterEffect, FilterError, Input, PrimitiveWithInput};
/// Enumeration of the color channels the displacement map can source.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
@@ -44,7 +44,7 @@ impl Default for DisplacementMap {
}
impl NodeTrait for DisplacementMap {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
self.base.set_atts(parent, pbag)?;
@@ -67,7 +67,7 @@ impl NodeTrait for DisplacementMap {
}
}
-impl Filter for DisplacementMap {
+impl FilterEffect for DisplacementMap {
fn render(
&self,
_node: &RsvgNode,
diff --git a/rsvg_internals/src/filters/flood.rs b/rsvg_internals/src/filters/flood.rs
index e99f3f1e..19d4d129 100644
--- a/rsvg_internals/src/filters/flood.rs
+++ b/rsvg_internals/src/filters/flood.rs
@@ -7,7 +7,7 @@ use crate::property_bag::PropertyBag;
use crate::surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
use super::context::{FilterContext, FilterOutput, FilterResult};
-use super::{Filter, FilterError, Primitive};
+use super::{FilterEffect, FilterError, Primitive};
/// The `feFlood` filter primitive.
pub struct Flood {
@@ -25,7 +25,7 @@ impl Default for Flood {
}
impl NodeTrait for Flood {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
#[inline]
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
@@ -33,7 +33,7 @@ impl NodeTrait for Flood {
}
}
-impl Filter for Flood {
+impl FilterEffect for Flood {
fn render(
&self,
node: &RsvgNode,
diff --git a/rsvg_internals/src/filters/gaussian_blur.rs b/rsvg_internals/src/filters/gaussian_blur.rs
index b64d45b5..5f3e5725 100644
--- a/rsvg_internals/src/filters/gaussian_blur.rs
+++ b/rsvg_internals/src/filters/gaussian_blur.rs
@@ -16,7 +16,7 @@ use crate::surface_utils::{
};
use super::context::{FilterContext, FilterOutput, FilterResult};
-use super::{Filter, FilterError, PrimitiveWithInput};
+use super::{FilterEffect, FilterError, PrimitiveWithInput};
/// The maximum gaussian blur kernel size.
///
@@ -41,7 +41,7 @@ impl Default for GaussianBlur {
}
impl NodeTrait for GaussianBlur {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
self.base.set_atts(parent, pbag)?;
@@ -196,7 +196,7 @@ fn gaussian_blur(
)?)
}
-impl Filter for GaussianBlur {
+impl FilterEffect for GaussianBlur {
fn render(
&self,
_node: &RsvgNode,
diff --git a/rsvg_internals/src/filters/image.rs b/rsvg_internals/src/filters/image.rs
index 4fe56987..e11d7271 100644
--- a/rsvg_internals/src/filters/image.rs
+++ b/rsvg_internals/src/filters/image.rs
@@ -14,7 +14,7 @@ use crate::surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
use crate::viewbox::ViewBox;
use super::context::{FilterContext, FilterOutput, FilterResult};
-use super::{Filter, FilterError, Primitive};
+use super::{FilterEffect, FilterError, Primitive};
/// The `feImage` filter primitive.
pub struct Image {
@@ -171,7 +171,7 @@ impl Image {
}
impl NodeTrait for Image {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
self.base.set_atts(parent, pbag)?;
@@ -197,7 +197,7 @@ impl NodeTrait for Image {
}
}
-impl Filter for Image {
+impl FilterEffect for Image {
fn render(
&self,
_node: &RsvgNode,
diff --git a/rsvg_internals/src/filters/light/lighting.rs b/rsvg_internals/src/filters/light/lighting.rs
index 115e381b..cf165e28 100644
--- a/rsvg_internals/src/filters/light/lighting.rs
+++ b/rsvg_internals/src/filters/light/lighting.rs
@@ -27,7 +27,7 @@ use crate::filters::{
top_row_normal,
Normal,
},
- Filter,
+ FilterEffect,
FilterError,
PrimitiveWithInput,
};
@@ -111,7 +111,7 @@ impl Default for DiffuseLighting {
}
impl NodeTrait for DiffuseLighting {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
self.common.set_atts(parent, pbag)?;
@@ -183,7 +183,7 @@ impl Default for SpecularLighting {
}
impl NodeTrait for SpecularLighting {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
self.common.set_atts(parent, pbag)?;
@@ -272,7 +272,7 @@ impl Lighting for SpecularLighting {
// not want to make the Lighting trait public, so we use a macro
macro_rules! impl_lighting_filter {
($lighting_type:ty, $alpha_func:ident) => {
- impl Filter for $lighting_type {
+ impl FilterEffect for $lighting_type {
fn render(
&self,
node: &RsvgNode,
diff --git a/rsvg_internals/src/filters/merge.rs b/rsvg_internals/src/filters/merge.rs
index e198f945..5b6ffe49 100644
--- a/rsvg_internals/src/filters/merge.rs
+++ b/rsvg_internals/src/filters/merge.rs
@@ -9,7 +9,7 @@ use crate::surface_utils::shared_surface::{SharedImageSurface, SurfaceType};
use super::context::{FilterContext, FilterOutput, FilterResult};
use super::input::Input;
-use super::{Filter, FilterError, Primitive};
+use super::{FilterEffect, FilterError, Primitive};
/// The `feMerge` filter primitive.
pub struct Merge {
@@ -33,7 +33,7 @@ impl Default for Merge {
}
impl NodeTrait for Merge {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
#[inline]
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
@@ -104,7 +104,7 @@ impl MergeNode {
}
}
-impl Filter for Merge {
+impl FilterEffect for Merge {
fn render(
&self,
node: &RsvgNode,
diff --git a/rsvg_internals/src/filters/mod.rs b/rsvg_internals/src/filters/mod.rs
index 02b46e2f..1d5745ef 100644
--- a/rsvg_internals/src/filters/mod.rs
+++ b/rsvg_internals/src/filters/mod.rs
@@ -32,7 +32,7 @@ pub mod node;
use self::node::NodeFilter;
/// A filter primitive interface.
-pub trait Filter: NodeTrait {
+pub trait FilterEffect: NodeTrait {
/// Renders this filter primitive.
///
/// If this filter primitive can't be rendered for whatever reason (for instance, a required
@@ -52,9 +52,9 @@ pub trait Filter: NodeTrait {
fn is_affected_by_color_interpolation_filters(&self) -> bool;
}
-macro_rules! impl_node_as_filter {
+macro_rules! impl_node_as_filter_effect {
() => (
- fn as_filter(&self) -> Option<&dyn Filter> {
+ fn as_filter_effect(&self) -> Option<&dyn FilterEffect> {
Some(self)
}
)
@@ -94,7 +94,7 @@ struct PrimitiveWithInput {
impl Primitive {
/// Constructs a new `Primitive` with empty properties.
#[inline]
- fn new<T: Filter>() -> Primitive {
+ fn new<T: FilterEffect>() -> Primitive {
Primitive {
x: None,
y: None,
@@ -194,7 +194,7 @@ impl NodeTrait for Primitive {
impl PrimitiveWithInput {
/// Constructs a new `PrimitiveWithInput` with empty properties.
#[inline]
- fn new<T: Filter>() -> PrimitiveWithInput {
+ fn new<T: FilterEffect>() -> PrimitiveWithInput {
PrimitiveWithInput {
base: Primitive::new::<T>(),
in_: None,
@@ -297,7 +297,7 @@ pub fn render(
!in_error
})
// Keep only filter primitives (those that implement the Filter trait)
- .filter(|c| c.borrow().get_node_trait().as_filter().is_some())
+ .filter(|c| c.borrow().get_node_trait().as_filter_effect().is_some())
// Check if the node wants linear RGB.
.map(|c| {
let linear_rgb = {
@@ -312,7 +312,7 @@ pub fn render(
for (c, linear_rgb) in primitives {
let node_data = c.borrow();
- let filter = node_data.get_node_trait().as_filter().unwrap();
+ let filter = node_data.get_node_trait().as_filter_effect().unwrap();
let mut render = |filter_ctx: &mut FilterContext| {
if let Err(err) = filter
diff --git a/rsvg_internals/src/filters/morphology.rs b/rsvg_internals/src/filters/morphology.rs
index edade0c5..35dd30ac 100644
--- a/rsvg_internals/src/filters/morphology.rs
+++ b/rsvg_internals/src/filters/morphology.rs
@@ -18,7 +18,7 @@ use crate::surface_utils::{
};
use super::context::{FilterContext, FilterOutput, FilterResult};
-use super::{Filter, FilterError, PrimitiveWithInput};
+use super::{FilterEffect, FilterError, PrimitiveWithInput};
/// Enumeration of the possible morphology operations.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
@@ -47,7 +47,7 @@ impl Default for Morphology {
}
impl NodeTrait for Morphology {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
self.base.set_atts(parent, pbag)?;
@@ -74,7 +74,7 @@ impl NodeTrait for Morphology {
}
}
-impl Filter for Morphology {
+impl FilterEffect for Morphology {
fn render(
&self,
_node: &RsvgNode,
diff --git a/rsvg_internals/src/filters/offset.rs b/rsvg_internals/src/filters/offset.rs
index eeb96c4d..0e3e8180 100644
--- a/rsvg_internals/src/filters/offset.rs
+++ b/rsvg_internals/src/filters/offset.rs
@@ -11,7 +11,7 @@ use crate::surface_utils::shared_surface::SharedImageSurface;
use crate::util::clamp;
use super::context::{FilterContext, FilterOutput, FilterResult};
-use super::{Filter, FilterError, PrimitiveWithInput};
+use super::{FilterEffect, FilterError, PrimitiveWithInput};
/// The `feOffset` filter primitive.
pub struct Offset {
@@ -33,7 +33,7 @@ impl Default for Offset {
}
impl NodeTrait for Offset {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
self.base.set_atts(parent, pbag)?;
@@ -50,7 +50,7 @@ impl NodeTrait for Offset {
}
}
-impl Filter for Offset {
+impl FilterEffect for Offset {
fn render(
&self,
_node: &RsvgNode,
diff --git a/rsvg_internals/src/filters/tile.rs b/rsvg_internals/src/filters/tile.rs
index 2baa3390..47668d57 100644
--- a/rsvg_internals/src/filters/tile.rs
+++ b/rsvg_internals/src/filters/tile.rs
@@ -6,7 +6,7 @@ use crate::property_bag::PropertyBag;
use crate::surface_utils::shared_surface::SharedImageSurface;
use super::context::{FilterContext, FilterInput, FilterOutput, FilterResult};
-use super::{Filter, FilterError, PrimitiveWithInput};
+use super::{FilterEffect, FilterError, PrimitiveWithInput};
/// The `feTile` filter primitive.
pub struct Tile {
@@ -24,14 +24,14 @@ impl Default for Tile {
}
impl NodeTrait for Tile {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
self.base.set_atts(parent, pbag)
}
}
-impl Filter for Tile {
+impl FilterEffect for Tile {
fn render(
&self,
_node: &RsvgNode,
diff --git a/rsvg_internals/src/filters/turbulence.rs b/rsvg_internals/src/filters/turbulence.rs
index fe4da196..81447157 100644
--- a/rsvg_internals/src/filters/turbulence.rs
+++ b/rsvg_internals/src/filters/turbulence.rs
@@ -15,7 +15,7 @@ use crate::surface_utils::{
use crate::util::clamp;
use super::context::{FilterContext, FilterOutput, FilterResult};
-use super::{Filter, FilterError, Primitive};
+use super::{FilterEffect, FilterError, Primitive};
/// Enumeration of the tile stitching modes.
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
@@ -57,7 +57,7 @@ impl Default for Turbulence {
}
impl NodeTrait for Turbulence {
- impl_node_as_filter!();
+ impl_node_as_filter_effect!();
#[inline]
fn set_atts(&mut self, parent: Option<&RsvgNode>, pbag: &PropertyBag<'_>) -> NodeResult {
@@ -334,7 +334,7 @@ impl NoiseGenerator {
}
}
-impl Filter for Turbulence {
+impl FilterEffect for Turbulence {
fn render(
&self,
node: &RsvgNode,
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index e4aae4a5..9209d4ae 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -10,7 +10,7 @@ use crate::cond::{RequiredExtensions, RequiredFeatures, SystemLanguage};
use crate::css::CssRules;
use crate::drawing_ctx::DrawingCtx;
use crate::error::*;
-use crate::filters::Filter;
+use crate::filters::FilterEffect;
use crate::parsers::Parse;
use crate::properties::{ComputedValues, SpecifiedValue, SpecifiedValues};
use crate::property_bag::PropertyBag;
@@ -363,8 +363,8 @@ pub trait NodeTrait: Downcast {
Ok(draw_ctx.empty_bbox())
}
- /// Returns the Filter trait if this node is a filter primitive
- fn as_filter(&self) -> Option<&dyn Filter> {
+ /// Returns the FilterEffect trait if this node is a filter primitive
+ fn as_filter_effect(&self) -> Option<&dyn FilterEffect> {
None
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]