[librsvg: 2/7] node: introduce different types for feFunc variants
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 2/7] node: introduce different types for feFunc variants
- Date: Mon, 3 Dec 2018 19:53:35 +0000 (UTC)
commit b556a565f476eebd6637027a07d48f5779ece608
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Dec 2 11:13:06 2018 +0100
node: introduce different types for feFunc variants
First step in having a 1:1 relation between element names
and node types. Also reorder alphabetically while we are
at it.
rsvg_internals/src/create_node.rs | 30 ++++++++++++------------
rsvg_internals/src/filters/component_transfer.rs | 11 +++++----
rsvg_internals/src/node.rs | 5 +++-
3 files changed, 26 insertions(+), 20 deletions(-)
---
diff --git a/rsvg_internals/src/create_node.rs b/rsvg_internals/src/create_node.rs
index 17581f6d..4c58450d 100644
--- a/rsvg_internals/src/create_node.rs
+++ b/rsvg_internals/src/create_node.rs
@@ -69,24 +69,24 @@ node_create_fn!(
ComponentTransfer::new
);
node_create_fn!(
- create_component_transfer_func_r,
- ComponentTransferFunction,
- FuncX::new_r
-);
-node_create_fn!(
- create_component_transfer_func_g,
- ComponentTransferFunction,
- FuncX::new_g
+ create_component_transfer_func_a,
+ ComponentTransferFunctionA,
+ FuncX::new_a
);
node_create_fn!(
create_component_transfer_func_b,
- ComponentTransferFunction,
+ ComponentTransferFunctionB,
FuncX::new_b
);
node_create_fn!(
- create_component_transfer_func_a,
- ComponentTransferFunction,
- FuncX::new_a
+ create_component_transfer_func_g,
+ ComponentTransferFunctionG,
+ FuncX::new_g
+);
+node_create_fn!(
+ create_component_transfer_func_r,
+ ComponentTransferFunctionR,
+ FuncX::new_r
);
node_create_fn!(create_composite, FilterPrimitiveComposite, Composite::new);
node_create_fn!(
@@ -207,10 +207,10 @@ lazy_static! {
h.insert("feDiffuseLighting", (true, create_diffuse_lighting as NodeCreateFn));
h.insert("feDisplacementMap", (true, create_displacement_map as NodeCreateFn));
h.insert("feDistantLight", (false, create_distant_light as NodeCreateFn));
- h.insert("feFuncR", (false, create_component_transfer_func_r as NodeCreateFn));
- h.insert("feFuncG", (false, create_component_transfer_func_g as NodeCreateFn));
- h.insert("feFuncB", (false, create_component_transfer_func_b as NodeCreateFn));
h.insert("feFuncA", (false, create_component_transfer_func_a as NodeCreateFn));
+ h.insert("feFuncB", (false, create_component_transfer_func_b as NodeCreateFn));
+ h.insert("feFuncG", (false, create_component_transfer_func_g as NodeCreateFn));
+ h.insert("feFuncR", (false, create_component_transfer_func_r as NodeCreateFn));
h.insert("feFlood", (true, create_flood as NodeCreateFn));
h.insert("feGaussianBlur", (true, create_gaussian_blur as NodeCreateFn));
h.insert("feImage", (true, create_fe_image as NodeCreateFn));
diff --git a/rsvg_internals/src/filters/component_transfer.rs
b/rsvg_internals/src/filters/component_transfer.rs
index 863a5f34..773898e8 100644
--- a/rsvg_internals/src/filters/component_transfer.rs
+++ b/rsvg_internals/src/filters/component_transfer.rs
@@ -293,10 +293,13 @@ impl Filter for ComponentTransfer {
)?;
// Enumerate all child <feFuncX> nodes.
- let functions = node
- .children()
- .rev()
- .filter(|c| c.get_type() == NodeType::ComponentTransferFunction);
+ let functions = node.children().rev().filter(|c| match c.get_type() {
+ NodeType::ComponentTransferFunctionA
+ | NodeType::ComponentTransferFunctionB
+ | NodeType::ComponentTransferFunctionG
+ | NodeType::ComponentTransferFunctionR => true,
+ _ => false,
+ });
// Get a node for every pixel component.
let get_node = |channel| {
diff --git a/rsvg_internals/src/node.rs b/rsvg_internals/src/node.rs
index a75175cc..60779b05 100644
--- a/rsvg_internals/src/node.rs
+++ b/rsvg_internals/src/node.rs
@@ -178,7 +178,10 @@ pub enum NodeType {
Chars,
Circle,
ClipPath,
- ComponentTransferFunction,
+ ComponentTransferFunctionA,
+ ComponentTransferFunctionB,
+ ComponentTransferFunctionG,
+ ComponentTransferFunctionR,
Defs,
Ellipse,
Filter,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]