Author: rharabien
Date: Sun Mar 27 23:19:56 2011
New Revision: 51178
URL:
http://svn.reactos.org/svn/reactos?rev=51178&view=rev
Log:
[USER32]
Don't fail if FillRect is called without brush. Fixes user32:uitools winetest
Modified:
trunk/reactos/dll/win32/user32/windows/draw.c
Modified: trunk/reactos/dll/win32/user32/windows/draw.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/d…
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/draw.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/draw.c [iso-8859-1] Sun Mar 27 23:19:56 2011
@@ -1565,19 +1565,28 @@
FillRect(HDC hDC, CONST RECT *lprc, HBRUSH hbr)
{
HBRUSH prevhbr;
-
- if (hbr <= (HBRUSH)(COLOR_MENUBAR + 1))
- {
- hbr = GetSysColorBrush(PtrToUlong(hbr) - 1);
- }
- if ((prevhbr = SelectObject(hDC, hbr)) == NULL)
- {
- return FALSE;
- }
- PatBlt(hDC, lprc->left, lprc->top, lprc->right - lprc->left,
- lprc->bottom - lprc->top, PATCOPY);
- SelectObject(hDC, prevhbr);
- return TRUE;
+ BOOL Ret;
+
+ /* Select brush if specified */
+ if (hbr)
+ {
+ /* Handle system colors */
+ if (hbr <= (HBRUSH)(COLOR_MENUBAR + 1))
+ hbr = GetSysColorBrush(PtrToUlong(hbr) - 1);
+
+ prevhbr = SelectObject(hDC, hbr);
+ if (prevhbr == NULL)
+ return (INT)FALSE;
+ }
+
+ Ret = PatBlt(hDC, lprc->left, lprc->top, lprc->right - lprc->left,
+ lprc->bottom - lprc->top, PATCOPY);
+
+ /* Select old brush */
+ if (hbr)
+ SelectObject(hDC, prevhbr);
+
+ return (INT)Ret;
}
/*