[librsvg: 14/23] feImage - resolve and render separately
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 14/23] feImage - resolve and render separately
- Date: Thu, 11 Mar 2021 23:12:24 +0000 (UTC)
commit 349bde27bdab8d82d8564ae3e8291b90b8dfc1e7
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Mar 11 15:38:11 2021 -0600
feImage - resolve and render separately
src/filters/image.rs | 8 +++++---
src/filters/mod.rs | 5 ++---
2 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/filters/image.rs b/src/filters/image.rs
index db2987a8..c26a83f9 100644
--- a/src/filters/image.rs
+++ b/src/filters/image.rs
@@ -16,12 +16,15 @@ use super::context::{FilterContext, FilterOutput, FilterResult};
use super::{FilterEffect, FilterError, Primitive, PrimitiveParams};
/// The `feImage` filter primitive.
+#[derive(Clone)]
pub struct FeImage {
base: Primitive,
aspect: AspectRatio,
href: Option<String>,
}
+pub type Image = FeImage;
+
impl Default for FeImage {
/// Constructs a new `FeImage` with empty properties.
#[inline]
@@ -121,7 +124,6 @@ impl SetAttributes for FeImage {
impl FeImage {
pub fn render(
&self,
- _node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes<'_>,
draw_ctx: &mut DrawingCtx,
@@ -156,7 +158,7 @@ impl FeImage {
}
impl FilterEffect for FeImage {
- fn resolve(&self, node: &Node) -> Result<PrimitiveParams, FilterError> {
- Ok(PrimitiveParams::Image(node.clone()))
+ fn resolve(&self, _node: &Node) -> Result<PrimitiveParams, FilterError> {
+ Ok(PrimitiveParams::Image(self.clone()))
}
}
diff --git a/src/filters/mod.rs b/src/filters/mod.rs
index ef3ebce9..a3dea17e 100644
--- a/src/filters/mod.rs
+++ b/src/filters/mod.rs
@@ -52,7 +52,6 @@ pub mod offset;
pub mod tile;
pub mod turbulence;
-use image::FeImage;
use lighting::{FeDiffuseLighting, FeSpecularLighting};
use merge::FeMerge;
use morphology::FeMorphology;
@@ -76,7 +75,7 @@ pub enum PrimitiveParams {
DisplacementMap(displacement_map::DisplacementMap),
Flood(flood::Flood),
GaussianBlur(gaussian_blur::GaussianBlur),
- Image(Node),
+ Image(image::Image),
Merge(Node),
Morphology(Node),
Offset(Node),
@@ -327,7 +326,7 @@ fn render_primitive(
(Element::FeDisplacementMap(_), DisplacementMap(p)) => p.render(ctx, acquired_nodes, draw_ctx),
(Element::FeFlood(_), Flood(p)) => p.render(ctx, acquired_nodes, draw_ctx),
(Element::FeGaussianBlur(_), GaussianBlur(p)) => p.render(ctx, acquired_nodes, draw_ctx),
- (Element::FeImage(ref inner), Image(node)) =>
FeImage::render(&inner.element_impl, &node, ctx, acquired_nodes, draw_ctx),
+ (Element::FeImage(_), Image(p)) => p.render(ctx, acquired_nodes, draw_ctx),
(Element::FeMerge(ref inner), Merge(node)) =>
FeMerge::render(&inner.element_impl, &node, ctx, acquired_nodes, draw_ctx),
(Element::FeMorphology(ref inner), Morphology(node)) =>
FeMorphology::render(&inner.element_impl, &node, ctx, acquired_nodes, draw_ctx),
(Element::FeOffset(ref inner), Offset(node)) =>
FeOffset::render(&inner.element_impl, &node, ctx, acquired_nodes, draw_ctx),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]