Author: tkreuzer
Date: Sat Jul 11 05:19:39 2009
New Revision: 41857
URL:
http://svn.reactos.org/svn/reactos?rev=41857&view=rev
Log:
Only call the drivers DrvRealizeBrush when called from BRUSHOBJ_pbGetRbrush. The driver
might punt back to GDI and gdi might want to realize the brush although the surface is
driver managed. Shuffle functions.
Modified:
trunk/reactos/subsystems/win32/win32k/eng/engbrush.c
trunk/reactos/subsystems/win32/win32k/include/brush.h
Modified: trunk/reactos/subsystems/win32/win32k/eng/engbrush.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/en…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/eng/engbrush.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/eng/engbrush.c [iso-8859-1] Sat Jul 11 05:19:39
2009
@@ -13,6 +13,104 @@
#include <debug.h>
/** Internal functions ********************************************************/
+
+VOID
+NTAPI
+EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
+{
+ ULONG iSolidColor;
+ XLATEOBJ *pxlo;
+ PSURFACE psurfTrg;
+
+ ASSERT(pebo);
+ ASSERT(pbrush);
+ ASSERT(pdc);
+
+ psurfTrg = pdc->dclevel.pSurface;
+
+ pebo->psurfTrg = psurfTrg;
+ pebo->BrushObject.flColorType = 0;
+ pebo->pbrush = pbrush;
+ pebo->flattrs = pbrush->flAttrs;
+ pebo->crCurrentText = pdc->pdcattr->crForegroundClr;
+ pebo->crCurrentBack = pdc->pdcattr->crBackgroundClr;
+ pebo->BrushObject.pvRbrush = NULL;
+ pebo->pengbrush = NULL;
+
+ if (pbrush->flAttrs & GDIBRUSH_IS_NULL)
+ {
+ pebo->BrushObject.iSolidColor = 0;
+ }
+ else if (pbrush->flAttrs & GDIBRUSH_IS_SOLID)
+ {
+ /* Set the RGB color */
+ pebo->crRealize = pbrush->BrushAttr.lbColor;
+ pebo->ulRGBColor = pbrush->BrushAttr.lbColor;
+
+ /* Translate the brush color to the target format */
+ pxlo = IntCreateBrushXlate(pbrush, psurfTrg, pebo->crCurrentBack);
+ iSolidColor = XLATEOBJ_iXlate(pxlo, pbrush->BrushAttr.lbColor);
+ pebo->BrushObject.iSolidColor = iSolidColor;
+ if (pxlo)
+ EngDeleteXlate(pxlo);
+ }
+ else
+ {
+ /* This is a pattern brush that needs realization */
+ pebo->BrushObject.iSolidColor = 0xFFFFFFFF;
+ }
+}
+
+VOID
+FASTCALL
+EBRUSHOBJ_vSetSolidBrushColor(EBRUSHOBJ *pebo, COLORREF crColor, XLATEOBJ *pxlo)
+{
+ ULONG iSolidColor;
+
+ /* Never use with non-solid brushes */
+ ASSERT(pebo->flattrs & GDIBRUSH_IS_SOLID);
+
+ /* Set the RGB color */
+ pebo->crRealize = crColor;
+ pebo->ulRGBColor = crColor;
+
+ /* Translate the brush color to the target format */
+ iSolidColor = XLATEOBJ_iXlate(pxlo, crColor);
+ pebo->BrushObject.iSolidColor = iSolidColor;
+
+ pebo->BrushObject.iSolidColor = iSolidColor;
+}
+
+VOID
+NTAPI
+EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo)
+{
+ /* Check if there's a GDI realisation */
+ if (pebo->pengbrush)
+ {
+ EngDeleteSurface(pebo->pengbrush);
+ pebo->pengbrush = NULL;
+ }
+
+ /* Check if there's a driver's realisation */
+ if (pebo->BrushObject.pvRbrush)
+ {
+ /* Free allocated driver memory */
+ EngFreeMem(pebo->BrushObject.pvRbrush);
+ pebo->BrushObject.pvRbrush = NULL;
+ }
+}
+
+VOID
+NTAPI
+EBRUSHOBJ_vUpdate(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
+{
+ /* Cleanup the brush */
+ EBRUSHOBJ_vCleanup(pebo);
+
+ /* Reinitialize */
+ EBRUSHOBJ_vInit(pebo, pbrush, pdc);
+}
/**
* This function is not exported, because it makes no sense for
@@ -70,76 +168,9 @@
return TRUE;
}
-VOID
-NTAPI
-EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
-{
- ULONG iSolidColor;
- XLATEOBJ *pxlo;
- PSURFACE psurfTrg;
-
- ASSERT(pebo);
- ASSERT(pbrush);
- ASSERT(pdc);
-
- psurfTrg = pdc->dclevel.pSurface;
-
- pebo->psurfTrg = psurfTrg;
- pebo->BrushObject.flColorType = 0;
- pebo->pbrush = pbrush;
- pebo->flattrs = pbrush->flAttrs;
- pebo->crCurrentText = pdc->pdcattr->crForegroundClr;
- pebo->crCurrentBack = pdc->pdcattr->crBackgroundClr;
- pebo->BrushObject.pvRbrush = NULL;
- pebo->pengbrush = NULL;
-
- if (pbrush->flAttrs & GDIBRUSH_IS_NULL)
- {
- pebo->BrushObject.iSolidColor = 0;
- }
- else if (pbrush->flAttrs & GDIBRUSH_IS_SOLID)
- {
- /* Set the RGB color */
- pebo->crRealize = pbrush->BrushAttr.lbColor;
- pebo->ulRGBColor = pbrush->BrushAttr.lbColor;
-
- /* Translate the brush color to the target format */
- pxlo = IntCreateBrushXlate(pbrush, psurfTrg, pebo->crCurrentBack);
- iSolidColor = XLATEOBJ_iXlate(pxlo, pbrush->BrushAttr.lbColor);
- pebo->BrushObject.iSolidColor = iSolidColor;
- if (pxlo)
- EngDeleteXlate(pxlo);
- }
- else
- {
- /* This is a pattern brush that needs realization */
- pebo->BrushObject.iSolidColor = 0xFFFFFFFF;
- }
-}
-
-VOID
-FASTCALL
-EBRUSHOBJ_vSetSolidBrushColor(EBRUSHOBJ *pebo, COLORREF crColor, XLATEOBJ *pxlo)
-{
- ULONG iSolidColor;
-
- /* Never use with non-solid brushes */
- ASSERT(pebo->flattrs & GDIBRUSH_IS_SOLID);
-
- /* Set the RGB color */
- pebo->crRealize = crColor;
- pebo->ulRGBColor = crColor;
-
- /* Translate the brush color to the target format */
- iSolidColor = XLATEOBJ_iXlate(pxlo, crColor);
- pebo->BrushObject.iSolidColor = iSolidColor;
-
- pebo->BrushObject.iSolidColor = iSolidColor;
-}
-
BOOL
NTAPI
-EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo)
+EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo, BOOL bCallDriver)
{
BOOL bResult;
PFN_DrvRealizeBrush pfnRealzizeBrush = NULL;
@@ -155,7 +186,7 @@
}
ppdev = (PPDEVOBJ)psurfTrg->SurfObj.hdev; // FIXME: all SURFACEs need a PDEV
- if (ppdev)
+ if (ppdev && bCallDriver)
pfnRealzizeBrush = ppdev->DriverFunctions.RealizeBrush;
if (!pfnRealzizeBrush)
{
@@ -194,37 +225,6 @@
return bResult;
}
-VOID
-NTAPI
-EBRUSHOBJ_vCleanup(EBRUSHOBJ *pebo)
-{
- /* Check if there's a GDI realisation */
- if (pebo->pengbrush)
- {
- EngDeleteSurface(pebo->pengbrush);
- pebo->pengbrush = NULL;
- }
-
- /* Check if there's a driver's realisation */
- if (pebo->BrushObject.pvRbrush)
- {
- /* Free allocated driver memory */
- EngFreeMem(pebo->BrushObject.pvRbrush);
- pebo->BrushObject.pvRbrush = NULL;
- }
-}
-
-VOID
-NTAPI
-EBRUSHOBJ_vUpdate(EBRUSHOBJ *pebo, PBRUSH pbrush, PDC pdc)
-{
- /* Cleanup the brush */
- EBRUSHOBJ_vCleanup(pebo);
-
- /* Reinitialize */
- EBRUSHOBJ_vInit(pebo, pbrush, pdc);
-}
-
PVOID
NTAPI
EBRUSHOBJ_pvGetEngBrush(EBRUSHOBJ *pebo)
@@ -233,7 +233,7 @@
if (!pebo->pengbrush)
{
- bResult = EBRUSHOBJ_bRealizeBrush(pebo);
+ bResult = EBRUSHOBJ_bRealizeBrush(pebo, FALSE);
if (!bResult)
{
if (pebo->pengbrush)
@@ -272,7 +272,7 @@
if (!pbo->pvRbrush)
{
- bResult = EBRUSHOBJ_bRealizeBrush(pebo);
+ bResult = EBRUSHOBJ_bRealizeBrush(pebo, TRUE);
if (!bResult)
{
if (pbo->pvRbrush)
Modified: trunk/reactos/subsystems/win32/win32k/include/brush.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/in…
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/include/brush.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/include/brush.h [iso-8859-1] Sat Jul 11 05:19:39
2009
@@ -118,7 +118,7 @@
BOOL
NTAPI
-EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo);
+EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo, BOOL bCallDriver);
VOID
NTAPI