From 75fff0653f16addeabaff22522eba257c73f9e3d Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Thu, 23 Aug 2007 19:21:16 +0000 Subject: [PATCH] remove redirect of CreatePolyPolygonRgn@16 and implement own stub for it, it is hacked, it should doing, return (HRGN) NtGdiPolyPolyDraw(fnPolyFillMode, lppt, lpPolyCounts, nCount, 6 ); remove redirect of CreatePolygonRgn@12 and implement own stub for it, it is hacked, it should doing return NtGdiPolyPolyDraw(fnPolyFillMode,lppt,cPoints,1,6); remove redirect of CreateRectRgn@16 and implement own stub for it, some part need be done in user mode Fix CreateRectRgnIndirect it call now on CreateRectRgn for some part need be done in user mode, and it crash if NULL comes in as param, like windows does. Fix CreatePenIndirect ir call now on CreatePen for some stuff need be done in user mode. Add comment to CreatePen it need be fix. svn path=/trunk/; revision=28484 --- reactos/dll/win32/gdi32/gdi32.def | 12 +++--- reactos/dll/win32/gdi32/objects/pen.c | 16 ++----- reactos/dll/win32/gdi32/objects/region.c | 53 +++++++++++++++--------- 3 files changed, 44 insertions(+), 37 deletions(-) diff --git a/reactos/dll/win32/gdi32/gdi32.def b/reactos/dll/win32/gdi32/gdi32.def index a4065da87bb..1e1272e65ea 100644 --- a/reactos/dll/win32/gdi32/gdi32.def +++ b/reactos/dll/win32/gdi32/gdi32.def @@ -76,19 +76,19 @@ CreateMetaFileA@4 CreateMetaFileW@4 CreatePalette@4 CreatePatternBrush@4 - -ClearBitmapAttributes@8 -ClearBrushAttributes@8 CreatePen@12 CreatePenIndirect@4 -CreatePolyPolygonRgn@16=NtGdiCreatePolyPolygonRgn@16 -CreatePolygonRgn@12=NtGdiCreatePolygonRgn@12 -CreateRectRgn@16=NtGdiCreateRectRgn@16 +CreatePolyPolygonRgn@16 +CreatePolygonRgn@12 +CreateRectRgn@16 CreateRectRgnIndirect@4 CreateRoundRectRgn@24=NtGdiCreateRoundRectRgn@24 CreateScalableFontResourceA@16 CreateScalableFontResourceW@16 CreateSolidBrush@4 + +ClearBitmapAttributes@8 +ClearBrushAttributes@8 DPtoLP@12 DeleteColorSpace@4 DeleteDC@4 diff --git a/reactos/dll/win32/gdi32/objects/pen.c b/reactos/dll/win32/gdi32/objects/pen.c index 62193c6fab3..f10ef062336 100644 --- a/reactos/dll/win32/gdi32/objects/pen.c +++ b/reactos/dll/win32/gdi32/objects/pen.c @@ -8,19 +8,10 @@ */ HPEN WINAPI CreatePenIndirect( - const LOGPEN *plgpn) + const LOGPEN *lplgpn) { - if (plgpn) - { - return NtGdiCreatePen(plgpn->lopnStyle, - /* FIXME: MSDN says in docs for LOGPEN: - "If the pointer member is NULL, the pen is one pixel - wide on raster devices." Do we need to handle this? */ - plgpn->lopnWidth.x, - plgpn->lopnColor, - NULL); - } - return NULL; + /* Note same behoir as Windows 2000/XP/VISTA, they do not care if plgpn is NULLī, it will crash */ + return CreatePen(lplgpn->lopnStyle, lplgpn->lopnWidth.x, lplgpn->lopnColor); } /* @@ -32,6 +23,7 @@ CreatePen( int nWidth, COLORREF crColor) { + /* FIXME Some part need be done in user mode */ return NtGdiCreatePen(nPenStyle, nWidth, crColor, NULL); } diff --git a/reactos/dll/win32/gdi32/objects/region.c b/reactos/dll/win32/gdi32/objects/region.c index 1bc24a8c025..5f47f32806a 100644 --- a/reactos/dll/win32/gdi32/objects/region.c +++ b/reactos/dll/win32/gdi32/objects/region.c @@ -24,30 +24,41 @@ GetClipRgn( HRGN hrgn ) { - return NtGdiGetRandomRgn(hdc, hrgn, 1); + return NtGdiGetRandomRgn(hdc, hrgn, 1); } HRGN WINAPI -CreatePolygonRgn( const POINT* Point, int Count, int Mode) +CreatePolygonRgn( const POINT* lppt, int cPoints, int fnPolyFillMode) { - return CreatePolyPolygonRgn(Point, (const INT*)&Count, 1, Mode); + /* FIXME NtGdiPolyPolyDraw */ +#if 0 + return NtGdiPolyPolyDraw(fnPolyFillMode,lppt,cPoints,1,6); +#else + return CreatePolyPolygonRgn(lppt, (const INT*)&cPoints, 1, fnPolyFillMode); +#endif } HRGN WINAPI -CreatePolyPolygonRgn( const POINT* Point, - const INT* Count, - int inPolygons, - int Mode) +CreatePolyPolygonRgn( const POINT* lppt, + const INT* lpPolyCounts, + int nCount, + int fnPolyFillMode) { - return (HRGN) NtGdiPolyPolyDraw( (HDC) Mode, - (PPOINT) Point, - (PULONG) Count, - (ULONG) inPolygons, + /* FIXME NtGdiPolyPolyDraw */ +#if 0 + return (HRGN) NtGdiPolyPolyDraw( (HDC) fnPolyFillMode, + (PPOINT) lppt, + (PULONG) lpPolyCounts, + (ULONG) nCount, GdiPolyPolyRgn ); +#else + return NtGdiCreatePolyPolygonRgn( (PPOINT)lppt, (PINT)lpPolyCounts, nCount, fnPolyFillMode); +#endif + } HRGN @@ -61,18 +72,22 @@ CreateEllipticRgnIndirect( } +HRGN +WINAPI +CreateRectRgn(int x1, int y1, int x2,int y2) +{ + /* FIXME Some part need be done in user mode */ + return NtGdiCreateRectRgn(x1,y1,x2,y2); +} + + HRGN WINAPI CreateRectRgnIndirect( const RECT *prc ) { - if (prc) - { - return NtGdiCreateRectRgn(prc->left, - prc->top, - prc->right, - prc->bottom); - } - return NULL; + /* Notes if prc is NULL it will crash on All Windows NT I checked 2000/XP/VISTA */ + return CreateRectRgn(prc->left, prc->top, prc->right, prc->bottom); + }