[gnome-photos/wip/rishi/misc-fixes: 15/15] base-item, gegl-gtk-view-helper: Simplify code



commit 9b93a93f4f34550649e8a2231873659219c9102f
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Dec 26 22:49:01 2015 +0100

    base-item, gegl-gtk-view-helper: Simplify code

 src/gegl-gtk-view-helper.c |    2 +-
 src/photos-base-item.c     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/gegl-gtk-view-helper.c b/src/gegl-gtk-view-helper.c
index cf82ec7..b837f21 100644
--- a/src/gegl-gtk-view-helper.c
+++ b/src/gegl-gtk-view-helper.c
@@ -140,7 +140,7 @@ update_autoscale(ViewHelper *self)
         if (bbox.width > real_viewport_width || bbox.height > real_viewport_height) {
             float width_ratio = bbox.width / (float)real_viewport_width;
             float height_ratio = bbox.height / (float)real_viewport_height;
-            float max_ratio = width_ratio >= height_ratio ? width_ratio : height_ratio;
+            float max_ratio =  MAX (height_ratio, width_ratio);
 
             zoom_scaled = 1.0 / max_ratio;
 
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 82e4499..80b7c1b 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -1565,7 +1565,7 @@ photos_base_item_create_preview (PhotosBaseItem *self,
   buffer = gegl_buffer_dup (buffer_orig);
 
   bbox = *gegl_buffer_get_extent (buffer);
-  min_dimension = bbox.height < bbox.width ? bbox.height : bbox.width;
+  min_dimension = MIN (bbox.height, bbox.width);
   x = (gdouble) (bbox.width - min_dimension) / 2.0;
   y = (gdouble) (bbox.height - min_dimension) / 2.0;
   size_scaled = size * scale;


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