Author: jimtabor
Date: Sun Mar 27 05:40:30 2011
New Revision: 51170
URL:
http://svn.reactos.org/svn/reactos?rev=51170&view=rev
Log:
[GDI32]
- Finish object attribute support.
Modified:
trunk/reactos/dll/win32/gdi32/misc/misc.c
trunk/reactos/dll/win32/gdi32/objects/brush.c
trunk/reactos/dll/win32/gdi32/objects/pen.c
Modified: trunk/reactos/dll/win32/gdi32/misc/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/misc/misc.…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/misc/misc.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/misc/misc.c [iso-8859-1] Sun Mar 27 05:40:30 2011
@@ -275,7 +275,7 @@
FASTCALL
hGetPEBHandle(HANDLECACHETYPE Type, COLORREF cr)
{
- int Number;
+ int Number, Count, MaxNum, GdiType;
HANDLE Lock;
HGDIOBJ Handle = NULL;
@@ -287,26 +287,54 @@
Number = GdiHandleCache->ulNumHandles[Type];
- if ( Number && Number <= CACHE_REGION_ENTRIES )
- {
- if ( Type == hctRegionHandle)
- {
- PRGN_ATTR pRgn_Attr;
- HGDIOBJ *hPtr;
- hPtr = GdiHandleCache->Handle + CACHE_BRUSH_ENTRIES+CACHE_PEN_ENTRIES;
- Handle = hPtr[Number - 1];
-
- if (GdiGetHandleUserData( Handle, GDI_OBJECT_TYPE_REGION, (PVOID)
&pRgn_Attr))
- {
- if (pRgn_Attr->AttrFlags & ATTR_CACHED)
+ if (Type == hctBrushHandle)
+ {
+ Count = 0;
+ MaxNum = CACHE_BRUSH_ENTRIES;
+ GdiType = GDILoObjType_LO_BRUSH_TYPE;
+ }
+ else if (Type == hctPenHandle)
+ {
+ Count = CACHE_BRUSH_ENTRIES;
+ MaxNum = CACHE_PEN_ENTRIES;
+ GdiType = GDILoObjType_LO_PEN_TYPE;
+ }
+ else if (Type == hctRegionHandle)
+ {
+ Count = CACHE_BRUSH_ENTRIES+CACHE_PEN_ENTRIES;
+ MaxNum = CACHE_REGION_ENTRIES;
+ GdiType = GDILoObjType_LO_REGION_TYPE;
+ }
+ else // Font is not supported here.
+ {
+ return Handle;
+ }
+
+ if ( Number && Number <= MaxNum )
+ {
+ PBRUSH_ATTR pBrush_Attr;
+ HGDIOBJ *hPtr;
+ hPtr = GdiHandleCache->Handle + Count;
+ Handle = hPtr[Number - 1];
+
+ if (GdiGetHandleUserData( Handle, GdiType, (PVOID) &pBrush_Attr))
+ {
+ if (pBrush_Attr->AttrFlags & ATTR_CACHED)
+ {
+ DPRINT("Get Handle! Type %d Count %d PEB 0x%x\n", Type,
GdiHandleCache->ulNumHandles[Type], NtCurrentTeb()->ProcessEnvironmentBlock);
+ pBrush_Attr->AttrFlags &= ~ATTR_CACHED;
+ hPtr[Number - 1] = NULL;
+ GdiHandleCache->ulNumHandles[Type]--;
+ if ( Type == hctBrushHandle ) // Handle only brush.
+ {
+ if ( pBrush_Attr->lbColor != cr )
{
- DPRINT("Get Handle! Count %d PEB 0x%x\n",
GdiHandleCache->ulNumHandles[Type], NtCurrentTeb()->ProcessEnvironmentBlock);
- pRgn_Attr->AttrFlags &= ~ATTR_CACHED;
- hPtr[Number - 1] = NULL;
- GdiHandleCache->ulNumHandles[Type]--;
+ pBrush_Attr->lbColor = cr ;
+ pBrush_Attr->AttrFlags |= ATTR_NEW_COLOR;
}
- }
- }
+ }
+ }
+ }
}
(void)InterlockedExchangePointer((PVOID*)&GdiHandleCache->ulLock, Lock);
return Handle;
Modified: trunk/reactos/dll/win32/gdi32/objects/brush.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/br…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/brush.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/objects/brush.c [iso-8859-1] Sun Mar 27 05:40:30 2011
@@ -234,6 +234,8 @@
break;
case BS_SOLID:
+/* hBrush = hGetPEBHandle(hctBrushHandle, LogBrush->lbColor);
+ if (!hBrush)*/
hBrush = NtGdiCreateSolidBrush(LogBrush->lbColor, 0);
break;
Modified: trunk/reactos/dll/win32/gdi32/objects/pen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/gdi32/objects/pe…
==============================================================================
--- trunk/reactos/dll/win32/gdi32/objects/pen.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/gdi32/objects/pen.c [iso-8859-1] Sun Mar 27 05:40:30 2011
@@ -23,12 +23,34 @@
int nWidth,
COLORREF crColor)
{
- /* FIXME Some part need be done in user mode */
+/* HPEN hPen;
+ PBRUSH_ATTR Pen_Attr;
+*/
+ if (nPenStyle < PS_SOLID) nPenStyle = PS_SOLID;
if (nPenStyle > PS_DASHDOTDOT)
{
if (nPenStyle == PS_NULL) return GetStockObject(NULL_PEN);
if (nPenStyle != PS_INSIDEFRAME) nPenStyle = PS_SOLID;
}
+#if 0
+ hPen = hGetPEBHandle(hctPenHandle, nPenStyle);
+ if ( nWidth || nPenStyle || !hPen )
+ {
+ return NtGdiCreatePen(nPenStyle, nWidth, crColor, NULL);
+ }
+
+ if ((GdiGetHandleUserData( hPen, GDI_OBJECT_TYPE_PEN, (PVOID) &Pen_Attr))
&&
+ ( Pen_Attr != NULL ))
+ {
+ if ( Pen_Attr->lbColor != crColor)
+ {
+ Pen_Attr->lbColor = crColor;
+ Pen_Attr->AttrFlags |= ATTR_NEW_COLOR;
+ }
+ return hPen;
+ }
+ DeleteObject(hPen);
+#endif
return NtGdiCreatePen(nPenStyle, nWidth, crColor, NULL);
}