[librsvg: 39/45] Split off a get_unresolved_variant() function from each gradient type
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 39/45] Split off a get_unresolved_variant() function from each gradient type
- Date: Tue, 1 Oct 2019 15:10:13 +0000 (UTC)
commit f2913f098a68bf39ca2103283faf6289ece0aab2
Author: Federico Mena Quintero <federico gnome org>
Date: Mon Sep 30 18:10:35 2019 -0500
Split off a get_unresolved_variant() function from each gradient type
rsvg_internals/src/gradient.rs | 38 +++++++++++++++++++++++++-------------
1 file changed, 25 insertions(+), 13 deletions(-)
---
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index 55eb987a..b7d3465a 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -480,6 +480,17 @@ struct Unresolved {
fallback: Option<Fragment>,
}
+impl NodeLinearGradient {
+ fn get_unresolved_variant(&self) -> UnresolvedVariant {
+ UnresolvedVariant::Linear {
+ x1: self.x1,
+ y1: self.y1,
+ x2: self.x2,
+ y2: self.y2,
+ }
+ }
+}
+
impl NodeLinearGradient {
fn get_unresolved(&self, node: &RsvgNode) -> Unresolved {
let mut gradient = UnresolvedGradient {
@@ -487,12 +498,7 @@ impl NodeLinearGradient {
affine: self.common.affine,
spread: self.common.spread,
stops: None,
- variant: UnresolvedVariant::Linear {
- x1: self.x1,
- y1: self.y1,
- x2: self.x2,
- y2: self.y2,
- },
+ variant: self.get_unresolved_variant(),
};
gradient.add_color_stops_from_node(node);
@@ -504,6 +510,18 @@ impl NodeLinearGradient {
}
}
+impl NodeRadialGradient {
+ fn get_unresolved_variant(&self) -> UnresolvedVariant {
+ UnresolvedVariant::Radial {
+ cx: self.cx,
+ cy: self.cy,
+ r: self.r,
+ fx: self.fx,
+ fy: self.fy,
+ }
+ }
+}
+
impl NodeRadialGradient {
fn get_unresolved(&self, node: &RsvgNode) -> Unresolved {
let mut gradient = UnresolvedGradient {
@@ -511,13 +529,7 @@ impl NodeRadialGradient {
affine: self.common.affine,
spread: self.common.spread,
stops: None,
- variant: UnresolvedVariant::Radial {
- cx: self.cx,
- cy: self.cy,
- r: self.r,
- fx: self.fx,
- fy: self.fy,
- },
+ variant: self.get_unresolved_variant(),
};
gradient.add_color_stops_from_node(node);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]