Author: fireball
Date: Thu Jul 23 21:20:00 2009
New Revision: 42158
URL:
http://svn.reactos.org/svn/reactos?rev=42158&view=rev
Log:
- Convert color from COLORREF to device's color space. Fixes RGB/BGR issue with text
output, brushes and pens.
- Don't use a stack allocated BRUSHOBJ for text output, because other routines may
rely on it being a real BRUSHGDI object. Create a pen for text output instead (once per
TextOut call, an optimisation could be to move that to DC structure and create once).
Modified:
branches/arwinss/reactos/subsystems/win32/win32k/gre/brushobj.c
branches/arwinss/reactos/subsystems/win32/win32k/gre/font.c
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 Jul
23 21:20:00 2009
@@ -34,6 +34,8 @@
static const BYTE PatternDashDot[] = {0xFF, 0x81, 0xC0};
static const BYTE PatternDashDotDot[] = {0xFF, 0x8E, 0x38};*/
PBRUSHGDI pBrush;
+ XLATEOBJ *pXlate;
+ HPALETTE hPalette;
/* Allocate memory for the object */
pBrush = EngAllocMem(FL_ZERO_MEMORY, sizeof(BRUSHGDI), TAG_BRUSHOBJ);
@@ -82,7 +84,12 @@
case PS_SOLID:
pBrush->flAttrs |= GDIBRUSH_IS_SOLID;
- pBrush->BrushObj.iSolidColor = ulColor;
+
+ // FIXME: Take hDIBPalette in account if it exists!
+ hPalette = pPrimarySurface->DevInfo.hpalDefault;
+ pXlate = IntEngCreateXlate(0, PAL_RGB, hPalette, NULL);
+ pBrush->BrushObj.iSolidColor = XLATEOBJ_iXlate(pXlate, ulColor);
+ EngDeleteXlate(pXlate);
break;
case PS_ALTERNATE:
@@ -135,6 +142,8 @@
GreCreateSolidBrush(COLORREF crColor)
{
PBRUSHGDI pBrush;
+ XLATEOBJ *pXlate;
+ HPALETTE hPalette;
/* Allocate memory for the object */
pBrush = EngAllocMem(FL_ZERO_MEMORY, sizeof(BRUSHGDI), TAG_BRUSHOBJ);
@@ -144,7 +153,11 @@
pBrush->flAttrs |= GDIBRUSH_IS_SOLID;
/* Set color */
- pBrush->BrushObj.iSolidColor = crColor;
+ // FIXME: Take hDIBPalette in account if it exists!
+ hPalette = pPrimarySurface->DevInfo.hpalDefault;
+ pXlate = IntEngCreateXlate(0, PAL_RGB, hPalette, NULL);
+ pBrush->BrushObj.iSolidColor = XLATEOBJ_iXlate(pXlate, crColor);
+ EngDeleteXlate(pXlate);
/* Return newly created brush */
return pBrush;
Modified: branches/arwinss/reactos/subsystems/win32/win32k/gre/font.c
URL:
http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win3…
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/gre/font.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/gre/font.c [iso-8859-1] Thu Jul 23
21:20:00 2009
@@ -15,7 +15,7 @@
/* PRIVATE FUNCTIONS *********************************************************/
static void SharpGlyphMono(PDC physDev, INT x, INT y,
- void *bitmap, GlyphInfo *gi)
+ void *bitmap, GlyphInfo *gi, BRUSHGDI *pTextBrush)
{
#if 1
unsigned char *srcLine = bitmap, *src;
@@ -26,10 +26,6 @@
int w;
int xspan, lenspan;
RECTL rcBounds;
- BRUSHOBJ textBrush;
-
- RtlZeroMemory(&textBrush, sizeof(textBrush));
- textBrush.iSolidColor = physDev->crForegroundClr;
x -= gi->x;
y -= gi->y;
@@ -64,7 +60,7 @@
rcBounds.right = xspan+lenspan; rcBounds.bottom = y+1;
GreLineTo(&physDev->pBitmap->SurfObj,
NULL,
- &textBrush,
+ &pTextBrush->BrushObj,
xspan,
y,
xspan + lenspan,
@@ -143,13 +139,14 @@
AA_Type aa_type = AA_None;
INT idx;
/*double*/ int cosEsc = 1, sinEsc = 0;
-
- //wine_tsx11_lock();
- //XSetForeground( gdi_display, physDev->gc, textPixel );
+ BRUSHGDI *pTextPen;
+
+ /* Create pen for text output */
+ pTextPen = GreCreatePen(PS_SOLID, 1, 0, pDC->crForegroundClr, 0, 0, 0, NULL, 0,
TRUE);
if(aa_type == AA_None || pDC->pBitmap->SurfObj.iBitmapFormat == BMF_1BPP)
{
- void (* sharp_glyph_fn)(PDC, INT, INT, void *, GlyphInfo *);
+ void (* sharp_glyph_fn)(PDC, INT, INT, void *, GlyphInfo *, BRUSHGDI *);
//if(aa_type == AA_None)
sharp_glyph_fn = SharpGlyphMono;
@@ -160,7 +157,8 @@
sharp_glyph_fn(pDC, pDC->rcDcRect.left + pDC->rcVport.left + x + xoff,
pDC->rcDcRect.top + pDC->rcVport.top + y + yoff,
formatEntry->bitmaps[wstr[idx]],
- &formatEntry->gis[wstr[idx]]);
+ &formatEntry->gis[wstr[idx]],
+ pTextPen);
if(lpDx) {
offset += lpDx[idx];
xoff = offset * cosEsc;
@@ -282,7 +280,8 @@
#endif
}
//no_image:
- //wine_tsx11_unlock();
+
+ GreFreeBrush(pTextPen);
}
/* EOF */