[gimp] Fix compilation with old libheif 1.3.2



commit 0fce1b042b9ede0b1558b69fd08cc3a00cb34e67
Author: Daniel Novomesky <dnovomesky gmail com>
Date:   Tue Sep 8 12:00:32 2020 +0200

    Fix compilation with old libheif 1.3.2
    
    High bit depth import and export enabled only for >= libheif 1.8.0

 plug-ins/common/file-heif.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/common/file-heif.c b/plug-ins/common/file-heif.c
index cb3cb6dd0b..63e2cfcb85 100644
--- a/plug-ins/common/file-heif.c
+++ b/plug-ins/common/file-heif.c
@@ -711,8 +711,8 @@ load_image (GFile              *file,
   const Babl               *format;
   const guint8             *data;
   gint                      stride;
-  gint                      bit_depth;
-  enum                      heif_chroma chroma;
+  gint                      bit_depth = 8;
+  enum heif_chroma          chroma    = heif_chroma_interleaved_RGB;
   GimpPrecision             precision;
   gboolean                  load_linear;
   const char               *encoding;
@@ -840,6 +840,7 @@ load_image (GFile              *file,
 
   has_alpha = heif_image_handle_has_alpha_channel (handle);
 
+#if LIBHEIF_HAVE_VERSION(1,8,0)
   bit_depth = heif_image_handle_get_luma_bits_per_pixel (handle);
   if (bit_depth < 0)
     {
@@ -850,6 +851,7 @@ load_image (GFile              *file,
 
       return NULL;
     }
+#endif
 
   if (bit_depth == 8)
     {
@@ -864,6 +866,7 @@ load_image (GFile              *file,
     }
   else /* high bit depth */
     {
+#if LIBHEIF_HAVE_VERSION(1,8,0)
 #if ( G_BYTE_ORDER == G_LITTLE_ENDIAN )
       if (has_alpha)
         {
@@ -882,6 +885,7 @@ load_image (GFile              *file,
         {
           chroma = heif_chroma_interleaved_RRGGBB_BE;
         }
+#endif
 #endif
     }
 
@@ -1323,6 +1327,7 @@ save_image (GFile                        *file,
                                heif_chroma_interleaved_RGB,
                                &h_image);
       break;
+#if LIBHEIF_HAVE_VERSION(1,8,0)
     case 10:
     case 12:
 #if ( G_BYTE_ORDER == G_LITTLE_ENDIAN )
@@ -1341,6 +1346,7 @@ save_image (GFile                        *file,
                                &h_image);
 #endif
       break;
+#endif
     default:
       g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
                    "Unsupported bit depth: %d",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]