PRB: _floodfill() May Not Stop at the Correct Boundary Color

ID Number: Q66783

6.00 6.00a 6.00ax

MS-DOS

buglist6.00 buglist6.00a buglist6.00ax fixlist7.00

Summary:

SYMPTOMS

In Microsoft C versions 6.0, 6.0a, and 6.0ax, the _floodfill()

function takes a parameter that specifies the color of the boundary

at which flood-filling should stop. In certain cases, the filling

will stop at an incorrect boundary.

STATUS

Microsoft has confirmed this to be a problem in C versions 6.0,

6.0a, and 6.0ax and in QuickC versions 2.0, 2.01, 2.5, and 2.51

(buglist2.00, buglist2.01, buglist2.50, and buglist2.51). This

problem was corrected in C/C++ version 7.0.

More Information:

A situation where _floodfill() may fill incorrectly is if a screen

consists of two horizontal lines of the same color with one line near

the top of the screen and the other near the bottom. The problem

occurs if _floodfill() is then called with a start position at the

middle of the screen between these lines and the filling color is the

same as the lines, while the boundary color specified is something

else.

Because the fill color is different from the boundary color, the

filling should cover the entire screen because there is no boundary to

stop it. In actuality, however, the filling stops when it reaches the

horizontal lines. The sample program below demonstrates this problem.

Sample Code

-----------

#include <graph.h>

#include <conio.h>

void main(void)

{

_setvideomode( _ERESCOLOR );

_setcolor( 5 );

_moveto( 0, 100 );

_lineto( 640, 100 );

_moveto( 0, 300 );

_lineto( 640, 300 );

_floodfill( 320, 200, 7 );

getch();

_setvideomode( _DEFAULTMODE );

}