diff options
author | NRK <nrk@disroot.org> | 2023-05-18 17:06:44 +0200 |
---|---|---|
committer | NRK <nrk@disroot.org> | 2023-05-18 17:06:44 +0200 |
commit | d0ec8716d7d4d0cfb0067290cac51b59b7fd4e42 (patch) | |
tree | 7f0f92f8c6bf045eb820fb8009a1d49373970000 | |
parent | 4b67816eae77db28db64e5e80d0d99c60e74973f (diff) | |
download | nsxiv-d0ec8716d7d4d0cfb0067290cac51b59b7fd4e42.tar.zst |
fix: calling imlib2 with color modifier being NULL (#440)
the multiframe loaders sets the color modifier to NULL but doesn't
restore it before returning. this results in a imlib2 developer warning
if you try to change brightness/contrast on a multiframe image (which
doesn't have alpha).
ensure that the color modifier is restored before returning under all
paths.
Reported-by: Madhu
Reviewed-on: https://codeberg.org/nsxiv/nsxiv/pulls/440
Reviewed-by: eylles <eylles@noreply.codeberg.org>
-rw-r--r-- | image.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -470,11 +470,6 @@ static bool img_load_multiframe(img_t *img, const fileinfo_t *file) m->frames = erealloc(m->frames, m->cap * sizeof(*m->frames)); } - imlib_context_set_dither(0); - imlib_context_set_anti_alias(0); - imlib_context_set_color_modifier(NULL); - imlib_context_set_operation(IMLIB_OP_COPY); - if ((blank = imlib_create_image(img->w, img->h)) == NULL) { error(0, 0, "%s: couldn't create image", file->name); return false; @@ -482,6 +477,11 @@ static bool img_load_multiframe(img_t *img, const fileinfo_t *file) imlib_context_set_image(blank); img_area_clear(0, 0, img->w, img->h); + imlib_context_set_dither(0); + imlib_context_set_anti_alias(0); + imlib_context_set_color_modifier(NULL); + imlib_context_set_operation(IMLIB_OP_COPY); + /* * Imlib2 gives back a "raw frame", we need to blend it on top of the * previous frame ourselves if necessary to get the fully decoded frame. @@ -548,6 +548,7 @@ static bool img_load_multiframe(img_t *img, const fileinfo_t *file) imlib_context_set_image(blank); imlib_free_image(); img_multiframe_context_set(img); + imlib_context_set_color_modifier(img->cmod); /* restore cmod */ return m->cnt > 0; } #endif /* HAVE_IMLIB2_MULTI_FRAME */ |