[gnome-photos] tool-crop: Always express the "original" constraint as landscape



commit 6d24eeb9dc2efb72974f9ae5e3d6e3f859c9c6c9
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Jul 18 18:02:00 2017 +0200

    tool-crop: Always express the "original" constraint as landscape
    
    All the other constraints, except square, are always expressed as
    landscapes regardless of the orientation of the original BaseItem.
    This inconsistency is exposed by portrait BaseItems, where the
    orientation changes from landscape to portrait depending on the chosen
    constraint.
    
    A subsequent commit will allow changing the orientation at will. Always
    expressing the "original" constraint as landscape will help with that.
    Cropping portraits was already painful, so this doesn't make it much
    worse.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781134

 src/photos-tool-crop.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-tool-crop.c b/src/photos-tool-crop.c
index baa86a0..2dadee7 100644
--- a/src/photos-tool-crop.c
+++ b/src/photos-tool-crop.c
@@ -150,6 +150,8 @@ photos_tool_crop_calculate_aspect_ratio (PhotosToolCrop *self, guint constraint)
 
     case PHOTOS_TOOL_CROP_ASPECT_RATIO_ORIGINAL:
       ret_val = (gdouble) self->bbox_source.width / self->bbox_source.height;
+      if (ret_val < 1.0)
+        ret_val = 1.0 / ret_val;
       break;
 
     default:


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