flood fixes

This commit is contained in:
John Cupitt 2010-01-22 16:56:57 +00:00
parent a4cdba13b2
commit 3673808aa4
4 changed files with 26 additions and 2 deletions

View File

@ -21,6 +21,7 @@
- added "written" callbacks, used to implement write to non-vips formats
- "invalidate" is careful to keep images alive, so invalidate callbacks can do
im_close()
- flood_blob could loop if start point == ink
26/11/09 started 7.20.3
- updated en_GB.po translation

8
TODO
View File

@ -1,6 +1,14 @@
- how about im_invalidate_area()? we currently repaint the whole window on
every paint action in nip2 :-(
we'd need to have coordinate transforms broken out for this :-(
- should im_rwcheck() copy to disc?
maybe im_rwcheck_disc() copies to im->filename and maps that
rather awfward to do atm
- flood blob with ink == initial click loops
- we sill have the old flood-fill code there, move to deprecated

View File

@ -21,6 +21,8 @@
* 21/12/09
* - rewrite for a scanline based fill, about 4x faster!
* - allow separate test and mark images
* 22/1/10
* - flood_blob could loop if start point == ink
*/
/*
@ -501,6 +503,7 @@ int
im_flood_blob( IMAGE *im, int x, int y, PEL *ink, Rect *dout )
{
Flood *flood;
int j;
if( im_rwcheck( im ) ||
im_check_known_coded( "im_flood", im ) )
@ -513,6 +516,15 @@ im_flood_blob( IMAGE *im, int x, int y, PEL *ink, Rect *dout )
memcpy( flood->edge, IM_IMAGE_ADDR( im, x, y ), flood->tsize );
flood->equal = 1;
/* If edge == ink, we'll never stop :-( or rather, there's nothing to
* do.
*/
for( j = 0; j < flood->tsize; j++ )
if( flood->edge[j] != flood->ink[j] )
break;
if( j == flood->tsize )
return( 0 );
flood_all( flood, x, y );
flood_free( flood );

View File

@ -225,12 +225,15 @@ im_incheck( IMAGE *im )
break;
case IM_OPENOUT:
/* Close file down and reopen as input.
/* Close file down and reopen as input. I guess this will only
* work for vips files?
*/
#ifdef DEBUG_IO
printf( "im_incheck: auto-rewind of %s\n", im->filename );
#endif/*DEBUG_IO*/
if( im__close( im ) || im_openin( im ) ) {
if( im__close( im ) ||
im_openin( im ) ||
im_incheck( im ) ) {
im_error( "im_incheck",
_( "auto-rewind for %s failed" ),
im->filename );