[librsvg: 18/23] feOffset - resolve and render separately
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 18/23] feOffset - resolve and render separately
- Date: Thu, 11 Mar 2021 23:12:24 +0000 (UTC)
commit 194166139ede324a89ad4e4b71dcde8b1b47fb88
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Mar 11 16:36:36 2021 -0600
feOffset - resolve and render separately
src/filters/mod.rs | 5 ++---
src/filters/offset.rs | 9 ++++++---
2 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/src/filters/mod.rs b/src/filters/mod.rs
index 3a9a473e..45c25f29 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 offset::FeOffset;
use tile::FeTile;
use turbulence::FeTurbulence;
@@ -75,7 +74,7 @@ pub enum PrimitiveParams {
Image(image::Image),
Merge(merge::Merge),
Morphology(morphology::Morphology),
- Offset(Node),
+ Offset(offset::Offset),
SpecularLighting(lighting::SpecularLighting),
Tile(Node),
Turbulence(Node),
@@ -326,7 +325,7 @@ fn render_primitive(
(Element::FeImage(_), Image(p)) => p.render(ctx, acquired_nodes, draw_ctx),
(Element::FeMerge(_), Merge(p)) => p.render(ctx, acquired_nodes, draw_ctx),
(Element::FeMorphology(_), Morphology(p)) => p.render(ctx, acquired_nodes, draw_ctx),
- (Element::FeOffset(ref inner), Offset(node)) =>
FeOffset::render(&inner.element_impl, &node, ctx, acquired_nodes, draw_ctx),
+ (Element::FeOffset(_), Offset(p)) => p.render(ctx, acquired_nodes, draw_ctx),
(Element::FeSpecularLighting(_), SpecularLighting(p)) => p.render(ctx, acquired_nodes, draw_ctx),
(Element::FeTile(ref inner), Tile(node)) =>
FeTile::render(&inner.element_impl, &node, ctx, acquired_nodes, draw_ctx),
(Element::FeTurbulence(ref inner), Turbulence(node)) =>
FeTurbulence::render(&inner.element_impl, &node, ctx, acquired_nodes, draw_ctx),
diff --git a/src/filters/offset.rs b/src/filters/offset.rs
index 2109b677..c313a598 100644
--- a/src/filters/offset.rs
+++ b/src/filters/offset.rs
@@ -12,6 +12,7 @@ use super::context::{FilterContext, FilterOutput, FilterResult};
use super::{FilterEffect, FilterError, Input, Primitive, PrimitiveParams};
/// The `feOffset` filter primitive.
+#[derive(Clone)]
pub struct FeOffset {
base: Primitive,
in1: Input,
@@ -19,6 +20,9 @@ pub struct FeOffset {
dy: f64,
}
+/// Resolved `feOffset` primitive for rendering.
+pub type Offset = FeOffset;
+
impl Default for FeOffset {
/// Constructs a new `Offset` with empty properties.
#[inline]
@@ -51,7 +55,6 @@ impl SetAttributes for FeOffset {
impl FeOffset {
pub fn render(
&self,
- _node: &Node,
ctx: &FilterContext,
acquired_nodes: &mut AcquiredNodes<'_>,
draw_ctx: &mut DrawingCtx,
@@ -87,7 +90,7 @@ impl FeOffset {
}
impl FilterEffect for FeOffset {
- fn resolve(&self, node: &Node) -> Result<PrimitiveParams, FilterError> {
- Ok(PrimitiveParams::Offset(node.clone()))
+ fn resolve(&self, _node: &Node) -> Result<PrimitiveParams, FilterError> {
+ Ok(PrimitiveParams::Offset(self.clone()))
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]