Author: fireball
Date: Tue Aug 4 22:39:20 2009
New Revision: 42392
URL:
http://svn.reactos.org/svn/reactos?rev=42392&view=rev
Log:
- Add preliminary support for pattern pens.
- Create null brushes when a DC is created.
Modified:
branches/arwinss/reactos/subsystems/win32/win32k/eng/engblt.c
branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c
branches/arwinss/reactos/subsystems/win32/win32k/gre/brushobj.c
branches/arwinss/reactos/subsystems/win32/win32k/include/brushobj.h
Modified: branches/arwinss/reactos/subsystems/win32/win32k/eng/engblt.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/eng/engblt.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/eng/engblt.c [iso-8859-1] Tue Aug 4
22:39:20 2009
@@ -71,7 +71,7 @@
{
pebo = CONTAINING_RECORD(pbo, BRUSHGDI, BrushObj);
- psurfPattern = pebo->pPattern;
+ psurfPattern = SURFACE_Lock(pebo->hbmPattern);
if (psurfPattern != NULL)
{
psoPattern = &psurfPattern->SurfObj;
@@ -208,7 +208,7 @@
if (ROP4_USES_PATTERN(Rop4) && pbo && pbo->iSolidColor ==
0xFFFFFFFF)
{
GdiBrush = CONTAINING_RECORD(pbo, BRUSHGDI, BrushObj);
- if ((psurfPattern = GdiBrush->pPattern))
+ if ((psurfPattern = SURFACE_Lock(GdiBrush->hbmPattern)))
{
BltInfo.PatternSurface = &psurfPattern->SurfObj;
}
@@ -226,10 +226,8 @@
Result =
DibFunctionsForBitmapFormat[OutputObj->iBitmapFormat].DIB_BitBlt(&BltInfo);
/* Pattern brush */
- if (psurfPattern != NULL)
- {
+ if (psurfPattern)
SURFACE_Unlock(psurfPattern);
- }
return Result;
}
@@ -265,7 +263,7 @@
if (ROP4_USES_PATTERN(Rop4) && pbo && pbo->iSolidColor ==
0xFFFFFFFF)
{
GdiBrush = CONTAINING_RECORD(pbo, BRUSHGDI, BrushObj);
- psurfPattern = GdiBrush->pPattern;
+ psurfPattern = SURFACE_Lock(GdiBrush->hbmPattern);
if (psurfPattern)
{
PatternSurface = &psurfPattern->SurfObj;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c [iso-8859-1] Tue Aug 4
22:39:20 2009
@@ -113,6 +113,10 @@
DPRINT("Creating a compatible with %x DC!\n", *pdev);
}
+ /* Create default NULL brushes */
+ pNewDC->pLineBrush = GreCreateNullBrush();
+ pNewDC->pFillBrush = GreCreateNullBrush();
+
if (dc->dwType == OBJ_MEMDC)
{
DPRINT("Creating a memory DC %x\n", hNewDC);
@@ -229,7 +233,6 @@
{
PDC pDC;
HGDIOBJ hBmpKern;
- PSURFACE pSurface;
/* Get a pointer to the DC */
pDC = DC_Lock(physDev);
@@ -270,8 +273,7 @@
DPRINT1("Trying to select an unknown bitmap %x to the DC %x!\n",
pLogBrush->lbHatch, physDev);
break;
}
- pSurface = SURFACE_Lock(hBmpKern);
- pDC->pFillBrush = GreCreatePatternBrush(pSurface);
+ pDC->pFillBrush = GreCreatePatternBrush(hBmpKern);
break;
case BS_DIBPATTERN:
@@ -293,34 +295,47 @@
{
PDC pDC;
+ /* Check parameters */
+ if (!pLogPen && !pExtLogPen) return;
+
/* Get a pointer to the DC */
pDC = DC_Lock(physDev);
DPRINT("RosGdiSelectPen(): dc %x, pen style %x, pen color %x\n", physDev,
pLogPen->lopnStyle, pLogPen->lopnColor);
-
- if (pExtLogPen)
- {
- DPRINT1("Ext pens aren't supported yet!");
- /* Release the object */
- DC_Unlock(pDC);
- return;
- }
/* Free previous brush */
if (pDC->pLineBrush) GreFreeBrush(pDC->pLineBrush);
/* Create the pen */
- pDC->pLineBrush =
- GreCreatePen(pLogPen->lopnStyle,
- pLogPen->lopnWidth.x,
- BS_SOLID,
- pLogPen->lopnColor,
- 0,
- 0,
- 0,
- NULL,
- 0,
- TRUE);
+ if (pLogPen)
+ {
+ pDC->pLineBrush =
+ GreCreatePen(pLogPen->lopnStyle,
+ pLogPen->lopnWidth.x,
+ BS_SOLID,
+ pLogPen->lopnColor,
+ 0,
+ 0,
+ 0,
+ NULL,
+ 0,
+ TRUE);
+ }
+ else
+ {
+ /* Extended pen information */
+ pDC->pLineBrush =
+ GreCreatePen(pExtLogPen->elpPenStyle,
+ pExtLogPen->elpWidth,
+ pExtLogPen->elpBrushStyle,
+ pExtLogPen->elpColor,
+ 0,
+ pExtLogPen->elpHatch,
+ pExtLogPen->elpNumEntries,
+ pExtLogPen->elpStyleEntry,
+ 0,
+ FALSE);
+ }
/* Release the object */
DC_Unlock(pDC);
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/brushobj.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gre/brushobj.c [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/brushobj.c [iso-8859-1] Tue Aug
4 22:39:20 2009
@@ -28,14 +28,16 @@
IN ULONG cjDIB,
IN BOOL bOldStylePen)
{
- /*static const BYTE PatternAlternate[] = {0x55, 0x55, 0x55};
+ static const BYTE PatternAlternate[] = {0x55, 0x55, 0x55};
static const BYTE PatternDash[] = {0xFF, 0xFF, 0xC0};
static const BYTE PatternDot[] = {0xE3, 0x8E, 0x38};
static const BYTE PatternDashDot[] = {0xFF, 0x81, 0xC0};
- static const BYTE PatternDashDotDot[] = {0xFF, 0x8E, 0x38};*/
+ static const BYTE PatternDashDotDot[] = {0xFF, 0x8E, 0x38};
PBRUSHGDI pBrush;
XLATEOBJ *pXlate;
HPALETTE hPalette;
+ SIZEL szPatSize;
+ PSURFACE pPattern;
/* Allocate memory for the object */
pBrush = EngAllocMem(FL_ZERO_MEMORY, sizeof(BRUSHGDI), TAG_BRUSHOBJ);
@@ -68,6 +70,9 @@
pBrush->flAttrs = bOldStylePen? GDIBRUSH_IS_OLDSTYLEPEN : GDIBRUSH_IS_PEN;
+ /* Initialize default pattern bitmap size */
+ szPatSize.cx = 1; szPatSize.cy = 1;
+
// If dwPenStyle is PS_COSMETIC, the width must be set to 1.
if ( !(bOldStylePen) && ((dwPenStyle & PS_TYPE_MASK) == PS_COSMETIC)
&& ( dwWidth != 1) )
{
@@ -94,32 +99,42 @@
case PS_ALTERNATE:
pBrush->flAttrs |= GDIBRUSH_IS_BITMAP;
- UNIMPLEMENTED;
- //pBrush->hbmPattern = IntGdiCreateBitmap(24, 1, 1, 1,
(LPBYTE)PatternAlternate);
+ pBrush->hbmPattern = GreCreateBitmap(szPatSize, 1, BMF_24BPP, BMF_NOZEROINIT,
NULL);
+ pPattern = SURFACE_Lock(pBrush->hbmPattern);
+ GreSetBitmapBits(pPattern, sizeof(PatternDashDotDot), (PVOID)PatternAlternate);
+ SURFACE_Unlock(pPattern);
break;
case PS_DOT:
pBrush->flAttrs |= GDIBRUSH_IS_BITMAP;
- UNIMPLEMENTED;
- //pBrush->hbmPattern = IntGdiCreateBitmap(24, 1, 1, 1, (LPBYTE)PatternDot);
+ pBrush->hbmPattern = GreCreateBitmap(szPatSize, 1, BMF_24BPP, BMF_NOZEROINIT,
NULL);
+ pPattern = SURFACE_Lock(pBrush->hbmPattern);
+ GreSetBitmapBits(pPattern, sizeof(PatternDashDotDot), (PVOID)PatternDot);
+ SURFACE_Unlock(pPattern);
break;
case PS_DASH:
pBrush->flAttrs |= GDIBRUSH_IS_BITMAP;
- UNIMPLEMENTED;
- //pBrush->hbmPattern = IntGdiCreateBitmap(24, 1, 1, 1, (LPBYTE)PatternDash);
+ pBrush->hbmPattern = GreCreateBitmap(szPatSize, 1, BMF_24BPP, BMF_NOZEROINIT,
NULL);
+ pPattern = SURFACE_Lock(pBrush->hbmPattern);
+ GreSetBitmapBits(pPattern, sizeof(PatternDashDotDot), (PVOID)PatternDash);
+ SURFACE_Unlock(pPattern);
break;
case PS_DASHDOT:
pBrush->flAttrs |= GDIBRUSH_IS_BITMAP;
- UNIMPLEMENTED;
- //pBrush->hbmPattern = IntGdiCreateBitmap(24, 1, 1, 1,
(LPBYTE)PatternDashDot);
+ pBrush->hbmPattern = GreCreateBitmap(szPatSize, 1, BMF_24BPP, BMF_NOZEROINIT,
NULL);
+ pPattern = SURFACE_Lock(pBrush->hbmPattern);
+ GreSetBitmapBits(pPattern, sizeof(PatternDashDotDot), (PVOID)PatternDashDot);
+ SURFACE_Unlock(pPattern);
break;
case PS_DASHDOTDOT:
pBrush->flAttrs |= GDIBRUSH_IS_BITMAP;
- UNIMPLEMENTED;
- //pBrush->hbmPattern = IntGdiCreateBitmap(24, 1, 1, 1,
(LPBYTE)PatternDashDotDot);
+ pBrush->hbmPattern = GreCreateBitmap(szPatSize, 1, BMF_24BPP, BMF_NOZEROINIT,
NULL);
+ pPattern = SURFACE_Lock(pBrush->hbmPattern);
+ GreSetBitmapBits(pPattern, sizeof(PatternDashDotDot), (PVOID)PatternDashDotDot);
+ SURFACE_Unlock(pPattern);
break;
case PS_INSIDEFRAME:
@@ -183,7 +198,7 @@
PBRUSHGDI
NTAPI
-GreCreatePatternBrush(PSURFACE pSurface)
+GreCreatePatternBrush(HBITMAP hbmPattern)
{
PBRUSHGDI pBrush;
@@ -195,7 +210,7 @@
pBrush->flAttrs |= GDIBRUSH_IS_BITMAP;
/* Set bitmap */
- pBrush->pPattern = pSurface;
+ pBrush->hbmPattern = hbmPattern;
/* Set color to the reserved value */
pBrush->BrushObj.iSolidColor = 0xFFFFFFFF;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/brushobj.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/brushobj.h [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/brushobj.h [iso-8859-1] Tue
Aug 4 22:39:20 2009
@@ -32,7 +32,7 @@
ULONG ulPenStyle;
DWORD *pStyle;
ULONG dwStyleCount;
- PSURFACE pPattern;
+ HBITMAP hbmPattern;
XLATEOBJ *XlateObject;
} BRUSHGDI, *PBRUSHGDI;
@@ -53,7 +53,7 @@
GreCreateSolidBrush(COLORREF crColor);
PBRUSHGDI NTAPI
-GreCreatePatternBrush(PSURFACE pSurface);
+GreCreatePatternBrush(HBITMAP hbmPattern);
PBRUSHGDI NTAPI
GreCreateNullBrush();