Merge remote-tracking branch 'origin/8.3'

This commit is contained in:
John Cupitt 2016-05-08 11:09:28 +01:00
commit 38fe936eee
4 changed files with 37 additions and 23 deletions

View File

@ -8,6 +8,7 @@
- add giflib5 support
- allow resize >1 on one axis, <1 on the other
- vips_resize has an optional @kernel argument
- fix giflib4 detection [felixbuenemann]
29/1/16 started 8.3
- add vips_reduce*() ... a fast path for affine downsize

7
TODO
View File

@ -1,5 +1,12 @@
- add more webp tests to py suite
- the gif tests in the suite sometimes fail with giflib5 because of an
uninitialized struct in giflib, see
https://sourceforge.net/p/giflib/bugs/94/
sadly ubuntu 16.04 only comes with giflib5, and giflib5 is currently broken
- I like the new int mask creator in reducev, can we use it in im_vips2imask()
as well?

View File

@ -631,26 +631,14 @@ if test "$GIFLIB_LIBS" = ""; then
INCLUDES="$GIFLIB_INCLUDES $INCLUDES"
# Try the standard search path first
AC_TRY_LINK([#include <gif_lib.h>],[
#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR > 4
EGifSetGifVersion(0,0);
#else
GifLastError();
#endif
], [
AC_TRY_LINK([#include <gif_lib.h>],[DGifSlurp(0)], [
GIFLIB_LIBS="-lgif"
], [
# giflib is not in the standard search path, try $prefix
LIBS="-L${prefix}/lib $LIBS"
AC_TRY_LINK([#include <gif_lib.h>],[
#if defined(GIFLIB_MAJOR) && GIFLIB_MAJOR > 4
EGifSetGifVersion(0,0);
#else
GifLastError();
#endif
], [
AC_TRY_LINK([#include <gif_lib.h>],[DGifSlurp(0)], [
GIFLIB_LIBS="-L${prefix}/lib -lgif"
], [
GIFLIB_LIBS=no

View File

@ -153,15 +153,33 @@ vips_foreign_load_gif_errstr( int error_code )
#endif /*HAVE_GIFLIB_5*/
}
static void
vips_foreign_load_gif_error_vips( VipsForeignLoadGif *gif, int error )
{
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( gif );
const char *message;
if( (message = vips_foreign_load_gif_errstr( error )) )
vips_error( class->nickname, "%s", message );
}
static void
vips_foreign_load_gif_error( VipsForeignLoadGif *gif )
{
int error;
error = 0;
#ifdef HAVE_GIFLIB_5
if( gif->file )
vips_foreign_load_gif_errstr( gif->file->Error );
error = gif->file->Error;
#else
vips_foreign_load_gif_errstr( GifLastError() );
error = GifLastError();
#endif
if( error )
vips_foreign_load_gif_error_vips( gif, error );
}
static void
@ -172,13 +190,13 @@ vips_foreign_load_gif_close( VipsForeignLoadGif *gif )
int error;
if( DGifCloseFile( gif->file, &error ) )
vips_foreign_load_gif_errstr( error );
vips_foreign_load_gif_error_vips( gif, error );
gif->file = NULL;
}
#else
if( gif->file ) {
if( DGifCloseFile( gif->file ) )
vips_foreign_load_gif_errstr( GifLastError() );
vips_foreign_load_gif_error_vips( gif, GifLastError() );
gif->file = NULL;
}
#endif
@ -194,13 +212,13 @@ vips_foreign_load_gif_open( VipsForeignLoadGif *gif, const char *filename )
int error;
if( !(gif->file = DGifOpenFileName( filename, &error )) ) {
vips_foreign_load_gif_errstr( error );
vips_foreign_load_gif_error_vips( gif, error );
return( -1 );
}
}
#else
if( !(gif->file = DGifOpenFileName( filename )) ) {
vips_foreign_load_gif_errstr( GifLastError() );
vips_foreign_load_gif_error_vips( gif, GifLastError() );
return( -1 );
}
#endif
@ -218,13 +236,13 @@ vips_foreign_load_gif_open_buffer( VipsForeignLoadGif *gif, InputFunc read_fn )
int error;
if( !(gif->file = DGifOpen( gif, read_fn, &error )) ) {
vips_foreign_load_gif_errstr( error );
vips_foreign_load_gif_error_vips( gif, error );
return( -1 );
}
}
#else
if( !(gif->file = DGifOpen( gif, read_fn )) ) {
vips_foreign_load_gif_errstr( GifLastError() );
vips_foreign_load_gif_error_vips( gif, GifLastError() );
return( -1 );
}
#endif
@ -435,7 +453,7 @@ vips_foreign_load_gif_load( VipsForeignLoad *load )
GifByteType *extension;
int ext_code;
if( DGifGetRecordType( gif->file, &record) == GIF_ERROR ) {
if( DGifGetRecordType( gif->file, &record ) == GIF_ERROR ) {
vips_foreign_load_gif_error( gif );
return( -1 );
}