[gnome-photos/wip/rishi/edit-preview: 1/3] utils: Add photos_utils_get_level_from_zoom



commit 9e566570dc3ff218dd5258c1f10177fff1968258
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Nov 23 20:56:59 2015 +0100

    utils: Add photos_utils_get_level_from_zoom

 src/photos-utils.c |   17 +++++++++++++++++
 src/photos-utils.h |    4 ++++
 2 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-utils.c b/src/photos-utils.c
index 1d1b785..0d92af5 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -1,5 +1,6 @@
 /*
  * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2014 Øyvind Kolås
  * Copyright © 2012, 2013, 2014, 2015 Red Hat, Inc.
  * Copyright © 2009 Yorba Foundation
  *
@@ -22,6 +23,7 @@
 /* Based on code from:
  *   + Documents
  *   + Eye of GNOME
+ *   + GEGL
  *   + Shotwell
  *   + Totem
  */
@@ -825,6 +827,21 @@ photos_utils_get_icon_size_unscaled (void)
 }
 
 
+gint
+photos_utils_get_level_from_zoom (gdouble zoom)
+{
+  gint level = 0;
+
+  while (scale <= 0.500001)
+    {
+      scale *= 2.0;
+      level++;
+    }
+
+  return level;
+}
+
+
 gchar *
 photos_utils_get_pixbuf_common_suffix (GdkPixbufFormat *format)
 {
diff --git a/src/photos-utils.h b/src/photos-utils.h
index 99302bd..cbfc171 100644
--- a/src/photos-utils.h
+++ b/src/photos-utils.h
@@ -1,5 +1,6 @@
 /*
  * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2014 Øyvind Kolås
  * Copyright © 2012, 2013, 2014, 2015 Red Hat, Inc.
  *
  * This program is free software; you can redistribute it and/or
@@ -21,6 +22,7 @@
 /* Based on code from:
  *   + Documents
  *   + Eye of GNOME
+ *   + GEGL
  *   + Shotwell
  *   + Totem
  */
@@ -116,6 +118,8 @@ gint             photos_utils_get_icon_size               (void);
 
 gint             photos_utils_get_icon_size_unscaled      (void);
 
+gint             photos_utils_get_level_from_zoom         (gdouble zoom);
+
 char*            photos_utils_get_pixbuf_common_suffix    (GdkPixbufFormat *format);
 
 gchar           *photos_utils_get_pixbuf_type_from_mime_type (const gchar *mime_type);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]