[gnome-photos] base-item: Use the oriented height and width



commit db3f33a464c23a0792846d19ed0db73d3929f721
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Nov 28 10:07:11 2017 +0100

    base-item: Use the oriented height and width
    
    ... in PropertiesDialog and the thumbnails. The unoriented raw
    dimensions are an implementation detail that's generally uninteresting
    beyond decoding the image file format, and there's no need to
    perpetuate them.

 src/photos-base-item.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 1683d41..d305ddf 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -2718,6 +2718,8 @@ photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor
   const gchar *uri;
   gchar *filename;
   gchar *name_fallback;
+  gint64 height;
+  gint64 width;
 
   priv = photos_base_item_get_instance_private (self);
 
@@ -2789,9 +2791,6 @@ photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor
     filename = PHOTOS_BASE_ITEM_GET_CLASS (self)->create_filename_fallback (self);
   photos_utils_take_string (&priv->filename, filename);
 
-  priv->width = tracker_sparql_cursor_get_integer (cursor, PHOTOS_QUERY_COLUMNS_WIDTH);
-  priv->height = tracker_sparql_cursor_get_integer (cursor, PHOTOS_QUERY_COLUMNS_HEIGHT);
-
   equipment = tracker_sparql_cursor_get_string (cursor, PHOTOS_QUERY_COLUMNS_EQUIPMENT, NULL);
   priv->equipment = g_quark_from_string (equipment);
 
@@ -2811,6 +2810,22 @@ photos_base_item_populate_from_cursor (PhotosBaseItem *self, TrackerSparqlCursor
       priv->orientation = PHOTOS_ORIENTATION_TOP;
     }
 
+  height = tracker_sparql_cursor_get_integer (cursor, PHOTOS_QUERY_COLUMNS_HEIGHT);
+  width = tracker_sparql_cursor_get_integer (cursor, PHOTOS_QUERY_COLUMNS_WIDTH);
+  if (priv->orientation == PHOTOS_ORIENTATION_BOTTOM
+      || priv->orientation == PHOTOS_ORIENTATION_BOTTOM_MIRROR
+      || priv->orientation == PHOTOS_ORIENTATION_TOP
+      || priv->orientation == PHOTOS_ORIENTATION_TOP_MIRROR)
+    {
+      priv->height = height;
+      priv->width = width;
+    }
+  else
+    {
+      priv->height = width;
+      priv->width = height;
+    }
+
   priv->exposure_time = tracker_sparql_cursor_get_double (cursor, PHOTOS_QUERY_COLUMNS_EXPOSURE_TIME);
   priv->fnumber = tracker_sparql_cursor_get_double (cursor, PHOTOS_QUERY_COLUMNS_FNUMBER);
   priv->focal_length = tracker_sparql_cursor_get_double (cursor, PHOTOS_QUERY_COLUMNS_FOCAL_LENGTH);


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