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

7
TODO
View File

@ -1,5 +1,12 @@
- add more webp tests to py suite - 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() - I like the new int mask creator in reducev, can we use it in im_vips2imask()
as well? as well?

View File

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

View File

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