[librsvg] util.rs: Move clone_fallback_name() here
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg] util.rs: Move clone_fallback_name() here
- Date: Thu, 2 Feb 2017 04:01:20 +0000 (UTC)
commit fbfdc927ad81705f61cd06719fc60ebf84c29399
Author: Federico Mena Quintero <federico gnome org>
Date: Wed Feb 1 21:52:14 2017 -0600
util.rs: Move clone_fallback_name() here
We'll use it in the patterns code as well
rust/src/gradient.rs | 10 ++--------
rust/src/util.rs | 12 +++++++++++-
2 files changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/rust/src/gradient.rs b/rust/src/gradient.rs
index 887f225..f3f7ce8 100644
--- a/rust/src/gradient.rs
+++ b/rust/src/gradient.rs
@@ -13,6 +13,8 @@ use drawing_ctx::RsvgNode;
use bbox::*;
+use util::*;
+
use self::cairo::MatrixTrait;
#[derive(Copy, Clone)]
@@ -133,14 +135,6 @@ impl GradientCommon {
}
}
-fn clone_fallback_name (fallback: &Option<String>) -> Option<String> {
- if let Some (ref fallback_name) = *fallback {
- Some (fallback_name.clone ())
- } else {
- None
- }
-}
-
impl Clone for GradientCommon {
fn clone (&self) -> Self {
GradientCommon {
diff --git a/rust/src/util.rs b/rust/src/util.rs
index b3f09e7..4cd80b2 100644
--- a/rust/src/util.rs
+++ b/rust/src/util.rs
@@ -1,4 +1,14 @@
-const DBL_EPSILON: f64 = 1e-10;
+// In paint servers (patterns, gradients, etc.), we have an
+// Option<String> for fallback names. This is a utility function to
+// clone one of those.
+pub fn clone_fallback_name (fallback: &Option<String>) -> Option<String> {
+ if let Some (ref fallback_name) = *fallback {
+ Some (fallback_name.clone ())
+ } else {
+ None
+ }
+}
+
pub const DBL_EPSILON: f64 = 1e-10;
pub fn double_equals (a: f64, b: f64) -> bool {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]