[gthumb] thumbnails: do not use a white background for images with transparencies



commit 440c3189758ba3922bcb86e1dcd05932ebaf508e
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sat Apr 20 17:03:38 2019 +0200

    thumbnails: do not use a white background for images with transparencies
    
    Fixes: https://gitlab.gnome.org/GNOME/gthumb/issues/37

 gthumb/gth-grid-view.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gthumb/gth-grid-view.c b/gthumb/gth-grid-view.c
index 68f67bf4..2a41fbc2 100644
--- a/gthumb/gth-grid-view.c
+++ b/gthumb/gth-grid-view.c
@@ -111,6 +111,7 @@ typedef struct {
        char                  *caption;
        gboolean               is_image : 1;
        gboolean               is_video : 1;
+       gboolean               has_alpha : 1;
        ItemStyle              style;
 
        /* item state */
@@ -253,10 +254,12 @@ gth_grid_view_item_set_thumbnail (GthGridViewItem *item,
        if (item->thumbnail != NULL) {
                item->pixbuf_area.width = cairo_image_surface_get_width (item->thumbnail);
                item->pixbuf_area.height = cairo_image_surface_get_height (item->thumbnail);
+               item->has_alpha = _cairo_image_surface_get_has_alpha (item->thumbnail);
        }
        else {
                item->pixbuf_area.width = 0;
                item->pixbuf_area.height = 0;
+               item->has_alpha = FALSE;
        }
 
        item->pixbuf_area.x = item->thumbnail_area.x  + ((item->thumbnail_area.width - 
item->pixbuf_area.width) / 2);
@@ -657,6 +660,7 @@ _gth_grid_view_update_item_size (GthGridView     *self,
        thumbnail_size = self->priv->cell_size - (self->priv->cell_padding * 2);
 
        if (item->is_icon
+           || item->has_alpha
            || ((item->pixbuf_area.width < self->priv->thumbnail_size) && (item->pixbuf_area.height < 
self->priv->thumbnail_size))
             || (item->file_data == NULL))
        {


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