summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-10-19 18:25:28 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-10-19 18:25:28 +0200
commit2714d10cb57dce82c6f9e3a53630b2c41ff82659 (patch)
treef01462a43c74d92a197b2740f4e6731d2a241e12
parent71df01b9906352c22ec32aa99e1a5399f9526896 (diff)
gtkui: fixed handling corrupted/invalid covers
-rw-r--r--plugins/gtkui/coverart.c19
-rw-r--r--plugins/gtkui/coverart.h3
-rw-r--r--plugins/gtkui/gtkui.c8
-rw-r--r--plugins/gtkui/plcommon.c5
4 files changed, 12 insertions, 23 deletions
diff --git a/plugins/gtkui/coverart.c b/plugins/gtkui/coverart.c
index bb4de51d..1a2e4b6f 100644
--- a/plugins/gtkui/coverart.c
+++ b/plugins/gtkui/coverart.c
@@ -167,22 +167,14 @@ loading_thread (void *none) {
GdkPixbuf *pixbuf = NULL;
GError *error = NULL;
pixbuf = gdk_pixbuf_new_from_file_at_scale (queue->fname, queue->width, queue->width, TRUE, &error);
- if (!pixbuf) {
- unlink (queue->fname);
- fprintf (stderr, "gdk_pixbuf_new_from_file_at_scale %s %d failed, error: %s\n", queue->fname, queue->width, error ? error->message : "n/a");
- if (error) {
- g_error_free (error);
- error = NULL;
- }
- }
if (error) {
+ //fprintf (stderr, "gdk_pixbuf_new_from_file_at_scale %s %d failed, error: %s\n", queue->fname, queue->width, error ? error->message : "n/a");
g_error_free (error);
error = NULL;
}
if (!pixbuf) {
- // make default empty image
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 2, 2);
- stat_buf.st_mtime = 0;
+ pixbuf = pixbuf_default;
+ g_object_ref (pixbuf);
}
if (cache_min != -1) {
deadbeef->mutex_lock (mutex);
@@ -401,3 +393,8 @@ cover_get_default_pixbuf (void) {
g_object_ref (pixbuf_default);
return pixbuf_default;
}
+
+int
+gtkui_is_default_pixbuf (GdkPixbuf *pb) {
+ return pb == pixbuf_default;
+}
diff --git a/plugins/gtkui/coverart.h b/plugins/gtkui/coverart.h
index 39f371cc..bacbfd92 100644
--- a/plugins/gtkui/coverart.h
+++ b/plugins/gtkui/coverart.h
@@ -48,5 +48,8 @@ queue_cover_callback (void (*callback)(void *user_data), void *user_data);
GdkPixbuf *
cover_get_default_pixbuf (void);
+int
+gtkui_is_default_pixbuf (GdkPixbuf *pb);
+
#endif
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index dd5aaed1..44d3a31f 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -873,12 +873,6 @@ gtkui_message (uint32_t id, uintptr_t ctx, uint32_t p1, uint32_t p2) {
return 0;
}
-static gboolean
-unlock_playlist_columns_cb (void *ctx) {
-// ddb_listview_lock_columns (DDB_LISTVIEW (lookup_widget (mainwin, "playlist")), 0);
- return FALSE;
-}
-
static void
init_widget_layout (void) {
w_init ();
@@ -1075,8 +1069,6 @@ gtkui_thread (void *ctx) {
deadbeef->pl_format_title (NULL, -1, str, sizeof (str), -1, fmt);
gtk_window_set_title (GTK_WINDOW (mainwin), str);
- g_idle_add (unlock_playlist_columns_cb, NULL);
-
// override default file adding APIs to show progress bar
gtkui_original_plt_add_dir = deadbeef->plt_add_dir;
deadbeef->plt_add_dir = gtkui_plt_add_dir;
diff --git a/plugins/gtkui/plcommon.c b/plugins/gtkui/plcommon.c
index dd0df61e..08f7e3fa 100644
--- a/plugins/gtkui/plcommon.c
+++ b/plugins/gtkui/plcommon.c
@@ -229,9 +229,6 @@ void draw_column_data (DdbListview *listview, cairo_t *cr, DdbListviewIter it, D
GdkPixbuf *pixbuf = get_cover_art_callb (deadbeef->pl_find_meta (((DB_playItem_t *)group_it), ":URI"), artist, album, real_art_width == art_width ? art_width : -1, redraw_playlist_single, listview);
if (!pixbuf) {
pixbuf = cover_get_default_pixbuf ();
- if (!listview->cover_refresh_timeout_id) {
- hq = 1;
- }
}
if (pixbuf) {
art_width = gdk_pixbuf_get_width (pixbuf);
@@ -271,7 +268,7 @@ void draw_column_data (DdbListview *listview, cairo_t *cr, DdbListviewIter it, D
}
cairo_scale (cr, art_scale, art_scale);
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
- cairo_pattern_set_filter (cairo_get_source(cr), (hq || art_width == real_art_width) ? CAIRO_FILTER_GAUSSIAN : CAIRO_FILTER_FAST);
+ cairo_pattern_set_filter (cairo_get_source(cr), gtkui_is_default_pixbuf (pixbuf) ? CAIRO_FILTER_GAUSSIAN : CAIRO_FILTER_FAST);
cairo_fill (cr);
cairo_restore (cr);
}