Author: fireball
Date: Thu Aug 13 21:12:37 2009
New Revision: 42657
URL:
http://svn.reactos.org/svn/reactos?rev=42657&view=rev
Log:
- Create XlateObject for brushes having a bitmap. Partially fixes drawing with these kind
of brushes.
- Set iSolidColor back to reserved value, otherwise pattern won't be drawn.
Modified:
branches/arwinss/reactos/subsystems/win32/win32k/gdi/dc.c
branches/arwinss/reactos/subsystems/win32/win32k/gre/brushobj.c
branches/arwinss/reactos/subsystems/win32/win32k/gre/palobj.c
branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h
branches/arwinss/reactos/subsystems/win32/win32k/include/xlateobj.h
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] Thu Aug 13
21:12:37 2009
@@ -227,6 +227,41 @@
DC_Unlock(pDC);
return TRUE;
+}
+
+// TODO: Move somewhere, give it a better name
+XLATEOBJ *GrepBrushCreateXlate(PDC pDC, PBRUSHGDI pBrush, COLORREF lbColor)
+{
+ SURFACE *pSurfPattern;
+ HPALETTE hPalette;
+
+ pSurfPattern = SURFACE_Lock(pBrush->hbmPattern);
+ if (!pSurfPattern) return NULL;
+
+ /* Get default palette */
+ hPalette = pDC->pBitmap->hDIBPalette;
+ if (!hPalette) hPalette = pPrimarySurface->DevInfo.hpalDefault;
+
+ /* Special case: 1bpp pattern */
+ if (pSurfPattern->SurfObj.iBitmapFormat == BMF_1BPP)
+ {
+ if (BitsPerFormat(pDC->pBitmap->SurfObj.iBitmapFormat) != 1)
+ {
+ pBrush->XlateObject =
+ IntEngCreateSrcMonoXlate(hPalette,
+ pDC->crBackgroundClr,
+ lbColor);
+ }
+ }
+ else if (pBrush->flAttrs & GDIBRUSH_IS_DIB)
+ {
+ pBrush->XlateObject =
+ IntEngCreateXlate(0, 0, hPalette, pSurfPattern->hDIBPalette);
+ }
+
+ SURFACE_Unlock(pSurfPattern);
+
+ return pBrush->XlateObject;
}
VOID APIENTRY RosGdiSelectBrush( HDC physDev, LOGBRUSH *pLogBrush )
@@ -281,6 +316,12 @@
break;
}
+ /* Create XLATE for hatched/pattern brushes */
+ if (pLogBrush->lbStyle == BS_HATCHED || pLogBrush->lbStyle == BS_PATTERN)
+ {
+ GrepBrushCreateXlate(pDC, pDC->pFillBrush, pLogBrush->lbColor);
+ }
+
/* Release the object */
DC_Unlock(pDC);
}
@@ -320,6 +361,12 @@
NULL,
0,
TRUE);
+
+ /* Create XLATE if necessary */
+ if (pDC->pLineBrush && pDC->pLineBrush->flAttrs &
GDIBRUSH_IS_BITMAP)
+ {
+ GrepBrushCreateXlate(pDC, pDC->pLineBrush, pLogPen->lopnColor);
+ }
}
else
{
@@ -335,6 +382,12 @@
pExtLogPen->elpStyleEntry,
0,
FALSE);
+
+ /* Create XLATE if necessary */
+ if (pDC->pLineBrush && pDC->pLineBrush->flAttrs &
GDIBRUSH_IS_BITMAP)
+ {
+ GrepBrushCreateXlate(pDC, pDC->pLineBrush, pExtLogPen->elpColor);
+ }
}
/* Release the object */
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] Thu Aug
13 21:12:37 2009
@@ -259,7 +259,7 @@
SURFACE_Unlock(pPattern);
/* Set color to the reserved value */
- pBrush->BrushObj.iSolidColor = crColor & 0xFFFFFF;
+ pBrush->BrushObj.iSolidColor = 0xFFFFFFFF;
/* Return newly created brush */
return pBrush;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/palobj.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gre/palobj.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/palobj.c [iso-8859-1] Thu Aug 13
21:12:37 2009
@@ -114,8 +114,8 @@
USHORT *lpIndex;
PPALETTE palGDI;
- palGDI = PALETTE_LockPalette(dc->hPalette);
-
+ palGDI = NULL;//PALETTE_LockPalette(dc->hPalette);
+ UNIMPLEMENTED;
if (NULL == palGDI)
{
return NULL;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/dc.h [iso-8859-1] Thu Aug 13
21:12:37 2009
@@ -6,9 +6,6 @@
BASEOBJECT BaseObject;
PPDEVOBJ pPDevice;
-
- /* Device palette */
- HPALETTE hPalette;
PSURFACE pBitmap;
PBRUSHGDI pFillBrush;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/include/xlateobj.h
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/include/xlateobj.h [iso-8859-1]
(original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/include/xlateobj.h [iso-8859-1] Thu
Aug 13 21:12:37 2009
@@ -26,6 +26,9 @@
IntEngCreateXlate(USHORT DestPalType, USHORT SourcePalType,
HPALETTE PaletteDest, HPALETTE PaletteSource);
+XLATEOBJ* FASTCALL
+IntEngCreateSrcMonoXlate(HPALETTE PaletteDest, ULONG Color0, ULONG Color1);
+
VOID FASTCALL
EngDeleteXlate(XLATEOBJ *XlateObj);