www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/25/22:40:23

From: marg AT okstate DOT edu (Carl Marg)
Newsgroups: comp.os.msdos.djgpp
Subject: Allegro problem
Date: Wed, 03 Mar 1999 19:48:10 GMT
Organization: Oklahoma State University
Lines: 31
Message-ID: <36dd9087.274233@news.okstate.edu>
NNTP-Posting-Host: x8b4e504a.dhcp.okstate.edu
Mime-Version: 1.0
X-Newsreader: Forte Agent 1.5/32.452
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I'm writing a fairly simple program for a school assignment.
All I have to do is implement a few simple graphics algorithms,
bresh. line drawing, ellipse, polygon, and a boundary fill.
I have all the other things working fine, but this function
seems to cause major problem.
The funny thing is it will seem to work right for a fraction of a
second, but a bit into the fill, it will crash.  Sometimes my computer
spontaneously reboots, sometimes I'll get a hard lock, or a GPF.
So, can anyone tell me why this code does this?
BTW, if I comment out 2 of the calls to boundfill in boundfill,
it will fill a quarter of the area without a problem...

void boundfill(int x, int y, int fill, int bound)
{
   int cur;
   cur=getpixel(screen,x,y);
   if ((cur!=bound) && (cur!=fill))
   {
      putpixel(screen,x,y,fill);
      boundfill(x+1,y,fill,bound);
      boundfill(x-1,y,fill,bound);
      boundfill(x,y+1,fill,bound);
      boundfill(x,y-1,fill,bound);
   } //if
}


this is really bugging me,
I'd appreciate any suggestions,

Carl

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019