aboutsummaryrefslogtreecommitdiffstats
path: root/thumbs.c
diff options
context:
space:
mode:
authorBert <ber.t@gmx.com>2011-03-09 11:37:49 +0100
committerBert <ber.t@gmx.com>2011-03-09 11:37:49 +0100
commitd982b06eed04cb080a4dd730b75f93285d5b159b (patch)
tree1be5b16d7ecb6a692603fa3f80bce7134c74412e /thumbs.c
parenta82c45431bd31bfedaad00d77cc2ab4c772774d0 (diff)
downloadnsxiv-d982b06eed04cb080a4dd730b75f93285d5b159b.tar.zst
White background for images with alpha
Diffstat (limited to 'thumbs.c')
-rw-r--r--thumbs.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/thumbs.c b/thumbs.c
index 78380ec..4669967 100644
--- a/thumbs.c
+++ b/thumbs.c
@@ -88,6 +88,8 @@ void tns_load(tns_t *tns, win_t *win, int n, const char *filename) {
t->pm = win_create_pixmap(win, t->w, t->h);
imlib_context_set_drawable(t->pm);
imlib_context_set_anti_alias(1);
+ if (imlib_image_has_alpha())
+ win_draw_rect(win, t->pm, 0, 0, t->w, t->h, True, 0, win->white);
imlib_render_image_part_on_drawable_at_size(0, 0, w, h,
0, 0, t->w, t->h);
tns->dirty = 1;
@@ -170,13 +172,23 @@ void tns_render(tns_t *tns, win_t *win) {
void tns_highlight(tns_t *tns, win_t *win, int n, Bool hl) {
thumb_t *t;
+ unsigned long col;
if (!tns || !win)
return;
if (n >= 0 && n < tns->cnt) {
t = &tns->thumbs[n];
- win_draw_rect(win, t->x - 2, t->y - 2, t->w + 4, t->h + 4, hl);
+
+ if (hl)
+ col = win->selcol;
+ else if (win->fullscreen)
+ col = win->black;
+ else
+ col = win->bgcol;
+
+ win_draw_rect(win, win->pm, t->x - 2, t->y - 2, t->w + 4, t->h + 4,
+ False, 2, col);
}
win_draw(win);