aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNRK <nrk@disroot.org>2023-09-21 01:06:07 +0200
committerNRK <nrk@disroot.org>2023-10-01 13:30:15 +0200
commit48d1afd50a4611270ca11215690d5e241bc01fdc (patch)
treea37b9ed61299a740290114ea4817eda1f6c26b7f
parente1b851c4886ab3976f0591be5b740f2a3a8cb7d1 (diff)
downloadnsxiv-48d1afd50a4611270ca11215690d5e241bc01fdc.tar.zst
inline img_multiframe_context_set()
no longer needs to be a separate function now that the legacy loaders are removed. also remove a NOLINT comment and use `(void)var` to silence warning.
-rw-r--r--image.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/image.c b/image.c
index 2a01954..a138f95 100644
--- a/image.c
+++ b/image.c
@@ -133,19 +133,6 @@ void exif_auto_orientate(const fileinfo_t *file)
#endif
#if HAVE_IMLIB2_MULTI_FRAME
-static void img_multiframe_context_set(img_t *img)
-{
- if (img->multi.cnt > 1) {
- img_free(img->im, false);
- img->im = img->multi.frames[0].im;
- } else if (img->multi.cnt == 1) {
- img_free(img->multi.frames[0].im, false);
- img->multi.cnt = 0;
- }
-
- imlib_context_set_image(img->im);
-}
-
static void img_area_clear(int x, int y, int w, int h)
{
assert(x >= 0 && y >= 0);
@@ -253,8 +240,16 @@ static bool img_load_multiframe(img_t *img, const fileinfo_t *file)
img_free(frame, false);
}
img_free(blank, false);
- img_multiframe_context_set(img);
imlib_context_set_color_modifier(img->cmod); /* restore cmod */
+
+ if (m->cnt > 1) {
+ img_free(img->im, false);
+ img->im = m->frames[0].im;
+ } else if (m->cnt == 1) {
+ img_free(m->frames[0].im, false);
+ m->cnt = 0;
+ }
+ imlib_context_set_image(img->im);
return m->cnt > 0;
}
#endif /* HAVE_IMLIB2_MULTI_FRAME */
@@ -307,12 +302,13 @@ bool img_load(img_t *img, const fileinfo_t *file)
animated = img_load_multiframe(img, file);
#endif
- if ((fmt = imlib_image_format()) != NULL) { /* NOLINT: fmt might be unused, not worth fixing */
+ (void)fmt; /* maybe unused */
#if HAVE_LIBEXIF && defined(IMLIB2_VERSION)
+ if ((fmt = imlib_image_format()) != NULL) {
if (!STREQ(fmt, "jpeg") && !STREQ(fmt, "jpg"))
exif_auto_orientate(file);
-#endif
}
+#endif
/* for animated images, we want the _canvas_ width/height, which
* img_load_multiframe() sets already.
*/