remove @fail machinery from openslideload

since openslide load errors are fatal ... see

bb0a6643f9 (commitcomment-19838911)
This commit is contained in:
John Cupitt 2016-11-16 07:41:31 +00:00
parent 92c549e995
commit e213a9ded6
4 changed files with 23 additions and 31 deletions

View File

@ -8,7 +8,7 @@
- added vips_thumbnail() / vips_thumbnail_buffer()
- better >4gb detect for zip dzsave output [Felix Bünemann]
- all loaders have a @fail option, meaning fail on first warning, though it
only does anything for jpg, csv, openslide
only does anything for jpg and csv
- add vips_image_get_fields() to help bindings
11/11/16 started 8.4.4

View File

@ -47,8 +47,6 @@
* - do argb -> rgba for associated as well
* 27/1/15
* - unpremultiplication speedups for fully opaque/transparent pixels
* 11/7/16
* - just warn on tile read error
*/
/*
@ -115,10 +113,6 @@ typedef struct {
*/
int tile_width;
int tile_height;
/* Quit on warning.
*/
gboolean fail;
} ReadSlide;
int
@ -227,7 +221,7 @@ get_bounds( openslide_t *osr, VipsRect *rect )
static ReadSlide *
readslide_new( const char *filename, VipsImage *out,
int level, gboolean autocrop, const char *associated, gboolean fail )
int level, gboolean autocrop, const char *associated )
{
ReadSlide *rslide;
int64_t w, h;
@ -395,9 +389,9 @@ readslide_new( const char *filename, VipsImage *out,
int
vips__openslide_read_header( const char *filename, VipsImage *out,
int level, gboolean autocrop, char *associated, gboolean fail )
int level, gboolean autocrop, char *associated )
{
if( !readslide_new( filename, out, level, autocrop, associated, fail ) )
if( !readslide_new( filename, out, level, autocrop, associated ) )
return( -1 );
return( 0 );
@ -477,15 +471,18 @@ vips__openslide_generate( VipsRegion *out,
rslide->level,
r->width, r->height );
/* Only warn on error: we don't want to make the whole image unreadable
* because of one broken tile.
/* openslide errors are terminal. To support
* @fail we'd have to close the openslide_t and reopen, perhaps
* somehow marking this tile as unreadable.
*
* See
* https://github.com/jcupitt/libvips/commit/bb0a6643f94e69294e36d2b253f9bdd60c8c40ed#commitcomment-19838911
*/
error = openslide_get_error( rslide->osr );
if( error ) {
vips_warn( "openslide2vips",
vips_error( "openslide2vips",
_( "reading region: %s" ), error );
if( rslide->fail )
return( -1 );
return( -1 );
}
/* Since we are inside a cache, we know buf must be continuous.
@ -497,7 +494,7 @@ vips__openslide_generate( VipsRegion *out,
int
vips__openslide_read( const char *filename, VipsImage *out,
int level, gboolean autocrop, gboolean fail )
int level, gboolean autocrop )
{
ReadSlide *rslide;
VipsImage *raw;
@ -510,7 +507,7 @@ vips__openslide_read( const char *filename, VipsImage *out,
vips_object_local( out, raw );
if( !(rslide = readslide_new( filename, raw,
level, autocrop, NULL, fail )) )
level, autocrop, NULL )) )
return( -1 );
if( vips_image_generate( raw,
@ -539,7 +536,7 @@ vips__openslide_read( const char *filename, VipsImage *out,
int
vips__openslide_read_associated( const char *filename, VipsImage *out,
const char *associated, gboolean fail )
const char *associated )
{
ReadSlide *rslide;
VipsImage *raw;
@ -554,8 +551,7 @@ vips__openslide_read_associated( const char *filename, VipsImage *out,
raw = vips_image_new_memory();
vips_object_local( out, raw );
if( !(rslide = readslide_new( filename, raw,
0, FALSE, associated, fail )) ||
if( !(rslide = readslide_new( filename, raw, 0, FALSE, associated )) ||
vips_image_write_prepare( raw ) )
return( -1 );
buf = (uint32_t *) VIPS_IMAGE_ADDR( raw, 0, 0 );

View File

@ -114,7 +114,7 @@ vips_foreign_load_openslide_header( VipsForeignLoad *load )
if( vips__openslide_read_header( openslide->filename, load->out,
openslide->level, openslide->autocrop,
openslide->associated, load->fail ) )
openslide->associated ) )
return( -1 );
VIPS_SETSTR( load->out->filename, openslide->filename );
@ -129,13 +129,12 @@ vips_foreign_load_openslide_load( VipsForeignLoad *load )
if( !openslide->associated ) {
if( vips__openslide_read( openslide->filename, load->real,
openslide->level, openslide->autocrop, load->fail ) )
openslide->level, openslide->autocrop ) )
return( -1 );
}
else {
if( vips__openslide_read_associated(
openslide->filename, load->real,
openslide->associated, load->fail ) )
if( vips__openslide_read_associated( openslide->filename,
load->real, openslide->associated ) )
return( -1 );
}
@ -231,7 +230,6 @@ vips_foreign_load_openslide_init( VipsForeignLoadOpenslide *openslide )
* * @level: load this level
* * @associated: load this associated image
* * @autocrop: crop to image bounds
* * @fail: %gboolean, fail on warnings
*
* Read a virtual slide supported by the OpenSlide library into a VIPS image.
* OpenSlide supports images in Aperio, Hamamatsu, MIRAX, Sakura, Trestle,
@ -251,8 +249,6 @@ vips_foreign_load_openslide_init( VipsForeignLoadOpenslide *openslide )
*
* The output of this operator is always RGBA.
*
* Setting @fail to %TRUE makes the reader fail on any warnings.
*
* See also: vips_image_new_from_file().
*
* Returns: 0 on success, -1 on error.

View File

@ -217,11 +217,11 @@ int vips__webp_write_buffer( VipsImage *out, void **buf, size_t *len,
int vips__openslide_isslide( const char *filename );
int vips__openslide_read_header( const char *filename, VipsImage *out,
int level, gboolean autocrop, char *associated, gboolean fail );
int level, gboolean autocrop, char *associated );
int vips__openslide_read( const char *filename, VipsImage *out,
int level, gboolean autocrop, gboolean fail );
int level, gboolean autocrop );
int vips__openslide_read_associated( const char *filename, VipsImage *out,
const char *associated, gboolean fail );
const char *associated );
#ifdef __cplusplus
}