From cf3ba566ca22774590cb4545517548ee4ba1e711 Mon Sep 17 00:00:00 2001 From: fredkiefer Date: Fri, 22 Nov 2013 23:02:17 +0000 Subject: [PATCH] * configure.ac: Detect new GifQuantizeBuffer function. * configure: regenerate * Source/NSBitmapImageRep+GIF.m: Try to handle quantize again for libgif 5.0. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37400 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 7 +++++++ Source/NSBitmapImageRep+GIF.m | 10 ++++++++-- configure | 15 +++++++++++++-- configure.ac | 5 +++-- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8c21d05db..2b287510b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-11-23 Fred Kiefer + + * configure.ac: Detect new GifQuantizeBuffer function. + * configure: regenerate + * Source/NSBitmapImageRep+GIF.m: Try to handle quantize again for + libgif 5.0. + 2013-11-22 Fred Kiefer * configure.ac: Try to improve the ICU detection. diff --git a/Source/NSBitmapImageRep+GIF.m b/Source/NSBitmapImageRep+GIF.m index 8dc88d6fa..2d30a7254 100644 --- a/Source/NSBitmapImageRep+GIF.m +++ b/Source/NSBitmapImageRep+GIF.m @@ -111,7 +111,7 @@ static void gs_gif_init_input_source(gs_gif_input_src *src, NSData *data) src->pos = 0; } -#if HAVE_QUANTIZEBUFFER +#if HAVE_QUANTIZEBUFFER || HAVE_GIFQUANTIZEBUFFER /* Function to write GIF to buffer */ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len) { @@ -395,7 +395,7 @@ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len) - (NSData *) _GIFRepresentationWithProperties: (NSDictionary *) properties errorMessage: (NSString **)errorMsg { -#if HAVE_QUANTIZEBUFFER +#if HAVE_QUANTIZEBUFFER || HAVE_GIFQUANTIZEBUFFER NSMutableData * GIFRep = nil; // our return value GifFileType * GIFFile = NULL; GifByteType * rgbPlanes = NULL; // giflib needs planar RGB @@ -487,9 +487,15 @@ static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len) SET_ERROR_MSG(@"GIFRepresentation: malloc out of memory."); free(rgbPlanes); } +#if GIFLIB_MAJOR >= 5 + status = GifQuantizeBuffer(width, height, &colorMapSize, + redPlane, greenPlane, bluePlane, + GIFImage, GIFColorMap->Colors); +#else status = QuantizeBuffer(width, height, &colorMapSize, redPlane, greenPlane, bluePlane, GIFImage, GIFColorMap->Colors); +#endif if (status == GIF_ERROR) { free(GIFImage); diff --git a/configure b/configure index 27f98944e..0e2f848c8 100755 --- a/configure +++ b/configure @@ -5424,8 +5424,8 @@ $as_echo "$as_me: -gui will be linked against -lX11 to support libgif images" >& fi fi -# QuantizeBuffer was removed from giflib in version 4.2 but is supposed -# to make its return in the next release. If this function is not present +# QuantizeBuffer was removed from giflib in version 4.2 but was reintroduced +# in the 5.0 release with a new name. If this function is not present # we disable the support to create gif image representations. for ac_func in QuantizeBuffer do : @@ -5438,6 +5438,17 @@ _ACEOF fi done +for ac_func in GifQuantizeBuffer +do : + ac_fn_c_check_func "$LINENO" "GifQuantizeBuffer" "ac_cv_func_GifQuantizeBuffer" +if test "x$ac_cv_func_GifQuantizeBuffer" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GIFQUANTIZEBUFFER 1 +_ACEOF + +fi +done + #-------------------------------------------------------------------- # Find ImageMagick diff --git a/configure.ac b/configure.ac index 35064a902..2e6a5d7f3 100644 --- a/configure.ac +++ b/configure.ac @@ -355,10 +355,11 @@ if test "$have_ungif" = no -o "${enable_libgif}" = yes; then fi fi -# QuantizeBuffer was removed from giflib in version 4.2 but is supposed -# to make its return in the next release. If this function is not present +# QuantizeBuffer was removed from giflib in version 4.2 but was reintroduced +# in the 5.0 release with a new name. If this function is not present # we disable the support to create gif image representations. AC_CHECK_FUNCS(QuantizeBuffer) +AC_CHECK_FUNCS(GifQuantizeBuffer) #-------------------------------------------------------------------- # Find ImageMagick