summaryrefslogtreecommitdiff
path: root/plugins/gtkui/plcommon.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-10-16 22:43:52 +0200
committerGravatar Alexey Yakovenko <waker@users.sourceforge.net>2013-10-16 22:43:52 +0200
commite93a9b2d9677b7ef3142a03f370ef545659b5773 (patch)
tree3005858226bb439a72c5cc852ee55b7ea52ec198 /plugins/gtkui/plcommon.c
parentc700c20bb67117dd57ff3130b1a1d46c53b8c626 (diff)
gtkui: several fixes/improvements in playlist cover rendering
Diffstat (limited to 'plugins/gtkui/plcommon.c')
-rw-r--r--plugins/gtkui/plcommon.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/plugins/gtkui/plcommon.c b/plugins/gtkui/plcommon.c
index 041593e0..b509cbd7 100644
--- a/plugins/gtkui/plcommon.c
+++ b/plugins/gtkui/plcommon.c
@@ -138,7 +138,10 @@ deferred_cover_load_cb (void *ctx) {
printf ("queue redraw for cover size %d\n", lv->new_cover_size);
last = 1;
}
- GdkPixbuf *pixbuf = get_cover_art_callb (deadbeef->pl_find_meta (((DB_playItem_t *)group_it), ":URI"), artist, album, lv->new_cover_size, last ? redraw_playlist : NULL, lv);
+ GdkPixbuf *pixbuf = get_cover_art_callb (deadbeef->pl_find_meta (((DB_playItem_t *)group_it), ":URI"), artist, album, lv->new_cover_size, NULL, NULL);
+ if (last) {
+ queue_cover_callback (redraw_playlist, lv);
+ }
if (pixbuf) {
g_object_unref (pixbuf);
}
@@ -209,7 +212,6 @@ void draw_column_data (DdbListview *listview, cairo_t *cr, DdbListviewIter it, D
}
}
int art_width = listview->cover_size;
- float art_scale = (float)real_art_width / art_width;
int art_y = y; // dest y
int art_h = height;
int sy; // source y
@@ -224,8 +226,10 @@ void draw_column_data (DdbListview *listview, cairo_t *cr, DdbListviewIter it, D
int h = cwidth - group_y;
h = min (height, art_h);
- GdkPixbuf *pixbuf = get_cover_art_callb (deadbeef->pl_find_meta (((DB_playItem_t *)group_it), ":URI"), artist, album, art_width, redraw_playlist_single, listview);
+ 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) {
+ art_width = gdk_pixbuf_get_width (pixbuf);
+ float art_scale = (float)real_art_width / art_width;
int pw = real_art_width;
int ph;
if (group_pinned == 1 && gtkui_groups_pinned) {
@@ -240,9 +244,9 @@ void draw_column_data (DdbListview *listview, cairo_t *cr, DdbListviewIter it, D
cairo_save (cr);
if (group_pinned == 1 && gtkui_groups_pinned) {
int ph_real = gdk_pixbuf_get_height (pixbuf);
- if (grp_next_y <= ph_real + listview->grouptitle_height) {
- cairo_rectangle (cr, x + ART_PADDING_HORZ, grp_next_y - ph_real, pw, ph);
- cairo_translate (cr, (x + ART_PADDING_HORZ)-0, grp_next_y - ph_real);
+ if (grp_next_y <= ph_real * art_scale + listview->grouptitle_height) {
+ cairo_rectangle (cr, x + ART_PADDING_HORZ, grp_next_y - ph_real * art_scale, pw, ph);
+ cairo_translate (cr, (x + ART_PADDING_HORZ)-0, grp_next_y - ph_real * art_scale);
}
else {
cairo_rectangle (cr, x + ART_PADDING_HORZ, listview->grouptitle_height, pw, ph);
@@ -261,6 +265,7 @@ void draw_column_data (DdbListview *listview, cairo_t *cr, DdbListviewIter it, D
cairo_fill (cr);
cairo_restore (cr);
}
+ g_object_unref (pixbuf);
}
}
}