From 48d1afd50a4611270ca11215690d5e241bc01fdc Mon Sep 17 00:00:00 2001 From: NRK Date: Thu, 21 Sep 2023 05:06:07 +0600 Subject: 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. --- image.c | 28 ++++++++++++---------------- 1 file 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. */ -- cgit v1.2.3-54-g00ecf