* 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
This commit is contained in:
fredkiefer 2013-11-22 23:02:17 +00:00
parent 9be38fcc46
commit cf3ba566ca
4 changed files with 31 additions and 6 deletions

View file

@ -1,3 +1,10 @@
2013-11-23 Fred Kiefer <FredKiefer@gmx.de>
* 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 <FredKiefer@gmx.de> 2013-11-22 Fred Kiefer <FredKiefer@gmx.de>
* configure.ac: Try to improve the ICU detection. * configure.ac: Try to improve the ICU detection.

View file

@ -111,7 +111,7 @@ static void gs_gif_init_input_source(gs_gif_input_src *src, NSData *data)
src->pos = 0; src->pos = 0;
} }
#if HAVE_QUANTIZEBUFFER #if HAVE_QUANTIZEBUFFER || HAVE_GIFQUANTIZEBUFFER
/* Function to write GIF to buffer */ /* Function to write GIF to buffer */
static int gs_gif_output(GifFileType *file, const GifByteType *buffer, int len) 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 - (NSData *) _GIFRepresentationWithProperties: (NSDictionary *) properties
errorMessage: (NSString **)errorMsg errorMessage: (NSString **)errorMsg
{ {
#if HAVE_QUANTIZEBUFFER #if HAVE_QUANTIZEBUFFER || HAVE_GIFQUANTIZEBUFFER
NSMutableData * GIFRep = nil; // our return value NSMutableData * GIFRep = nil; // our return value
GifFileType * GIFFile = NULL; GifFileType * GIFFile = NULL;
GifByteType * rgbPlanes = NULL; // giflib needs planar RGB 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."); SET_ERROR_MSG(@"GIFRepresentation: malloc out of memory.");
free(rgbPlanes); free(rgbPlanes);
} }
#if GIFLIB_MAJOR >= 5
status = GifQuantizeBuffer(width, height, &colorMapSize,
redPlane, greenPlane, bluePlane,
GIFImage, GIFColorMap->Colors);
#else
status = QuantizeBuffer(width, height, &colorMapSize, status = QuantizeBuffer(width, height, &colorMapSize,
redPlane, greenPlane, bluePlane, redPlane, greenPlane, bluePlane,
GIFImage, GIFColorMap->Colors); GIFImage, GIFColorMap->Colors);
#endif
if (status == GIF_ERROR) if (status == GIF_ERROR)
{ {
free(GIFImage); free(GIFImage);

15
configure vendored
View file

@ -5424,8 +5424,8 @@ $as_echo "$as_me: -gui will be linked against -lX11 to support libgif images" >&
fi fi
fi fi
# QuantizeBuffer was removed from giflib in version 4.2 but is supposed # QuantizeBuffer was removed from giflib in version 4.2 but was reintroduced
# to make its return in the next release. If this function is not present # in the 5.0 release with a new name. If this function is not present
# we disable the support to create gif image representations. # we disable the support to create gif image representations.
for ac_func in QuantizeBuffer for ac_func in QuantizeBuffer
do : do :
@ -5438,6 +5438,17 @@ _ACEOF
fi fi
done 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 # Find ImageMagick

View file

@ -355,10 +355,11 @@ if test "$have_ungif" = no -o "${enable_libgif}" = yes; then
fi fi
fi fi
# QuantizeBuffer was removed from giflib in version 4.2 but is supposed # QuantizeBuffer was removed from giflib in version 4.2 but was reintroduced
# to make its return in the next release. If this function is not present # in the 5.0 release with a new name. If this function is not present
# we disable the support to create gif image representations. # we disable the support to create gif image representations.
AC_CHECK_FUNCS(QuantizeBuffer) AC_CHECK_FUNCS(QuantizeBuffer)
AC_CHECK_FUNCS(GifQuantizeBuffer)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Find ImageMagick # Find ImageMagick