[nautilus/wip/antoniof/flow-box-preparation: 2/14] Revert "nautilus-file.c: Add transparent padding to thumbnails"




commit fcd2061c9f6fadd8aa36d9b54d8e8baa89bfa2cd
Author: António Fernandes <antoniof gnome org>
Date:   Sun Oct 31 21:34:50 2021 +0000

    Revert "nautilus-file.c: Add transparent padding to thumbnails"
    
    This reverts commit 26d33d74f468a8ab10b4a1c3c8aa66b66205e112.
    
    It was a hack to fix an issue with the way GTK 3 renders GEmblemedIcon.
    
    But GTK4 has dropped support for rendering GEmblemedIcon[0], so we
    aren't going to have any need for this hack going forward.
    
    Also, the new icon view now draws shadows around thumbnails. But due
    to this hack, the shadow would always go around the invisible square.
    
    [0] https://gitlab.gnome.org/GNOME/nautilus/-/issues/2017

 src/nautilus-file.c | 24 +-----------------------
 1 file changed, 1 insertion(+), 23 deletions(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index d0a9a8d03..6a7b77c91 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -5240,9 +5240,6 @@ nautilus_file_get_thumbnail_icon (NautilusFile          *file,
         }
         else
         {
-            GdkPixbuf *bg_pixbuf;
-            int bg_size;
-
             pixbuf = gdk_pixbuf_scale_simple (file->details->thumbnail,
                                               MAX (w * thumb_scale, 1),
                                               MAX (h * thumb_scale, 1),
@@ -5268,32 +5265,13 @@ nautilus_file_get_thumbnail_icon (NautilusFile          *file,
                 }
             }
 
-            /* Copy to a transparent square pixbuf, aligned to the bottom edge */
-            bg_size = MAX (gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf));
-            bg_pixbuf = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (pixbuf),
-                                        TRUE,
-                                        gdk_pixbuf_get_bits_per_sample (pixbuf),
-                                        bg_size,
-                                        bg_size);
-            gdk_pixbuf_fill (bg_pixbuf, 0);
-            gdk_pixbuf_copy_area (pixbuf,
-                                  0,
-                                  0,
-                                  gdk_pixbuf_get_width (pixbuf),
-                                  gdk_pixbuf_get_height (pixbuf),
-                                  bg_pixbuf,
-                                  (bg_size - gdk_pixbuf_get_width (pixbuf)) / 2,
-                                  (bg_size - gdk_pixbuf_get_height (pixbuf)));
-            g_clear_object (&pixbuf);
-            pixbuf = bg_pixbuf;
-
             g_clear_object (&file->details->scaled_thumbnail);
             file->details->scaled_thumbnail = pixbuf;
             file->details->thumbnail_scale = thumb_scale;
         }
 
         DEBUG ("Returning thumbnailed image, at size %d %d",
-               gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf));
+               (int) (w * thumb_scale), (int) (h * thumb_scale));
     }
     else if (file->details->thumbnail_path == NULL &&
              file->details->can_read &&


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