test pdfload in te new desc tester

and fix a couple of small issues
This commit is contained in:
John Cupitt 2019-10-06 18:27:40 +01:00
parent 09b4ce6d9b
commit 3f1eb2c7dd
2 changed files with 14 additions and 9 deletions

View File

@ -185,7 +185,8 @@ vips_foreign_load_pdf_get_flags( VipsForeignLoad *load )
static int
vips_foreign_load_pdf_get_page( VipsForeignLoadPdf *pdf, int page_no )
{
if( pdf->current_page != page_no ) {
if( pdf->current_page != page_no ||
!pdf->page ) {
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( pdf );
VIPS_UNREF( pdf->page );
@ -356,24 +357,20 @@ vips_foreign_load_pdf_header( VipsForeignLoad *load )
VIPS_AREA( pdf->background )->n )) )
return( -1 );
pdf_class->close( pdf );
return( 0 );
}
static void
vips_foreign_load_pdf_minimise( VipsObject *object, VipsForeignLoadPdf *pdf )
{
VipsForeignLoadPdfClass *class = VIPS_FOREIGN_LOAD_PDF_GET_CLASS( pdf );
#ifdef DEBUG
printf( "vips_foreign_load_pdf_minimise: %p\n", pdf );
#endif /*DEBUG*/
/* In seq mode, we can shut down the input at the end of computation.
*/
if( VIPS_FOREIGN_LOAD( pdf )->access == VIPS_ACCESS_SEQUENTIAL ) {
VipsForeignLoadPdfClass *class =
VIPS_FOREIGN_LOAD_PDF_GET_CLASS( pdf );
class->close( pdf );
}
class->close( pdf );
}
static int
@ -459,6 +456,7 @@ static int
vips_foreign_load_pdf_load( VipsForeignLoad *load )
{
VipsForeignLoadPdf *pdf = VIPS_FOREIGN_LOAD_PDF( load );
VipsForeignLoadPdfClass *class = VIPS_FOREIGN_LOAD_PDF_GET_CLASS( pdf );
VipsImage **t = (VipsImage **)
vips_object_local_array( (VipsObject *) load, 2 );
@ -466,6 +464,9 @@ vips_foreign_load_pdf_load( VipsForeignLoad *load )
printf( "vips_foreign_load_pdf_load: %p\n", pdf );
#endif /*DEBUG*/
if( class->open( pdf ) )
return( -1 );
/* Read to this image, then cache to out, see below.
*/
t[0] = vips_image_new();

View File

@ -19,3 +19,7 @@ fi
if test_supported gifload; then
./test_descriptors $test_images/cogs.gif
fi
if test_supported pdfload; then
./test_descriptors $test_images/ISO_12233-reschart.pdf
fi