Author: jimtabor Date: Mon May 12 02:31:15 2008 New Revision: 33461
URL: http://svn.reactos.org/svn/reactos?rev=33461&view=rev Log: Fixed ExtCreatePen and started CreatePen. Tested with wine gdi32 cross test. Isolated problem in win32k.
Modified: trunk/reactos/dll/win32/gdi32/objects/brush.c trunk/reactos/dll/win32/gdi32/objects/pen.c
Modified: trunk/reactos/dll/win32/gdi32/objects/brush.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/bru... ============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/brush.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/objects/brush.c [iso-8859-1] Mon May 12 02:31:15 2008 @@ -16,18 +16,83 @@ DWORD dwStyleCount, CONST DWORD *lpStyle) { - /* Call NTGDI (hack... like most of gdi32..sigh) */ - return NtGdiExtCreatePen(dwPenStyle, - dwWidth, - lplb->lbStyle, - lplb->lbColor, - lplb->lbHatch, - 0, - dwStyleCount, - (PULONG)lpStyle, - 0, - FALSE, - NULL); + PVOID lpPackedDIB = NULL; + HPEN hPen = NULL; + PBITMAPINFO pConvertedInfo = NULL; + UINT ConvertedInfoSize = 0, lbStyle; + BOOL Hit = FALSE; + + if ((dwPenStyle & PS_STYLE_MASK) == PS_USERSTYLE) + { + if(!lpStyle) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + } + else + { + if (dwStyleCount || lpStyle) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + } + + lbStyle = lplb->lbStyle; + + if (lplb->lbStyle > BS_HATCHED) + { + if (lplb->lbStyle == BS_PATTERN) + { + pConvertedInfo = (PBITMAPINFO)lplb->lbHatch; + if (!pConvertedInfo) return 0; + } + else + { + if ((lplb->lbStyle == BS_DIBPATTERN) || (lplb->lbStyle == BS_DIBPATTERNPT)) + { + if (lplb->lbStyle == BS_DIBPATTERN) + { + lbStyle = BS_DIBPATTERNPT; + lpPackedDIB = GlobalLock((HGLOBAL)lplb->lbHatch); + if (lpPackedDIB == NULL) return 0; + } + pConvertedInfo = ConvertBitmapInfo((PBITMAPINFO)lpPackedDIB, + lplb->lbColor, + &ConvertedInfoSize, + TRUE); + Hit = TRUE; // We converted DIB. + } + else + pConvertedInfo = (PBITMAPINFO)lpStyle; + } + } + else + pConvertedInfo = (PBITMAPINFO)lplb->lbHatch; + + + hPen = NtGdiExtCreatePen(dwPenStyle, + dwWidth, + lbStyle, + lplb->lbColor, + lplb->lbHatch, + (ULONG_PTR)pConvertedInfo, + dwStyleCount, + (PULONG)lpStyle, + ConvertedInfoSize, + FALSE, + NULL); + + + if (lplb->lbStyle == BS_DIBPATTERN) GlobalUnlock((HGLOBAL)lplb->lbHatch); + + if (Hit) + { + if ((PBITMAPINFO)lpPackedDIB != pConvertedInfo) + RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo); + } + return hPen; }
/*
Modified: trunk/reactos/dll/win32/gdi32/objects/pen.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/pen... ============================================================================== --- trunk/reactos/dll/win32/gdi32/objects/pen.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/gdi32/objects/pen.c [iso-8859-1] Mon May 12 02:31:15 2008 @@ -24,6 +24,11 @@ COLORREF crColor) { /* FIXME Some part need be done in user mode */ + if (nPenStyle > PS_DASHDOTDOT) + { + if (nPenStyle == PS_NULL) return GetStockObject(NULL_PEN); + if (nPenStyle != PS_INSIDEFRAME) nPenStyle = PS_SOLID; + } return NtGdiCreatePen(nPenStyle, nWidth, crColor, NULL); }