From 6b30cb44dd6a3d04333239d33a99ecd825a2f246 Mon Sep 17 00:00:00 2001 From: Eugene Ingerman Date: Mon, 19 Aug 2002 21:49:45 +0000 Subject: [PATCH] Added color translation for solid color brushes. svn path=/trunk/; revision=3369 --- .../drivers/dd/vga/display/objects/paint.c | 5 +++-- reactos/subsys/win32k/objects/dc.c | 22 ++++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/reactos/drivers/dd/vga/display/objects/paint.c b/reactos/drivers/dd/vga/display/objects/paint.c index 1def9a7f313..8193b49549a 100644 --- a/reactos/drivers/dd/vga/display/objects/paint.c +++ b/reactos/drivers/dd/vga/display/objects/paint.c @@ -13,7 +13,6 @@ BOOL VGADDIFillSolid(SURFOBJ *Surface, RECTL Dimensions, ULONG iColor) ULONG long leftpixs, midpixs, rightpixs, temp; UCHAR a; - DPRINT("VGADDIFillSolid: x:%d, y:%d, w:%d, h:%d\n", x, y, w, h); // Swap dimensions so that x, y are at topmost left if(Dimensions.right < Dimensions.left) { @@ -34,6 +33,7 @@ BOOL VGADDIFillSolid(SURFOBJ *Surface, RECTL Dimensions, ULONG iColor) // Calculate the width and height w = x2 - x; h = y2 - y; + DPRINT("VGADDIFillSolid: x:%d, y:%d, w:%d, h:%d, color: %d\n", x, y, w, h, iColor); // Calculate the starting offset offset = xconv[x]+y80[y]; @@ -86,7 +86,8 @@ BOOL VGADDIFillSolid(SURFOBJ *Surface, RECTL Dimensions, ULONG iColor) tmppre1+=80; } - // Middle + // Middle + x=orgx+(8-leftpixs)+leftpixs; } else { diff --git a/reactos/subsys/win32k/objects/dc.c b/reactos/subsys/win32k/objects/dc.c index 59ed22009a8..a2a2d08b7df 100644 --- a/reactos/subsys/win32k/objects/dc.c +++ b/reactos/subsys/win32k/objects/dc.c @@ -1,4 +1,4 @@ -/* $Id: dc.c,v 1.34 2002/08/18 07:02:57 ei Exp $ +/* $Id: dc.c,v 1.35 2002/08/19 21:49:45 ei Exp $ * * DC.C - Device context functions * @@ -904,6 +904,7 @@ HGDIOBJ STDCALL W32kSelectObject(HDC hDC, HGDIOBJ hGDIObj) PSURFGDI surfgdi; PDC dc; PPENOBJ pen; + PBRUSHOBJ brush; PXLATEOBJ XlateObj; PPALGDI PalGDI; WORD objectMagic; @@ -923,14 +924,25 @@ HGDIOBJ STDCALL W32kSelectObject(HDC hDC, HGDIOBJ hGDIObj) // Convert the color of the pen to the format of the DC PalGDI = (PPALGDI)AccessInternalObject(dc->w.hPalette); - XlateObj = (PXLATEOBJ)EngCreateXlate(PalGDI->Mode, PAL_RGB, dc->w.hPalette, NULL); - pen = GDIOBJ_LockObj(dc->w.hPen, GO_PEN_MAGIC); - pen->logpen.lopnColor = XLATEOBJ_iXlate(XlateObj, pen->logpen.lopnColor); - GDIOBJ_UnlockObj( dc->w.hPen, GO_PEN_MAGIC); + if( PalGDI ){ + XlateObj = (PXLATEOBJ)EngCreateXlate(PalGDI->Mode, PAL_RGB, dc->w.hPalette, NULL); + pen = GDIOBJ_LockObj(dc->w.hPen, GO_PEN_MAGIC); + pen->logpen.lopnColor = XLATEOBJ_iXlate(XlateObj, pen->logpen.lopnColor); + GDIOBJ_UnlockObj( dc->w.hPen, GO_PEN_MAGIC); + } break; case GO_BRUSH_MAGIC: objOrg = (HGDIOBJ)dc->w.hBrush; dc->w.hBrush = (HBRUSH) hGDIObj; + + // Convert the color of the brush to the format of the DC + PalGDI = (PPALGDI)AccessInternalObject(dc->w.hPalette); + if( PalGDI ){ + XlateObj = (PXLATEOBJ)EngCreateXlate(PalGDI->Mode, PAL_RGB, dc->w.hPalette, NULL); + brush = GDIOBJ_LockObj(dc->w.hBrush, GO_BRUSH_MAGIC); + brush->iSolidColor = XLATEOBJ_iXlate(XlateObj, brush->iSolidColor); + GDIOBJ_UnlockObj( dc->w.hBrush, GO_BRUSH_MAGIC); + } break; case GO_FONT_MAGIC: objOrg = (HGDIOBJ)dc->w.hFont;