Author: fireball
Date: Sun Nov 8 17:49:45 2009
New Revision: 44028
URL:
http://svn.reactos.org/svn/reactos?rev=44028&view=rev
Log:
- Implement pattern brush realization. Based on code by Kamil Hornicek.
Modified:
branches/arwinss/reactos/subsystems/win32/win32k/eng/engblt.c
branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.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] Sun Nov 8
17:49:45 2009
@@ -210,7 +210,7 @@
GdiBrush = CONTAINING_RECORD(pbo, BRUSHGDI, BrushObj);
if ((psurfPattern = SURFACE_Lock(GdiBrush->hbmPattern)))
{
- BltInfo.PatternSurface = &psurfPattern->SurfObj;
+ BltInfo.PatternSurface = GreRealizeBrush(GdiBrush, psurfPattern, OutputObj);
}
else
{
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/bitblt.c [iso-8859-1] Sun Nov 8
17:49:45 2009
@@ -306,6 +306,8 @@
BrushOrigin.x = pDC->ptBrushOrg.x + pDC->rcDcRect.left;
BrushOrigin.y = pDC->ptBrushOrg.y + pDC->rcDcRect.top;
+
+ GreUpdateBrush(pDC->pFillBrush, pDC);
bRet = GrepBitBltEx(
&pDC->pBitmap->SurfObj,
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] Sun Nov
8 17:49:45 2009
@@ -262,6 +262,9 @@
/* Set color to the reserved value */
pBrush->BrushObj.iSolidColor = 0xFFFFFFFF;
+ /* Set real brush color */
+ pBrush->crForegroundClr = crColor;
+
/* Return newly created brush */
return pBrush;
}
@@ -281,4 +284,52 @@
EngFreeMem(pBrush);
}
+SURFOBJ *
+NTAPI
+GreRealizeBrush(PBRUSHGDI GdiBrush, PSURFACE psurfPattern, SURFOBJ *OutputObj)
+{
+ SURFOBJ *psoRealize;
+ HBITMAP hbmpRealize;
+ POINTL ptlSrc = {0, 0};
+ RECTL rclDest;
+ HPALETTE hPalette;
+ LONG lWidth;
+
+ rclDest = (RECTL){0, 0, psurfPattern->SurfObj.sizlBitmap.cx,
psurfPattern->SurfObj.sizlBitmap.cy};
+
+ hPalette = NULL;//pDC->pBitmap->hDIBPalette; // FIXME: use dest surface
palette!
+ if (!hPalette) hPalette = pPrimarySurface->DevInfo.hpalDefault;
+
+ lWidth = DIB_GetDIBWidthBytes(psurfPattern->SurfObj.sizlBitmap.cx,
BitsPerFormat(OutputObj->iBitmapFormat));
+ hbmpRealize = EngCreateBitmap(psurfPattern->SurfObj.sizlBitmap,
+ lWidth,
+ OutputObj->iBitmapFormat,
+ BMF_NOZEROINIT,
+ NULL);
+
+
+ psoRealize = EngLockSurface(hbmpRealize);
+ if (!psoRealize)
+ {
+ EngDeleteSurface(hbmpRealize);
+ return FALSE;
+ }
+
+ GdiBrush->XlateObject = IntEngCreateSrcMonoXlate(hPalette,
GdiBrush->crBackgroundClr, GdiBrush->crForegroundClr);
+
+ EngCopyBits(psoRealize, &psurfPattern->SurfObj, NULL,
GdiBrush->XlateObject, &rclDest, &ptlSrc);
+
+ EngUnlockSurface(psoRealize);
+
+ return psoRealize;
+}
+
+VOID
+NTAPI
+GreUpdateBrush(PBRUSHGDI pBrush, PDC pDc)
+{
+ /* Update background color, important for hatch brushes */
+ pBrush->crBackgroundClr = pDc->crBackgroundClr;
+}
+
/* EOF */
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] Sun
Nov 8 17:49:45 2009
@@ -1,5 +1,7 @@
#ifndef __WIN32K_BRUSHOBJ_H
#define __WIN32K_BRUSHOBJ_H
+
+struct _DC;
/* GDI Brush Attributes */
#define GDIBRUSH_NEED_FG_CLR 0x0001
@@ -37,6 +39,8 @@
ULONG dwStyleCount;
HBITMAP hbmPattern;
XLATEOBJ *XlateObject;
+ COLORREF crForegroundClr;
+ COLORREF crBackgroundClr;
} BRUSHGDI, *PBRUSHGDI;
PBRUSHGDI NTAPI
@@ -67,4 +71,10 @@
VOID NTAPI
GreFreeBrush(PBRUSHGDI pBrush);
+SURFOBJ * NTAPI
+GreRealizeBrush(PBRUSHGDI GdiBrush, PSURFACE psurfPattern, SURFOBJ *OutputObj);
+
+VOID NTAPI
+GreUpdateBrush(PBRUSHGDI pBrush, struct _DC *pDc);
+
#endif