configure.ac, plug-ins: make file-heif build with older libheif again

Lower requirement to 1.3.2 and check for 1.4.0 separately. Put color
profile code in #ifdef HAVE_LIBHEIF_1_4_0.
This commit is contained in:
Michael Natterer 2019-06-25 13:20:07 +02:00
parent 153236f07d
commit 62f010df90
2 changed files with 15 additions and 1 deletions

View File

@ -65,7 +65,7 @@ m4_define([harfbuzz_required_version], [0.9.19])
m4_define([intltool_required_version], [0.40.1])
m4_define([lcms_required_version], [2.8])
m4_define([libgudev_required_version], [167])
m4_define([libheif_required_version], [1.4.0])
m4_define([libheif_required_version], [1.3.2])
m4_define([liblzma_required_version], [5.0.0])
m4_define([libmypaint_required_version], [1.3.0])
m4_define([libpng_required_version], [1.6.25])
@ -1776,7 +1776,10 @@ AC_ARG_WITH(libheif, [ --without-libheif build without libheif support])
have_libheif=no
if test "x$with_libheif" != xno; then
have_libheif_1_4_0=yes
have_libheif=yes
PKG_CHECK_MODULES(LIBHEIF, libheif >= 1.4.0,,
[have_libheif_1_4_0="no (libheif >= 1.4.0 not found)"])
PKG_CHECK_MODULES(LIBHEIF, libheif >= libheif_required_version,
FILE_HEIF='file-heif$(EXEEXT)',
[have_libheif="no (libheif not found)"])
@ -1789,6 +1792,11 @@ fi
AC_SUBST(FILE_HEIF)
AM_CONDITIONAL(HAVE_LIBHEIF, test "x$have_libheif" = xyes)
if test "x$have_libheif_1_4_0" = xyes; then
AC_DEFINE(HAVE_LIBHEIF_1_4_0, 1,
[Define to 1 if libheif >= 1.4.0 is available])
fi
########################
# Check for libbacktrace
@ -3010,6 +3018,7 @@ Optional Plug-Ins:
OpenEXR: $have_openexr
WebP: $have_webp
Heif: $have_libheif
Heif >= 1.4.0: $have_libheif_1_4_0
PDF (export): $have_cairo_pdf
Print: $enable_print
Python 2: $enable_python

View File

@ -479,6 +479,7 @@ load_image (GFile *file,
return -1;
}
#ifdef HAVE_LIBHEIF_1_4_0
switch (heif_image_handle_get_color_profile_type (handle))
{
case heif_color_profile_type_not_present:
@ -506,6 +507,7 @@ load_image (GFile *file,
g_free (profile_data);
}
break;
default:
/* heif_color_profile_type_nclx (what is that?) and any future
* profile type which we don't support in GIMP (yet).
@ -514,6 +516,7 @@ load_image (GFile *file,
G_STRFUNC);
break;
}
#endif /* HAVE_LIBHEIF_1_4_0 */
gimp_progress_update (0.75);
@ -697,11 +700,13 @@ save_image (GFile *file,
if (profile)
{
#ifdef HAVE_LIBHEIF_1_4_0
const guint8 *icc_data;
gsize icc_length;
icc_data = gimp_color_profile_get_icc_profile (profile, &icc_length);
heif_image_set_raw_color_profile (image, "prof", icc_data, icc_length);
#endif /* HAVE_LIBHEIF_1_4_0 */
g_object_unref (profile);
}