fix stray jp2k save message

we had a stray "valid clipped" message
This commit is contained in:
John Cupitt 2022-06-23 10:31:36 +01:00
parent 1c600c83b6
commit e81f7f1fab
1 changed files with 24 additions and 17 deletions

View File

@ -518,25 +518,21 @@ vips_foreign_save_jp2k_write_block( VipsRegion *region, VipsRect *area,
#endif /*DEBUG_VERBOSE*/ #endif /*DEBUG_VERBOSE*/
for(;;) { for(;;) {
VipsRect *to = &jp2k->strip->valid;
VipsRect hit; VipsRect hit;
int y; VipsRect new;
VipsRect strip_position; VipsRect image;
/* The intersection with the strip is the fresh pixels we /* The intersection with the strip is the fresh pixels we
* have. * have.
*/ */
vips_rect_intersectrect( area, &(jp2k->strip->valid), &hit ); vips_rect_intersectrect( area, to, &hit );
/* Copy the new pixels into the strip. /* Write the new pixels into the strip.
*/ */
for( y = 0; y < hit.height; y++ ) { vips_region_copy( region, jp2k->strip,
VipsPel *p = VIPS_REGION_ADDR( region, &hit, hit.left, hit.top );
0, hit.top + y );
VipsPel *q = VIPS_REGION_ADDR( jp2k->strip,
0, hit.top + y );
memcpy( q, p, VIPS_IMAGE_SIZEOF_LINE( region->im ) );
}
/* Have we failed to reach the bottom of the strip? We must /* Have we failed to reach the bottom of the strip? We must
* have run out of fresh pixels, so we are done. * have run out of fresh pixels, so we are done.
@ -551,11 +547,22 @@ vips_foreign_save_jp2k_write_block( VipsRegion *region, VipsRect *area,
if( vips_foreign_save_jp2k_write_tiles( jp2k ) ) if( vips_foreign_save_jp2k_write_tiles( jp2k ) )
return( -1 ); return( -1 );
strip_position.left = 0; new.left = 0;
strip_position.top = jp2k->strip->valid.top + jp2k->tile_height; new.top = jp2k->strip->valid.top + jp2k->tile_height;
strip_position.width = save->ready->Xsize; new.width = save->ready->Xsize;
strip_position.height = jp2k->tile_height; new.height = jp2k->tile_height;
if( vips_region_buffer( jp2k->strip, &strip_position ) ) image.left = 0;
image.top = 0;
image.width = save->ready->Xsize;
image.height = save->ready->Ysize;
vips_rect_intersectrect( &new, &image, &new);
/* End of image?
*/
if( vips_rect_isempty( &new ) )
break;
if( vips_region_buffer( jp2k->strip, &new ) )
return( -1 ); return( -1 );
} }