fix dzsave/vips2tiff for some image sizes
we were not clipping new strip size against image size, see https://github.com/jcupitt/libvips/issues/300
This commit is contained in:
parent
5f3d4c7971
commit
3451766004
@ -1,4 +1,5 @@
|
||||
7/5/15 started 8.0.3
|
||||
- dzsave and tif pyr write could fail for some image dimensions, thanks Jonas
|
||||
|
||||
4/5/15 started 8.0.2
|
||||
- fix a refcount error in C++ wrapper, thanks huskier
|
||||
|
@ -9,7 +9,7 @@
|
||||
<bookinfo>
|
||||
<title>VIPS Reference Manual</title>
|
||||
<releaseinfo>
|
||||
For VIPS 8.0.2.
|
||||
For VIPS 8.0.3.
|
||||
The latest version of this documentation can be found on the
|
||||
<ulink role="online-location"
|
||||
url="http://www.vips.ecs.soton.ac.uk/index.php?title=Documentation">VIPS website</ulink>.
|
||||
|
@ -1330,8 +1330,10 @@ static int
|
||||
strip_arrived( Layer *layer )
|
||||
{
|
||||
VipsForeignSaveDz *dz = layer->dz;
|
||||
|
||||
VipsRect new_strip;
|
||||
VipsRect overlap;
|
||||
VipsRect image_area;
|
||||
|
||||
if( strip_save( layer ) )
|
||||
return( -1 );
|
||||
@ -1350,6 +1352,13 @@ strip_arrived( Layer *layer )
|
||||
new_strip.top = layer->y - dz->overlap;
|
||||
new_strip.width = layer->image->Xsize;
|
||||
new_strip.height = dz->tile_size + 2 * dz->overlap;
|
||||
|
||||
image_area.left = 0;
|
||||
image_area.top = 0;
|
||||
image_area.width = layer->image->Xsize;
|
||||
image_area.height = layer->image->Ysize;
|
||||
vips_rect_intersectrect( &new_strip, &image_area, &new_strip );
|
||||
|
||||
if( (new_strip.height & 1) == 1 )
|
||||
new_strip.height += 1;
|
||||
|
||||
@ -1375,14 +1384,16 @@ strip_arrived( Layer *layer )
|
||||
&overlap, overlap.left, overlap.top );
|
||||
}
|
||||
|
||||
if( vips_region_buffer( layer->strip, &new_strip ) )
|
||||
return( -1 );
|
||||
if( !vips_rect_isempty( &new_strip ) ) {
|
||||
if( vips_region_buffer( layer->strip, &new_strip ) )
|
||||
return( -1 );
|
||||
|
||||
/* And copy back again.
|
||||
*/
|
||||
if( !vips_rect_isempty( &overlap ) )
|
||||
vips_region_copy( layer->copy, layer->strip,
|
||||
&overlap, overlap.left, overlap.top );
|
||||
/* And copy back again.
|
||||
*/
|
||||
if( !vips_rect_isempty( &overlap ) )
|
||||
vips_region_copy( layer->copy, layer->strip,
|
||||
&overlap, overlap.left, overlap.top );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
@ -1236,6 +1236,7 @@ layer_strip_arrived( Layer *layer )
|
||||
int result;
|
||||
VipsRect new_strip;
|
||||
VipsRect overlap;
|
||||
VipsRect image_area;
|
||||
|
||||
if( write->tile )
|
||||
result = layer_write_tile( write, layer, layer->strip );
|
||||
@ -1245,7 +1246,7 @@ layer_strip_arrived( Layer *layer )
|
||||
return( -1 );
|
||||
|
||||
if( layer->below &&
|
||||
layer_strip_shrink( layer ) )
|
||||
layer_strip_shrink( layer ) )
|
||||
return( -1 );
|
||||
|
||||
/* Position our strip down the image.
|
||||
@ -1258,6 +1259,13 @@ layer_strip_arrived( Layer *layer )
|
||||
new_strip.top = layer->y;
|
||||
new_strip.width = layer->image->Xsize;
|
||||
new_strip.height = write->tileh;
|
||||
|
||||
image_area.left = 0;
|
||||
image_area.top = 0;
|
||||
image_area.width = layer->image->Xsize;
|
||||
image_area.height = layer->image->Ysize;
|
||||
vips_rect_intersectrect( &new_strip, &image_area, &new_strip );
|
||||
|
||||
if( (new_strip.height & 1) == 1 )
|
||||
new_strip.height += 1;
|
||||
|
||||
@ -1272,14 +1280,16 @@ layer_strip_arrived( Layer *layer )
|
||||
&overlap, overlap.left, overlap.top );
|
||||
}
|
||||
|
||||
if( vips_region_buffer( layer->strip, &new_strip ) )
|
||||
return( -1 );
|
||||
if( !vips_rect_isempty( &new_strip ) ) {
|
||||
if( vips_region_buffer( layer->strip, &new_strip ) )
|
||||
return( -1 );
|
||||
|
||||
/* And copy back again.
|
||||
*/
|
||||
if( !vips_rect_isempty( &overlap ) )
|
||||
vips_region_copy( layer->copy, layer->strip,
|
||||
&overlap, overlap.left, overlap.top );
|
||||
/* And copy back again.
|
||||
*/
|
||||
if( !vips_rect_isempty( &overlap ) )
|
||||
vips_region_copy( layer->copy, layer->strip,
|
||||
&overlap, overlap.left, overlap.top );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user