Well, I tested it on OS 4 and you are right, it does not work, not matter what I do.
I changed your code like so:
/* Attempt to test flood fill */
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/graphics.h>
#include <proto/intuition.h>
#include <stdlib.h>
int main (int argc,char **argv)
{
struct Window *win;
win = OpenWindowTags(NULL,
WA_InnerWidth, 200,
WA_InnerHeight, 200,
WA_IDCMP, IDCMP_CLOSEWINDOW | IDCMP_VANILLAKEY,
WA_Title, "test flood",
WA_Flags, WFLG_DRAGBAR | WFLG_CLOSEGADGET | WFLG_NOCAREREFRESH | WFLG_ACTIVATE,
TAG_DONE);
if(win)
{
WORD centreX, centreY;
struct TmpRas tr;
UBYTE *buf;
short w,h;
struct Message *msg;
short mode = argc > 1 ? atoi(argv[1]) : 1;
Printf ("mode = %ld\n",mode);
centreX = (win->Width + win->BorderLeft - win->BorderRight) / 2;
centreY = (win->Height + win->BorderTop - win->BorderBottom) / 2;
SetAPen(win->RPort, 1);
DrawEllipse(win->RPort, centreX, centreY, 25 ,25);
w = GetBitMapAttr (win->RPort->BitMap,BMA_WIDTH);
h = GetBitMapAttr (win->RPort->BitMap,BMA_HEIGHT);
buf = AllocRaster(w,h);
if(buf)
{
InitTmpRas(&tr, buf, RASSIZE(w,h));
win->RPort->TmpRas = &tr;
SetAPen (win->RPort,2);
SetOutlinePen (win->RPort,1);
Flood(win->RPort, mode, centreX, centreY);
win->RPort->TmpRas = NULL;
FreeRaster(buf,w,h);
}
Wait ((1 << win->UserPort->mp_SigBit) | SIGBREAKF_CTRL_C);
while ((msg = GetMsg (win->UserPort)))
ReplyMsg (msg);
CloseWindow(win);
}
return 0;
}
It works well on WinUAE in 3.1 and 3.9 with or without Picasso96. But on OS4 I get corrupted graphics. It does *something* but no flood fill.