[gnome-photos/wip/rishi/thumbnailer: 4/6] base-item: Center the thumbnails in an imaginary 256x256 grid



commit d39debdb9a3b8867f517d1cda03971a7e3c314e7
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Feb 21 12:18:34 2017 +0100

    base-item: Center the thumbnails in an imaginary 256x256 grid
    
    This is done by copying thumbnails that are smaller than the requested
    size to the center of 256x256 GdkPixbuf. As a nice side-effect, emblems
    are no longer scaled down for such thumbnails.
    
    This will help letterbox the thumbnails.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740417

 src/photos-base-item.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 8cfcca7..dfff975 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -752,6 +752,7 @@ photos_base_item_refresh_thumb_path_pixbuf (GObject *source_object, GAsyncResult
   PhotosBaseItem *self;
   PhotosBaseItemPrivate *priv;
   GApplication *app;
+  GdkPixbuf *centered_pixbuf = NULL;
   GdkPixbuf *pixbuf = NULL;
   GdkPixbuf *scaled_pixbuf = NULL;
   GError *error = NULL;
@@ -796,10 +797,14 @@ photos_base_item_refresh_thumb_path_pixbuf (GObject *source_object, GAsyncResult
   scale = photos_application_get_scale_factor (PHOTOS_APPLICATION (app));
   icon_size = photos_utils_get_icon_size_unscaled ();
   scaled_pixbuf = photos_utils_downscale_pixbuf_for_scale (pixbuf, icon_size, scale);
-  photos_base_item_set_original_icon (self, scaled_pixbuf);
+
+  icon_size = photos_utils_get_icon_size ();
+  centered_pixbuf = photos_utils_center_pixbuf (scaled_pixbuf, icon_size);
+  photos_base_item_set_original_icon (self, centered_pixbuf);
 
  out:
   g_input_stream_close_async (stream, G_PRIORITY_DEFAULT, NULL, NULL, NULL);
+  g_clear_object (&centered_pixbuf);
   g_clear_object (&scaled_pixbuf);
   g_clear_object (&pixbuf);
 }


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