FIX: _floodfill() Fails When Y Coordinate is Zero
PSS ID Number: Q102368
Article last modified on 12-21-1993

7.00

MS-DOS


----------------------------------------------------------------------
The information in this article applies to:

 - Microsoft C/C++ Compiler for MS-DOS, version 7.0
----------------------------------------------------------------------

SYMPTOMS
========

An attempt to use the graphics library functions _floodfill() or
_floodfill_w() may cause incorrect characters to scroll across the
display or cause the application to crash in the MS-DOS operating
system. An attempt to run the same application in an MS-DOS window in
the Microsoft Windows operating system may fail and Windows may
generate the following message:

   This application has violated system integrity

Calling other functions that implicitly call one of the _floodfill()
functions may produce similar results.

CAUSE
=====

This problem is caused by a problem in the flood fill algorithm used
in the GRAPHICS.LIB graphics library. It should occur only when
filling begins at the physical Y coordinate 0. The error occurs when
the second parameter in the _floodfill() or _floodfill_w() call maps
to the physical coordinate 0.

RESOLUTION
==========

Modify your source code to start filling at a physical Y coordinate
other than 0. Any other physical Y coordinate allows the _floodfill()
functions to operate correctly.

STATUS
======

Microsoft has confirmed this to be a problem in C/C++ version 7.0.
This problem was corrected in C/C++ version 8.0 which is included with
Microsoft Visual C++ version 1.0 for Windows.

MORE INFORMATION
================

The following code example demonstrates this problem:

Sample Code 1
-------------

/*
 * Compiler options needed: None
 */

#include <graph.h>
#include <conio.h>

void main(void)
{¬
   _setvideomode(_ERESCOLOR);
   _setcolor(1);
   _floodfill(0, 0, 1);       // starts at physical Y location 0
   getch();
   _setvideomode(_DEFAULTMODE);
}

The following code example corrects this problem by changing the Y
value used for the initial fill coordinate.

Sample Code 2
-------------

/*
 * Compiler options needed: None
 */

#include <graph.h>
#include <conio.h>

void main(void)
{¬
   _setvideomode(_ERESCOLOR);
   _setcolor(1);
   _floodfill(0, 1, 1);       // starts at physical Y location 1
   getch();
   _setvideomode(_DEFAULTMODE);
}

Additional reference words: 7.00
KBCategory: Prg
KBSubCategory:

=============================================================================

Copyright Microsoft Corporation 1993.
