fix logic for page_height and n_pages getters

This commit is contained in:
John Cupitt 2019-08-09 15:46:56 +01:00
parent 8b1817ddd0
commit ccea473b0e

View File

@ -796,15 +796,15 @@ vips_image_get_page_height( VipsImage *image )
{ {
int page_height; int page_height;
if( !vips_image_get_typeof( image, VIPS_META_PAGE_HEIGHT ) || if( vips_image_get_typeof( image, VIPS_META_PAGE_HEIGHT ) &&
vips_image_get_int( image, VIPS_META_PAGE_HEIGHT, !vips_image_get_int( image, VIPS_META_PAGE_HEIGHT,
&page_height ) || &page_height ) &&
page_height <= 0 || page_height > 0 &&
page_height > image->Ysize || page_height < image->Ysize &&
image->Ysize % page_height != 0 ) image->Ysize % page_height == 0 )
page_height = image->Ysize;
return( page_height ); return( page_height );
return( image->Ysize );
} }
/** /**
@ -824,13 +824,13 @@ vips_image_get_n_pages( VipsImage *image )
{ {
int n_pages; int n_pages;
if( !vips_image_get_typeof( image, VIPS_META_N_PAGES ) || if( vips_image_get_typeof( image, VIPS_META_N_PAGES ) &&
vips_image_get_int( image, VIPS_META_N_PAGES, &n_pages ) || !vips_image_get_int( image, VIPS_META_N_PAGES, &n_pages ) &&
n_pages < 2 || n_pages > 1 &&
n_pages > 1000 ) n_pages < 1000 )
n_pages = 1;
return( n_pages ); return( n_pages );
return( 1 );
} }
/** /**