Author: gadamopoulos Date: Sun Jul 11 19:38:37 2010 New Revision: 48001
URL: http://svn.reactos.org/svn/reactos?rev=48001&view=rev Log: [win32k] - Implement RosGdiExtFloodFill
Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h
Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent... ============================================================================== --- branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] (original) +++ branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] Sun Jul 11 19:38:37 2010 @@ -347,8 +347,14 @@ BOOL CDECL RosDrv_ExtFloodFill( NTDRV_PDEVICE *physDev, INT x, INT y, COLORREF color, UINT fillType ) { - UNIMPLEMENTED; - return FALSE; + POINT ptPixel; + + /* Transform to device coordinates */ + ptPixel.x = x; ptPixel.y = y; + + LPtoDP(physDev->hUserDC, &ptPixel, 1); + + return RosGdiExtFloodFill(physDev->hKernelDC, ptPixel.x, ptPixel.y, color, fillType); }
BOOL CDECL RosDrv_ExtTextOut( NTDRV_PDEVICE *physDev, INT x, INT y, UINT flags,
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/misc.c [iso-8859-1] Sun Jul 11 19:38:37 2010 @@ -44,11 +44,32 @@ return 0; }
-BOOL APIENTRY RosGdiExtFloodFill( HDC physDev, INT x, INT y, COLORREF color, - UINT fillType ) -{ - UNIMPLEMENTED; - return FALSE; +BOOL APIENTRY RosGdiExtFloodFill( HDC hDC, INT XStart, INT YStart, COLORREF Color, + UINT FillType ) +{ + PDC dc; + BOOL Ret; + POINTL Pt; + + /* Get a pointer to the DC */ + dc = DC_LockDc(hDC); + if (!dc) + { + SetLastWin32Error(ERROR_INVALID_HANDLE); + return FALSE; + } + + /* Add DC origin */ + Pt.x = XStart + dc->rcVport.left + dc->rcDcRect.left; + Pt.y = YStart + dc->rcVport.top + dc->rcDcRect.top; + + /* Call GRE routine */ + Ret = GreFloodFill(dc, &Pt, Color, FillType); + + /* Release the object */ + DC_UnlockDc(dc); + return Ret; + }
BOOL APIENTRY RosGdiExtTextOut( HDC physDev, INT x, INT y, UINT flags,
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/gre/rect.c [iso-8859-1] Sun Jul 11 19:38:37 2010 @@ -9,6 +9,9 @@ /* INCLUDES ******************************************************************/
#include <win32k.h> +#include "object.h" +#include "handle.h" +#include "user.h" #define NDEBUG #include <debug.h>
@@ -141,6 +144,51 @@ } }
+BOOL NTAPI GreFloodFill( PDC dc, POINTL *Pt, COLORREF Color, UINT FillType ) +{ + SURFACE *psurf = NULL; + HPALETTE hpal; + PPALETTE ppal; + EXLATEOBJ exlo; + BOOL Ret = FALSE; + RECTL DestRect; + ULONG ConvColor; + rectangle_t r; + + Ret = point_in_region(dc->Clipping, Pt->x, Pt->y); + if (!Ret) + return FALSE; + + get_region_extents(dc->Clipping ,&r); + + DestRect.bottom = r.bottom; + DestRect.left = r.left; + DestRect.right = r.right; + DestRect.top = r.top; + + psurf = dc->dclevel.pSurface; + if (!psurf) + return FALSE; + + hpal = dc->dclevel.pSurface->hDIBPalette; + if (!hpal) hpal = pPrimarySurface->devinfo.hpalDefault; + ppal = PALETTE_ShareLockPalette(hpal); + + EXLATEOBJ_vInitialize(&exlo, &gpalRGB, ppal, 0, 0xffffff, 0); + + /* Only solid fills supported for now + * How to support pattern brushes and non standard surfaces (not offering dib functions): + * Version a (most likely slow): call DrvPatBlt for every pixel + * Version b: create a flood mask and let MaskBlt blit a masked brush */ + ConvColor = XLATEOBJ_iXlate(&exlo.xlo, Color); + Ret = DIB_XXBPP_FloodFillSolid(&psurf->SurfObj, &dc->eboFill.BrushObject, &DestRect, Pt, ConvColor, FillType); + + EXLATEOBJ_vCleanup(&exlo); + PALETTE_ShareUnlockPalette(ppal); + + return Ret; +} + BOOLEAN NTAPI RECTL_bIntersectRect(RECTL* prclDst, const RECTL* prcl1, const RECTL* prcl2)
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32... ============================================================================== --- branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h [iso-8859-1] (original) +++ branches/arwinss/reactos/subsystems/win32/win32k/include/gre.h [iso-8859-1] Sun Jul 11 19:38:37 2010 @@ -238,6 +238,9 @@ const POINT *ptPoints, INT count);
+BOOL NTAPI +GreFloodFill( PDC dc, POINTL *Pt, COLORREF Color, UINT FillType ); + BOOLEAN NTAPI RECTL_bIntersectRect(RECTL* prclDst, const RECTL* prcl1, const RECTL* prcl2);