* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: xlate.c,v 1.36 2004/06/28 15:53:17 navaraf Exp $
+/* $Id: xlate.c,v 1.37 2004/06/28 17:03:35 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
XlateGDI->BackgroundColor = NtGdiGetNearestPaletteIndex(
PaletteSource, BackgroundColor);
break;
- case PAL_RGB:
+ case PAL_BGR:
XlateGDI->BackgroundColor = BackgroundColor;
break;
- case PAL_BGR:
+ case PAL_RGB:
XlateGDI->BackgroundColor =
((BackgroundColor & 0xFF) << 16) |
((BackgroundColor & 0xFF0000) >> 16) |
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: bitmaps.c,v 1.74 2004/06/20 00:45:37 navaraf Exp $ */
+/* $Id: bitmaps.c,v 1.75 2004/06/28 17:03:35 navaraf Exp $ */
#include <w32k.h>
#define IN_RECT(r,x,y) \
Colors[0] = DCSrc->w.textColor;
Colors[1] = DCSrc->w.backgroundColor;
- Mono = EngCreatePalette(PAL_INDEXED, 2, Colors, 0, 0, 0);
+ Mono = PALETTE_AllocPaletteIndexedRGB(2, (RGBQUAD*)Colors);
if (NULL != Mono)
{
XlateObj = (XLATEOBJ*)IntEngCreateXlate(DestMode, PAL_INDEXED, DestPalette, Mono);
PalMode = PalGDI->Mode;
PALETTE_UnlockPalette(Pal);
+ /* FIXME: Verify if it shouldn't be PAL_BGR! */
XlateObj = (XLATEOBJ*)IntEngCreateXlate ( PAL_RGB, PalMode, NULL, Pal );
if ( XlateObj )
{
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: color.c,v 1.43 2004/06/23 15:30:20 weiden Exp $ */
+/* $Id: color.c,v 1.44 2004/06/28 17:03:35 navaraf Exp $ */
#include <w32k.h>
// FIXME: Use PXLATEOBJ logicalToSystem instead of int *mapping
if (NULL != palGDI)
{
/* Return closest match for the given RGB color */
- index = COLOR_PaletteLookupPixel((LPPALETTEENTRY)palGDI->IndexedColors, palGDI->NumColors, NULL, Color, FALSE);
+ index = COLOR_PaletteLookupPixel(palGDI->IndexedColors, palGDI->NumColors, NULL, Color, FALSE);
PALETTE_UnlockPalette(hpal);
}
PALETTE_UnlockPalette(hpal);
return 0;
}
- memcpy(pe, &palGDI->IndexedColors[StartIndex], Entries * sizeof(PALETTEENTRY));
+ memcpy(pe, palGDI->IndexedColors + StartIndex, Entries * sizeof(PALETTEENTRY));
for (numEntries = 0; numEntries < Entries; numEntries++)
{
if (pe[numEntries].peFlags & 0xF0)
{
Entries = numEntries - Start;
}
- memcpy(&palGDI->IndexedColors[Start], pe, Entries * sizeof(PALETTEENTRY));
+ memcpy(palGDI->IndexedColors + Start, pe, Entries * sizeof(PALETTEENTRY));
PALETTE_ValidateFlags(palGDI->IndexedColors, palGDI->NumColors);
ExFreePool(palGDI->logicalToSystem);
palGDI->logicalToSystem = NULL;
for( i = 0; i < size && diff ; i++ )
{
+#if 0
if(!(palPalEntry[i].peFlags & PC_SYS_USED) || (skipReserved && palPalEntry[i].peFlags & PC_SYS_RESERVED))
continue;
+#endif
r = palPalEntry[i].peRed - GetRValue(col);
g = palPalEntry[i].peGreen - GetGValue(col);
COLORREF STDCALL COLOR_LookupNearestColor( PALETTEENTRY* palPalEntry, int size, COLORREF color )
{
-#if 1
INT index;
index = COLOR_PaletteLookupPixel(palPalEntry, size, NULL, color, FALSE);
palPalEntry[index].peRed,
palPalEntry[index].peGreen,
palPalEntry[index].peBlue);
-#else
- unsigned char spec_type = color >> 24;
- int i;
- PALETTEENTRY *COLOR_sysPal = (PALETTEENTRY*)ReturnSystemPalette();
-
- // we need logical palette for PALETTERGB and PALETTEINDEX colorrefs
-
- if( spec_type == 2 ) /* PALETTERGB */
- color = *(COLORREF*)(palPalEntry + COLOR_PaletteLookupPixel(palPalEntry,size,NULL,color,FALSE));
-
- else if( spec_type == 1 ) /* PALETTEINDEX */
- {
- if( (i = color & 0x0000ffff) >= size )
- {
- DbgPrint("RGB(%lx) : idx %d is out of bounds, assuming NULL\n", color, i);
- color = *(COLORREF*)palPalEntry;
- }
- else color = *(COLORREF*)(palPalEntry + i);
- }
-
- color &= 0x00ffffff;
- return (0x00ffffff & *(COLORREF*)(COLOR_sysPal + COLOR_PaletteLookupPixel(COLOR_sysPal, 256, NULL, color, FALSE)));
-#endif
}
int STDCALL COLOR_PaletteLookupExactIndex( PALETTEENTRY* palPalEntry, int size,
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-/* $Id: dc.c,v 1.139 2004/06/20 00:45:37 navaraf Exp $
+/* $Id: dc.c,v 1.140 2004/06/28 17:03:35 navaraf Exp $
*
* DC.C - Device context functions
*
XLATEOBJ *XlateObj;
PPALGDI PalGDI;
DWORD objectType;
- COLORREF *ColorMap;
COLORREF MonoColorMap[2];
- ULONG NumColors, Index;
+ ULONG NumColors;
HRGN hVisRgn;
USHORT Mode;
if(pb->dib->dsBmih.biBitCount == 1) { NumColors = 2; } else
if(pb->dib->dsBmih.biBitCount == 4) { NumColors = 16; } else
if(pb->dib->dsBmih.biBitCount == 8) { NumColors = 256; }
-
- ColorMap = ExAllocatePoolWithTag(PagedPool, sizeof(COLORREF) * NumColors, TAG_DC);
- ASSERT(ColorMap);
- for (Index = 0; Index < NumColors; Index++)
- {
- ColorMap[Index] = RGB(pb->ColorMap[Index].rgbRed,
- pb->ColorMap[Index].rgbGreen,
- pb->ColorMap[Index].rgbBlue);
- }
- dc->w.hPalette = PALETTE_AllocPalette(PAL_INDEXED, NumColors, (ULONG *) ColorMap, 0, 0, 0);
- ExFreePool(ColorMap);
+ dc->w.hPalette = PALETTE_AllocPaletteIndexedRGB(NumColors, pb->ColorMap);
}
else if ( 16 == pb->dib->dsBmih.biBitCount )
{
{
MonoColorMap[0] = RGB(0, 0, 0);
MonoColorMap[1] = RGB(255, 255, 255);
- dc->w.hPalette = PALETTE_AllocPalette(PAL_INDEXED, 2, MonoColorMap, 0, 0, 0);
+ dc->w.hPalette = PALETTE_AllocPaletteIndexedRGB(2, (RGBQUAD*)MonoColorMap);
}
else
{
/*
- * $Id: dib.c,v 1.53 2004/06/23 07:31:22 gvg Exp $
+ * $Id: dib.c,v 1.54 2004/06/28 17:03:35 navaraf Exp $
*
* ReactOS W32 Subsystem
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 ReactOS Team
return lpRGB;
}
-PPALETTEENTRY STDCALL
-DIBColorTableToPaletteEntries (
- PPALETTEENTRY palEntries,
- const RGBQUAD *DIBColorTable,
- ULONG ColorCount
- )
-{
- ULONG i;
-
- for (i = 0; i < ColorCount; i++)
- {
- palEntries->peRed = DIBColorTable->rgbRed;
- palEntries->peGreen = DIBColorTable->rgbGreen;
- palEntries->peBlue = DIBColorTable->rgbBlue;
- palEntries++;
- DIBColorTable++;
- }
-
- return palEntries;
-}
-
HPALETTE FASTCALL
BuildDIBPalette (PBITMAPINFO bmi, PINT paletteType)
{
if (PAL_INDEXED == *paletteType)
{
- palEntries = ExAllocatePoolWithTag(PagedPool, sizeof(PALETTEENTRY)*ColorCount, TAG_COLORMAP);
- DIBColorTableToPaletteEntries(palEntries, bmi->bmiColors, ColorCount);
+ hPal = PALETTE_AllocPaletteIndexedRGB(ColorCount, (RGBQUAD*)bmi->bmiColors);
}
- hPal = PALETTE_AllocPalette( *paletteType, ColorCount, (ULONG*)palEntries, 0, 0, 0 );
- if (NULL != palEntries)
+ else
{
- ExFreePool(palEntries);
+ hPal = PALETTE_AllocPalette( *paletteType, ColorCount, (ULONG*)palEntries, 0, 0, 0 );
}
return hPal;