Author: jimtabor
Date: Wed Nov 26 14:44:41 2008
New Revision: 37677
URL:
http://svn.reactos.org/svn/reactos?rev=37677&view=rev
Log:
- Fixed stock object creation for pens. Now pass all but 25 pen cross tests. Please use
latest wine gdi tests.
Modified:
trunk/reactos/subsystems/win32/win32k/include/misc.h
trunk/reactos/subsystems/win32/win32k/objects/pen.c
trunk/reactos/subsystems/win32/win32k/objects/stockobj.c
Modified: trunk/reactos/subsystems/win32/win32k/include/misc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/misc.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/misc.h [iso-8859-1] Wed Nov 26 14:44:41
2008
@@ -30,7 +30,7 @@
#define W32PF_MANUALGUICHECK (0x02000000)
#define W32PF_CREATEDWINORDC (0x04000000)
-
+extern HGDIOBJ StockObjects[];
extern SHORT gusLanguageID;
SHORT FASTCALL IntGdiGetLanguageID();
Modified: trunk/reactos/subsystems/win32/win32k/objects/pen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/pen.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/pen.c [iso-8859-1] Wed Nov 26 14:44:41
2008
@@ -47,7 +47,7 @@
IN ULONG_PTR ulHatch,
DWORD dwStyleCount,
PULONG pStyle,
- IN ULONG cjDIB, // FIXME! We are shipping this too!
+ IN ULONG cjDIB,
IN BOOL bOldStylePen,
IN OPTIONAL HBRUSH hbrush)
{
@@ -61,6 +61,11 @@
dwWidth = abs(dwWidth);
+ if ( (dwPenStyle & PS_STYLE_MASK) == PS_NULL)
+ {
+ return StockObjects[NULL_PEN];
+ }
+
if (bOldStylePen)
{
PenObject = PENOBJ_AllocPenWithHandle();
@@ -79,7 +84,8 @@
hPen = PenObject->BaseObject.hHmgr;
// If nWidth is zero, the pen is a single pixel wide, regardless of the current
transformation.
- if ((bOldStylePen) && (!dwWidth) && (dwPenStyle & PS_STYLE_MASK)
!= PS_SOLID) dwWidth = 1;
+ if ((bOldStylePen) && (!dwWidth) && (dwPenStyle & PS_STYLE_MASK)
!= PS_SOLID)
+ dwWidth = 1;
PenObject->ptPenWidth.x = dwWidth;
PenObject->ptPenWidth.y = 0;
@@ -313,7 +319,7 @@
NULL,
0,
TRUE,
- 0);
+ hbr);
}
HPEN STDCALL
@@ -369,24 +375,36 @@
}
}
- if (dwPenStyle != PS_NULL)
- {
- hPen = IntGdiExtCreatePen(dwPenStyle,
+ if (ulBrushStyle == BS_PATTERN)
+ {
+ _SEH_TRY
+ {
+ ProbeForRead((PVOID)ulHatch, cjDIB, 1);
+ }
+ _SEH_HANDLE
+ {
+ Status = _SEH_GetExceptionCode();
+ }
+ _SEH_END
+ if(!NT_SUCCESS(Status))
+ {
+ SetLastNtError(Status);
+ if (pSafeStyle) ExFreePoolWithTag(pSafeStyle, TAG_PENSTYLES);
+ return 0;
+ }
+ }
+
+ hPen = IntGdiExtCreatePen(dwPenStyle,
ulWidth,
- ulBrushStyle,
+ ulBrushStyle,
ulColor,
- ulClientHatch,
+ ulClientHatch,
ulHatch,
- dwStyleCount,
- pSafeStyle,
- cjDIB,
- bOldStylePen,
- hBrush);
- }
- else
- {
- hPen = NtGdiGetStockObject(NULL_PEN);
- }
+ dwStyleCount,
+ pSafeStyle,
+ cjDIB,
+ bOldStylePen,
+ hBrush);
if (!hPen && pSafeStyle)
{
Modified: trunk/reactos/subsystems/win32/win32k/objects/stockobj.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ob…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/stockobj.c [iso-8859-1] Wed Nov 26
14:44:41 2008
@@ -107,7 +107,45 @@
{ 11, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"MS Sans Serif" };
//Bitstream Vera Sans
-static HGDIOBJ StockObjects[NB_STOCK_OBJECTS];
+HGDIOBJ StockObjects[NB_STOCK_OBJECTS];
+
+static
+HPEN
+FASTCALL
+IntCreateStockPen( DWORD dwPenStyle,
+ DWORD dwWidth,
+ ULONG ulBrushStyle,
+ ULONG ulColor)
+{
+ HPEN hPen;
+ PGDIBRUSHOBJ PenObject = PENOBJ_AllocPenWithHandle();
+
+ if ((!dwWidth) && (dwPenStyle & PS_STYLE_MASK) != PS_SOLID) dwWidth = 1;
+
+ PenObject->ptPenWidth.x = dwWidth;
+ PenObject->ptPenWidth.y = 0;
+ PenObject->ulPenStyle = dwPenStyle;
+ PenObject->BrushAttr.lbColor = ulColor;
+ PenObject->ulStyle = ulBrushStyle;
+ PenObject->hbmClient = (HANDLE)NULL;
+ PenObject->dwStyleCount = 0;
+ PenObject->pStyle = 0;
+ PenObject->flAttrs = GDIBRUSH_IS_OLDSTYLEPEN;
+
+ switch (dwPenStyle & PS_STYLE_MASK)
+ {
+ case PS_NULL:
+ PenObject->flAttrs |= GDIBRUSH_IS_NULL;
+ break;
+
+ case PS_SOLID:
+ PenObject->flAttrs |= GDIBRUSH_IS_SOLID;
+ break;
+ }
+ hPen = PenObject->BaseObject.hHmgr;
+ PENOBJ_UnlockPen(PenObject);
+ return hPen;
+}
/*!
* Creates a bunch of stock objects: brushes, pens, fonts.
@@ -129,10 +167,10 @@
StockObjects[BLACK_BRUSH] = IntGdiCreateSolidBrush(RGB(0,0,0));
StockObjects[NULL_BRUSH] = IntGdiCreateNullBrush();
- StockObjects[WHITE_PEN] = IntGdiExtCreatePen(WhitePen.lopnStyle, WhitePen.lopnWidth.x,
BS_SOLID, WhitePen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
- StockObjects[BLACK_PEN] = IntGdiExtCreatePen(BlackPen.lopnStyle, BlackPen.lopnWidth.x,
BS_SOLID, BlackPen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
- StockObjects[DC_PEN] = IntGdiExtCreatePen(BlackPen.lopnStyle, BlackPen.lopnWidth.x,
BS_SOLID, BlackPen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
- StockObjects[NULL_PEN] = IntGdiExtCreatePen(NullPen.lopnStyle, NullPen.lopnWidth.x,
BS_SOLID, NullPen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
+ StockObjects[WHITE_PEN] = IntCreateStockPen(WhitePen.lopnStyle, WhitePen.lopnWidth.x,
BS_SOLID, WhitePen.lopnColor);
+ StockObjects[BLACK_PEN] = IntCreateStockPen(BlackPen.lopnStyle, BlackPen.lopnWidth.x,
BS_SOLID, BlackPen.lopnColor);
+ StockObjects[DC_PEN] = IntCreateStockPen(BlackPen.lopnStyle, BlackPen.lopnWidth.x,
BS_SOLID, BlackPen.lopnColor);
+ StockObjects[NULL_PEN] = IntCreateStockPen(NullPen.lopnStyle, NullPen.lopnWidth.x,
BS_SOLID, NullPen.lopnColor);
StockObjects[20] = NULL; /* TODO: Unknown internal stock object */
StockObjects[DEFAULT_BITMAP] = IntGdiCreateBitmap(1, 1, 1, 1, NULL);
@@ -303,7 +341,7 @@
if(gpsi->SysColorPens[i] == NULL)
{
Pen.lopnColor = SysColors[i];
- gpsi->SysColorPens[i] = IntGdiExtCreatePen(Pen.lopnStyle, Pen.lopnWidth.x,
BS_SOLID, Pen.lopnColor, 0, 0, 0, NULL, 0, TRUE, NULL);
+ gpsi->SysColorPens[i] = IntCreateStockPen(Pen.lopnStyle, Pen.lopnWidth.x,
BS_SOLID, Pen.lopnColor);
if(gpsi->SysColorPens[i] != NULL)
{
GDIOBJ_ConvertToStockObj((HGDIOBJ*)&gpsi->SysColorPens[i]);