Author: gschneider
Date: Sat Aug 1 19:58:28 2009
New Revision: 42324
URL:
http://svn.reactos.org/svn/reactos?rev=42324&view=rev
Log:
FloodFill:
- Remove unneeded casts when setting the initial flood start, add debug print for flood
region location (silenced)
- Improve memory guards, free memory on error
Modified:
trunk/reactos/subsystems/win32/win32k/dib/floodfill.c
Modified: trunk/reactos/subsystems/win32/win32k/dib/floodfill.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/di…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/dib/floodfill.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/dib/floodfill.c [iso-8859-1] Sat Aug 1 19:58:28
2009
@@ -43,7 +43,8 @@
{
return FALSE;
}
- info->floodStart = (FLOODITEM*)((PBYTE)info->floodData + (width * height *
sizeof(FLOODITEM)));
+ info->floodStart = info->floodData + (width * height);
+ DPRINT("Allocated flood stack from %p to %p\n", info->floodData,
info->floodStart);
return TRUE;
}
static __inline VOID finalizeFlood(FLOODINFO *info)
@@ -118,15 +119,16 @@
removeItemFlood(&flood);
DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_PutPixel(DstSurf,
x, y, BrushColor);
+ if (flood.floodStart - 4 < flood.floodData)
+ {
+ DPRINT1("Can't finish flooding!\n");
+ finalizeFlood(&flood);
+ return FALSE;
+ }
addItemFlood(&flood, x, y + 1, DstSurf, DstRect, ConvColor, FALSE);
addItemFlood(&flood, x, y - 1, DstSurf, DstRect, ConvColor, FALSE);
addItemFlood(&flood, x + 1, y, DstSurf, DstRect, ConvColor, FALSE);
addItemFlood(&flood, x - 1, y, DstSurf, DstRect, ConvColor, FALSE);
- if (flood.floodStart <= flood.floodData)
- {
- DPRINT1("Couldn't finish flooding!\n");
- return FALSE;
- }
}
finalizeFlood(&flood);
}
@@ -150,15 +152,16 @@
removeItemFlood(&flood);
DibFunctionsForBitmapFormat[DstSurf->iBitmapFormat].DIB_PutPixel(DstSurf,
x, y, BrushColor);
+ if (flood.floodStart - 4 < flood.floodData)
+ {
+ DPRINT1("Can't finish flooding!\n");
+ finalizeFlood(&flood);
+ return FALSE;
+ }
addItemFlood(&flood, x, y + 1, DstSurf, DstRect, ConvColor, TRUE);
addItemFlood(&flood, x, y - 1, DstSurf, DstRect, ConvColor, TRUE);
addItemFlood(&flood, x + 1, y, DstSurf, DstRect, ConvColor, TRUE);
addItemFlood(&flood, x - 1, y, DstSurf, DstRect, ConvColor, TRUE);
- if (flood.floodStart <= flood.floodData)
- {
- DPRINT1("Couldn't finish flooding!\n");
- return FALSE;
- }
}
finalizeFlood(&flood);
}