Author: tkreuzer
Date: Wed Feb 11 21:34:11 2015
New Revision: 66228
URL:
http://svn.reactos.org/svn/reactos?rev=66228&view=rev
Log:
[WIN32K]
Add minimal infrastructure for handling pattern brush masks.
Modified:
trunk/reactos/win32ss/gdi/eng/engbrush.c
trunk/reactos/win32ss/gdi/ntgdi/brush.h
Modified: trunk/reactos/win32ss/gdi/eng/engbrush.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/engbrush.c…
==============================================================================
--- trunk/reactos/win32ss/gdi/eng/engbrush.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/eng/engbrush.c [iso-8859-1] Wed Feb 11 21:34:11 2015
@@ -9,8 +9,7 @@
#include <win32k.h>
-#define NDEBUG
-#include <debug.h>
+DBG_DEFAULT_CHANNEL(GdiFont);
static const ULONG gaulHatchBrushes[HS_DDI_MAX][8] =
{
@@ -128,6 +127,7 @@
ASSERT(pebo->flattrs & BR_IS_SOLID);
/* Set the RGB color */
+ crColor &= 0xFFFFFF;
pebo->crRealize = crColor;
pebo->ulRGBColor = crColor;
@@ -167,6 +167,12 @@
pebo->BrushObject.pvRbrush = NULL;
}
+ if (pebo->psoMask != NULL)
+ {
+ SURFACE_ShareUnlockSurface(pebo->psoMask);
+ pebo->psoMask = NULL;
+ }
+
/* Dereference the palettes */
PALETTE_ShareUnlockPalette(pebo->ppalSurf);
PALETTE_ShareUnlockPalette(pebo->ppalDC);
@@ -175,7 +181,8 @@
VOID
NTAPI
-EBRUSHOBJ_vUpdateFromDC(EBRUSHOBJ *pebo,
+EBRUSHOBJ_vUpdateFromDC(
+ EBRUSHOBJ *pebo,
PBRUSH pbrush,
PDC pdc)
{
@@ -288,7 +295,8 @@
{
BOOL bResult;
PFN_DrvRealizeBrush pfnRealizeBrush = NULL;
- PSURFACE psurfPattern, psurfMask;
+ PSURFACE psurfPattern;
+ SURFOBJ *psoMask;
PPDEVOBJ ppdev;
EXLATEOBJ exlo;
PPALETTE ppalPattern;
@@ -300,13 +308,30 @@
ASSERT(pebo->psurfTrg);
ppdev = (PPDEVOBJ)pebo->psurfTrg->SurfObj.hdev;
- if (!ppdev) ppdev = gppdevPrimary;
+ if (!ppdev)
+ ppdev = gppdevPrimary;
if (bCallDriver)
+ {
+ /* Get the Drv function */
pfnRealizeBrush = ppdev->DriverFunctions.RealizeBrush;
-
- if (!pfnRealizeBrush)
+ if (pfnRealizeBrush == NULL)
+ {
+ ERR("No DrvRealizeBrush. Cannot realize brush\n");
+ return FALSE;
+ }
+
+ /* Get the mask */
+ psoMask = EBRUSHOBJ_psoMask(pebo);
+ }
+ else
+ {
+ /* Use the Eng function */
pfnRealizeBrush = EngRealizeBrush;
+
+ /* We don't handle the mask bitmap here. We do this only on demand */
+ psoMask = NULL;
+ }
/* Check if this is a hatch brush */
if (pbr->flAttrs & BR_IS_HATCH)
@@ -325,9 +350,6 @@
psurfPattern = SURFACE_ShareLockSurface(hbmPattern);
ASSERT(psurfPattern);
ASSERT(psurfPattern->ppal);
-
- /* FIXME: implement mask */
- psurfMask = NULL;
/* DIB brushes with DIB_PAL_COLORS usage need a new palette */
if (pbr->flAttrs & BR_IS_DIBPALCOLORS)
@@ -354,17 +376,15 @@
bResult = pfnRealizeBrush(&pebo->BrushObject,
&pebo->psurfTrg->SurfObj,
&psurfPattern->SurfObj,
- psurfMask ? &psurfMask->SurfObj : NULL,
+ psoMask,
&exlo.xlo,
iHatch);
/* Cleanup the XLATEOBJ */
EXLATEOBJ_vCleanup(&exlo);
- /* Unlock surfaces */
+ /* Unlock surface */
SURFACE_ShareUnlockSurface(psurfPattern);
- if (psurfMask)
- SURFACE_ShareUnlockSurface(psurfMask);
return bResult;
}
@@ -400,6 +420,12 @@
return psurfPattern ? &psurfPattern->SurfObj : NULL;
}
+SURFOBJ*
+NTAPI
+EBRUSHOBJ_psoMask(EBRUSHOBJ *pebo)
+{
+ return NULL;
+}
/** Exported DDI functions ****************************************************/
Modified: trunk/reactos/win32ss/gdi/ntgdi/brush.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/ntgdi/brush.h?…
==============================================================================
--- trunk/reactos/win32ss/gdi/ntgdi/brush.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/ntgdi/brush.h [iso-8859-1] Wed Feb 11 21:34:11 2015
@@ -73,6 +73,8 @@
DWORD ulUnique;
// DWORD dwUnknown54;
// DWORD dwUnknown58;
+
+ SURFOBJ *psoMask;
} EBRUSHOBJ, *PEBRUSHOBJ;
/* GDI Brush Attributes */
@@ -158,6 +160,13 @@
#define BRUSHOBJ_psoPattern(pbo) \
EBRUSHOBJ_psoPattern(CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject))
+SURFOBJ*
+NTAPI
+EBRUSHOBJ_psoMask(EBRUSHOBJ *pebo);
+
+#define BRUSHOBJ_psoMask(pbo) \
+ EBRUSHOBJ_psoMask(CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject))
+
FORCEINLINE
ULONG
EBRUSHOBJ_iSetSolidColor(EBRUSHOBJ *pebo, ULONG iSolidColor)