[gnome-photos/wip/rishi/edit-mode: 25/25] gegl-gtk-view-helper: Simplify the arithmetic



commit 8e443c873caa1bad58fab9d742da6f69d8a52b10
Author: Debarshi Ray <debarshir gnome org>
Date:   Sun Jun 21 21:50:52 2015 +0200

    gegl-gtk-view-helper: Simplify the arithmetic

 src/gegl-gtk-view-helper.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/src/gegl-gtk-view-helper.c b/src/gegl-gtk-view-helper.c
index 6370bc6..6ad5f0f 100644
--- a/src/gegl-gtk-view-helper.c
+++ b/src/gegl-gtk-view-helper.c
@@ -134,8 +134,6 @@ update_autoscale(ViewHelper *self)
 
     } else if (self->autoscale_policy == GEGL_GTK_VIEW_AUTOSCALE_CONTENT) {
         /* Calculate and set scaling factor to make the content fit inside */
-        float delta_x;
-        float delta_y;
         float scale = 1.0;
 
         if (bbox.width > viewport.width || bbox.height > viewport.height) {
@@ -152,10 +150,8 @@ update_autoscale(ViewHelper *self)
         self->scale = scale;
 
         /* At this point, viewport is definitely bigger than bbox. */
-        delta_x = (viewport.width - bbox.width) / 2.0;
-        delta_y = (viewport.height - bbox.height) / 2.0;
-        self->x = -delta_x;
-        self->y = -delta_y;
+        self->x = (bbox.width - viewport.width) / 2.0;
+        self->y = (bbox.height - viewport.height) / 2.0;
     }
 
 }


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