[gnome-photos/wip/rishi/misc-fixes] Use double, not float for photos:saturation property



commit 8a0c9423bf8e0592ff00455b5c23dacefbba38fe
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Jan 11 10:52:11 2016 +0100

    Use double, not float for photos:saturation property
    
    This keeps the code in sync with gegl, and make it easier to switch to
    gegl:saturation once it is more widely available.
    
    (This is preferred in gegl because the cost of casting double to float
    is negligible compared to the cost of casting integer to float, and is
    worth paying to keep the API future-proof.)

 src/photos-operation-saturation.c |   18 +++++++++---------
 src/photos-preview-view.c         |    4 ++--
 src/photos-tool-colors.c          |    2 +-
 3 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/src/photos-operation-saturation.c b/src/photos-operation-saturation.c
index b0949bb..9f03c67 100644
--- a/src/photos-operation-saturation.c
+++ b/src/photos-operation-saturation.c
@@ -139,7 +139,7 @@ photos_operation_saturation_get_property (GObject *object, guint prop_id, GValue
   switch (prop_id)
     {
     case PROP_SCALE:
-      g_value_set_float (value, self->scale);
+      g_value_set_double (value, (gdouble) self->scale);
       break;
 
     default:
@@ -157,7 +157,7 @@ photos_operation_saturation_set_property (GObject *object, guint prop_id, const
   switch (prop_id)
     {
     case PROP_SCALE:
-      self->scale = g_value_get_float (value);
+      self->scale = (gfloat) g_value_get_double (value);
       break;
 
     default:
@@ -189,13 +189,13 @@ photos_operation_saturation_class_init (PhotosOperationSaturationClass *class)
 
   g_object_class_install_property (object_class,
                                    PROP_SCALE,
-                                   g_param_spec_float ("scale",
-                                                       "Scale",
-                                                       "Strength of effect",
-                                                       0.0,
-                                                       2.0,
-                                                       1.0,
-                                                       G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
+                                   g_param_spec_double ("scale",
+                                                        "Scale",
+                                                        "Strength of effect",
+                                                        0.0,
+                                                        2.0,
+                                                        1.0,
+                                                        G_PARAM_CONSTRUCT | G_PARAM_READWRITE));
 
   gegl_operation_class_set_keys (operation_class,
                                  "name", "photos:saturation",
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index 1acf8ae..dae19ad 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -404,13 +404,13 @@ static void
 photos_preview_view_saturation (PhotosPreviewView *self, GVariant *parameter)
 {
   PhotosBaseItem *item;
-  gfloat scale;
+  gdouble scale;
 
   item = PHOTOS_BASE_ITEM (photos_base_manager_get_active_object (self->priv->item_mngr));
   if (item == NULL)
     return;
 
-  scale = (gfloat) g_variant_get_double (parameter);
+  scale = g_variant_get_double (parameter);
   photos_base_item_operation_add (item, "photos:saturation", "scale", scale, NULL);
   photos_base_item_process_async (item, NULL, photos_preview_view_process, self);
 }
diff --git a/src/photos-tool-colors.c b/src/photos-tool-colors.c
index acbcee3..3ea8610 100644
--- a/src/photos-tool-colors.c
+++ b/src/photos-tool-colors.c
@@ -143,7 +143,7 @@ photos_tool_colors_activate (PhotosTool *tool, PhotosBaseItem *item, GeglGtkView
   PhotosToolColors *self = PHOTOS_TOOL_COLORS (tool);
   gdouble brightness;
   gdouble contrast;
-  gfloat saturation;
+  gdouble saturation;
 
   if (!photos_base_item_operation_get (item,
                                        "gegl:brightness-contrast",


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