This commit is contained in:
John Cupitt 2010-11-04 11:59:59 +00:00
parent 5280510c59
commit 1c8b7e4795
1 changed files with 14 additions and 7 deletions

View File

@ -441,6 +441,11 @@ dilate_gen( REGION *or, void *vseq, void *a, void *b )
if( im_prepare( ir, &s ) ) if( im_prepare( ir, &s ) )
return( -1 ); return( -1 );
#ifdef DEBUG
printf( "dilate_gen: preparing %dx%d@%dx%d pixels\n",
s.width, s.height, s.left, s.top );
#endif /*DEBUG*/
/* Scan mask, building offsets we check when processing. Only do this /* Scan mask, building offsets we check when processing. Only do this
* if the bpl has changed since the previous im_prepare(). * if the bpl has changed since the previous im_prepare().
*/ */
@ -520,7 +525,8 @@ static int
erode_gen( REGION *or, void *vseq, void *a, void *b ) erode_gen( REGION *or, void *vseq, void *a, void *b )
{ {
MorphSequence *seq = (MorphSequence *) vseq; MorphSequence *seq = (MorphSequence *) vseq;
INTMASK *msk = (INTMASK *) b; Morph *morph = (Morph *) b;
INTMASK *mask = morph->mask;
REGION *ir = seq->ir; REGION *ir = seq->ir;
int *soff = seq->soff; int *soff = seq->soff;
@ -542,13 +548,14 @@ erode_gen( REGION *or, void *vseq, void *a, void *b )
* than the section of the output image we are producing. * than the section of the output image we are producing.
*/ */
s = *r; s = *r;
s.width += msk->xsize - 1; s.width += mask->xsize - 1;
s.height += msk->ysize - 1; s.height += mask->ysize - 1;
if( im_prepare( ir, &s ) ) if( im_prepare( ir, &s ) )
return( -1 ); return( -1 );
#ifdef DEBUG #ifdef DEBUG
printf( "erode_gen: preparing %dx%d pixels\n", s.width, s.height ); printf( "erode_gen: preparing %dx%d@%dx%d pixels\n",
s.width, s.height, s.left, s.top );
#endif /*DEBUG*/ #endif /*DEBUG*/
/* Scan mask, building offsets we check when processing. Only do this /* Scan mask, building offsets we check when processing. Only do this
@ -559,8 +566,8 @@ erode_gen( REGION *or, void *vseq, void *a, void *b )
seq->ss = 0; seq->ss = 0;
seq->cs = 0; seq->cs = 0;
for( t = msk->coeff, y = 0; y < msk->ysize; y++ ) for( t = mask->coeff, y = 0; y < mask->ysize; y++ )
for( x = 0; x < msk->xsize; x++, t++ ) for( x = 0; x < mask->xsize; x++, t++ )
switch( *t ) { switch( *t ) {
case 255: case 255:
soff[seq->ss++] = soff[seq->ss++] =
@ -673,7 +680,7 @@ morph_vector_gen( REGION *or, void *vseq, void *a, void *b )
return( -1 ); return( -1 );
#ifdef DEBUG #ifdef DEBUG
printf( "erode_gen: preparing %dx%d@%dx%d pixels\n", printf( "morph_vector_gen: preparing %dx%d@%dx%d pixels\n",
s.width, s.height, s.left, s.top ); s.width, s.height, s.left, s.top );
#endif /*DEBUG*/ #endif /*DEBUG*/