[librsvg: 10/45] Implement to_resolved() for NodeFooGradient as a macro
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 10/45] Implement to_resolved() for NodeFooGradient as a macro
- Date: Tue, 1 Oct 2019 15:07:47 +0000 (UTC)
commit 7d450428435448a2a26e7f2ade7ea895cb0fb0e1
Author: Federico Mena Quintero <federico gnome org>
Date: Thu Sep 26 18:15:37 2019 -0500
Implement to_resolved() for NodeFooGradient as a macro
rsvg_internals/src/gradient.rs | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
---
diff --git a/rsvg_internals/src/gradient.rs b/rsvg_internals/src/gradient.rs
index b147feff..6d0cc1a0 100644
--- a/rsvg_internals/src/gradient.rs
+++ b/rsvg_internals/src/gradient.rs
@@ -535,6 +535,24 @@ macro_rules! impl_node_trait {
};
}
+macro_rules! impl_to_resolved {
+ ($gradient_type:tt, $resolved:tt) => {
+ impl $gradient_type {
+ fn to_resolved(self) -> $resolved {
+ assert!(self.is_resolved());
+
+ let $gradient_type { common, variant } = self;
+
+ $resolved {
+ common: common.to_resolved(),
+ variant: variant.to_resolved(),
+ }
+ }
+ }
+ };
+}
+
+
macro_rules! impl_resolve {
($gradient_type:ty) => {
impl Resolve for $gradient_type {
@@ -672,6 +690,8 @@ struct ResolvedLinearGradient {
impl_node_trait!(NodeLinearGradient);
+impl_to_resolved!(NodeLinearGradient, ResolvedLinearGradient);
+
impl_resolve!(NodeLinearGradient);
impl_paint_source!(
@@ -694,6 +714,8 @@ struct ResolvedRadialGradient {
impl_node_trait!(NodeRadialGradient);
+impl_to_resolved!(NodeRadialGradient, ResolvedRadialGradient);
+
impl_resolve!(NodeRadialGradient);
impl_paint_source!(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]