two small fixes

This commit is contained in:
John Cupitt 2019-02-14 10:13:17 +00:00
parent 617d910379
commit b02a50aaed

View File

@ -50,8 +50,8 @@
*/ */
/* /*
*/
#define VIPS_DEBUG #define VIPS_DEBUG
*/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>
@ -322,15 +322,13 @@ vips_foreign_load_gif_dispose( GObject *gobject )
static VipsForeignFlags static VipsForeignFlags
vips_foreign_load_gif_get_flags_filename( const char *filename ) vips_foreign_load_gif_get_flags_filename( const char *filename )
{ {
/* We can render any part of the image on demand. return( VIPS_FOREIGN_SEQUENTIAL );
*/
return( VIPS_FOREIGN_PARTIAL );
} }
static VipsForeignFlags static VipsForeignFlags
vips_foreign_load_gif_get_flags( VipsForeignLoad *load ) vips_foreign_load_gif_get_flags( VipsForeignLoad *load )
{ {
return( VIPS_FOREIGN_PARTIAL ); return( VIPS_FOREIGN_SEQUENTIAL );
} }
static gboolean static gboolean
@ -730,6 +728,8 @@ vips_foreign_load_gif_render( VipsForeignLoadGif *gif )
{ {
GifFileType *file = gif->file; GifFileType *file = gif->file;
printf( "vips_foreign_load_gif_render:\n" );
if( file->Image.Interlace ) { if( file->Image.Interlace ) {
int i; int i;
@ -830,6 +830,8 @@ vips_foreign_load_gif_next_page( VipsForeignLoadGif *gif )
GifRecordType record; GifRecordType record;
gboolean have_read_frame; gboolean have_read_frame;
printf( "vips_foreign_load_gif_next_page:\n" );
have_read_frame = FALSE; have_read_frame = FALSE;
do { do {
if( DGifGetRecordType( gif->file, &record ) == GIF_ERROR ) { if( DGifGetRecordType( gif->file, &record ) == GIF_ERROR ) {
@ -893,12 +895,17 @@ vips_foreign_load_gif_generate( VipsRegion *or,
int line = r->top % gif->file->SHeight; int line = r->top % gif->file->SHeight;
#ifdef DEBUG_VERBOSE #ifdef DEBUG_VERBOSE
printf( "vips_foreign_load_gif_generate: line %d\n", r->top );
#endif /*DEBUG_VERBOSE*/ #endif /*DEBUG_VERBOSE*/
printf( "vips_foreign_load_gif_generate: line %d\n", r->top );
g_assert( r->height == 1 ); g_assert( r->height == 1 );
g_assert( line >= 0 && lines < gif->frame->Ysize );
g_assert( page >= 0 && page < gif->n_pages );
while( gif->current_page < page ) { /* current_page == 0 means we've not loaded any pages yet. So we need
* to have loaded the page beyond the page we want.
*/
while( gif->current_page <= page ) {
if( vips_foreign_load_gif_next_page( gif ) ) if( vips_foreign_load_gif_next_page( gif ) )
return( -1 ); return( -1 );