diff --git a/reactos/subsystems/win32/win32k/eng/engbrush.c b/reactos/subsystems/win32/win32k/eng/engbrush.c index 9e354c8c94e..0029d834725 100644 --- a/reactos/subsystems/win32/win32k/eng/engbrush.c +++ b/reactos/subsystems/win32/win32k/eng/engbrush.c @@ -27,8 +27,48 @@ EngRealizeBrush( XLATEOBJ *pxlo, ULONG iHatch) { - UNIMPLEMENTED; - return FALSE; + EBRUSHOBJ *pebo; + HBITMAP hbmpRealize; + SURFOBJ *psoRealize; + POINTL ptlSrc = {0, 0}; + RECTL rclDest; + ULONG lWidth; + + rclDest = (RECTL){0, 0, psoPattern->sizlBitmap.cx, psoPattern->sizlBitmap.cy}; + + /* Calculate width in bytes of the realized brush */ + lWidth = DIB_GetDIBWidthBytes(psoPattern->sizlBitmap.cx, + BitsPerFormat(psoDst->iBitmapFormat)); + + /* Allocate a bitmap */ + hbmpRealize = EngCreateBitmap(psoPattern->sizlBitmap, + lWidth, + psoDst->iBitmapFormat, + BMF_NOZEROINIT, + NULL); + if (!hbmpRealize) + { + return FALSE; + } + + /* Lock the bitmap */ + psoRealize = EngLockSurface(hbmpRealize); + if (!psoRealize) + { + EngDeleteSurface(hbmpRealize); + return FALSE; + } + + /* Copy the bits to the new format bitmap */ + EngCopyBits(psoRealize, psoPattern, NULL, pxlo, &rclDest, &ptlSrc); + + /* Unlock the bitmap again */ + EngUnlockSurface(psoRealize); + + pebo = CONTAINING_RECORD(pbo, EBRUSHOBJ, BrushObject); + pebo->pengbrush = (PVOID)hbmpRealize; + + return TRUE; } VOID @@ -61,6 +101,7 @@ EBRUSHOBJ_vInit(EBRUSHOBJ *pebo, PBRUSH pbrush, XLATEOBJ *pxlo) // EBRUSHOBJ_bRealizeBrush(pebo); } +// pebo->psurfTrg = psurfTrg; pebo->BrushObject.pvRbrush = pbrush->ulRealization; pebo->BrushObject.flColorType = 0; pebo->pbrush = pbrush; @@ -91,7 +132,7 @@ EBRUSHOBJ_bRealizeBrush(EBRUSHOBJ *pebo) psurfTrg = pebo->psurfTrg; // FIXME: all EBRUSHOBJs need a surface ppdev = (PPDEVOBJ)psurfTrg->SurfObj.hdev; // FIXME: all SURFACEs need a PDEV - pfnRealzizeBrush = ppdev->DriverFunctions.RealizeBrush; + pfnRealzizeBrush = NULL;//ppdev->DriverFunctions.RealizeBrush; if (!pfnRealzizeBrush) { pfnRealzizeBrush = EngRealizeBrush; diff --git a/reactos/subsystems/win32/win32k/include/brush.h b/reactos/subsystems/win32/win32k/include/brush.h index e6c35457b55..ccf994af713 100644 --- a/reactos/subsystems/win32/win32k/include/brush.h +++ b/reactos/subsystems/win32/win32k/include/brush.h @@ -14,7 +14,6 @@ * DON'T MODIFY THIS STRUCTURE UNLESS REALLY NEEDED AND EVEN THEN ASK ON * A MAILING LIST FIRST. */ - typedef struct _BRUSH { /* Header for all gdi objects in the handle table. @@ -50,7 +49,7 @@ typedef struct _EBRUSHOBJ COLORREF crRealize; ULONG ulRGBColor; - DWORD pengbrush; + PVOID pengbrush; ULONG ulSurfPalTime; ULONG ulDCPalTime; COLORREF crCurrentText;