Commit 5cab46ee authored by Alexandre Julliard's avatar Alexandre Julliard

Cleaned up some inter-dll dependencies in palette management.

parent 7200ca98
......@@ -31,13 +31,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
/**********************************************************************/
PALETTE_DRIVER TTYDRV_PALETTE_Driver =
{
TTYDRV_PALETTE_SetMapping,
TTYDRV_PALETTE_UpdateMapping,
TTYDRV_PALETTE_IsDark
};
const DC_FUNCTIONS *TTYDRV_DC_Funcs = NULL; /* hack */
/**********************************************************************
......@@ -45,8 +38,6 @@ const DC_FUNCTIONS *TTYDRV_DC_Funcs = NULL; /* hack */
*/
BOOL TTYDRV_GDI_Initialize(void)
{
PALETTE_Driver = &TTYDRV_PALETTE_Driver;
return TTYDRV_PALETTE_Initialize();
}
......
......@@ -33,10 +33,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(ttydrv);
/**********************************************************************/
extern PALETTEENTRY *COLOR_sysPal;
extern int COLOR_gapStart;
extern int COLOR_gapEnd;
extern int COLOR_gapFilled;
extern int COLOR_max;
static int palette_size = 256; /* FIXME */
......@@ -83,39 +79,5 @@ BOOL TTYDRV_PALETTE_Initialize(void)
}
}
COLOR_gapStart = NB_RESERVED_COLORS/2;
COLOR_gapEnd = NB_RESERVED_COLORS/2;
return TRUE;
}
/***********************************************************************
* TTYDRV_PALETTE_SetMapping
*/
int TTYDRV_PALETTE_SetMapping(
PALETTEOBJ *palPtr, UINT uStart, UINT uNum, BOOL mapOnly)
{
FIXME("(%p, %u, %u, %d): stub\n", palPtr, uStart, uNum, mapOnly);
return 0;
}
/***********************************************************************
* TTYDRV_PALETTE_UpdateMapping
*/
int TTYDRV_PALETTE_UpdateMapping(PALETTEOBJ *palPtr)
{
TRACE("(%p)\n", palPtr);
return 0;
}
/***********************************************************************
* TTYDRV_PALETTE_IsDark
*/
int TTYDRV_PALETTE_IsDark(int pixel)
{
FIXME("(%d): stub\n", pixel);
return 0;
}
......@@ -113,12 +113,7 @@ INT TTYDRV_DC_SetDIBitsToDevice(TTYDRV_PDEVICE *physDev, INT xDest, INT yDest, D
/* TTY GDI palette driver */
extern struct tagPALETTE_DRIVER TTYDRV_PALETTE_Driver;
extern BOOL TTYDRV_PALETTE_Initialize(void);
extern int TTYDRV_PALETTE_SetMapping(struct tagPALETTEOBJ *palPtr, UINT uStart, UINT uNum, BOOL mapOnly);
extern int TTYDRV_PALETTE_UpdateMapping(struct tagPALETTEOBJ *palPtr);
extern BOOL TTYDRV_PALETTE_IsDark(int pixel);
/**************************************************************************
* TTY USER driver
......
......@@ -158,7 +158,7 @@ static void BRUSH_SelectSolidBrush( X11DRV_PDEVICE *physDev, COLORREF color )
{
DC *dc = physDev->dc;
if ((dc->bitsPerPixel > 1) && (screen_depth <= 8) && !COLOR_IsSolid( color ))
if ((dc->bitsPerPixel > 1) && (screen_depth <= 8) && !X11DRV_IsSolidColor( color ))
{
/* Dithered brush */
physDev->brush.pixmap = BRUSH_DitherColor( dc, color );
......
......@@ -53,12 +53,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(palette);
*/
extern PALETTEENTRY *COLOR_sysPal;
extern int COLOR_gapStart;
extern int COLOR_gapEnd;
extern int COLOR_gapFilled;
extern int COLOR_max;
extern const PALETTEENTRY COLOR_sysPalTemplate[NB_RESERVED_COLORS];
extern const PALETTEENTRY COLOR_sysPalTemplate[NB_RESERVED_COLORS];
static int COLOR_gapStart = 256;
static int COLOR_gapEnd = -1;
static int COLOR_gapFilled = 0;
static int COLOR_max = 256;
Colormap X11DRV_PALETTE_PaletteXColormap = 0;
UINT16 X11DRV_PALETTE_PaletteFlags = 0;
......@@ -714,6 +714,31 @@ static void X11DRV_PALETTE_FillDefaultColors(void)
/***********************************************************************
* X11DRV_IsSolidColor
*
* Check whether 'color' can be represented with a solid color.
*/
BOOL X11DRV_IsSolidColor( COLORREF color )
{
int i;
const PALETTEENTRY *pEntry = COLOR_sysPal;
if (color & 0xff000000) return TRUE; /* indexed color */
if (!color || (color == 0xffffff)) return TRUE; /* black or white */
for (i = 0; i < 256 ; i++, pEntry++)
{
if( i < COLOR_gapStart || i > COLOR_gapEnd )
if ((GetRValue(color) == pEntry->peRed) &&
(GetGValue(color) == pEntry->peGreen) &&
(GetBValue(color) == pEntry->peBlue)) return TRUE;
}
return FALSE;
}
/***********************************************************************
* X11DRV_PALETTE_ToLogical
*
* Return RGB color for given X pixel.
......
......@@ -28,8 +28,6 @@
#define PC_SYS_RESERVED 0x40 /* system palentry is not to be mapped to */
#define PC_SYS_MAPPED 0x10 /* logical palentry is a direct alias for system palentry */
extern BOOL COLOR_IsSolid(COLORREF color);
extern COLORREF COLOR_GetSystemPaletteEntry(UINT);
extern const PALETTEENTRY *COLOR_GetSystemPaletteTemplate(void);
......
......@@ -37,11 +37,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(palette);
PALETTEENTRY *COLOR_sysPal = NULL; /* current system palette */
int COLOR_gapStart = 256;
int COLOR_gapEnd = -1;
int COLOR_gapFilled = 0;
int COLOR_max = 256;
const PALETTEENTRY COLOR_sysPalTemplate[NB_RESERVED_COLORS] =
{
/* first 10 entries in the system palette */
......@@ -93,30 +88,6 @@ COLORREF COLOR_GetSystemPaletteEntry(UINT i)
}
/***********************************************************************
* COLOR_IsSolid
*
* Check whether 'color' can be represented with a solid color.
*/
BOOL COLOR_IsSolid( COLORREF color )
{
int i;
const PALETTEENTRY *pEntry = COLOR_sysPal;
if (color & 0xff000000) return TRUE; /* indexed color */
if (!color || (color == 0xffffff)) return TRUE; /* black or white */
for (i = 0; i < 256 ; i++, pEntry++)
{
if( i < COLOR_gapStart || i > COLOR_gapEnd )
if ((GetRValue(color) == pEntry->peRed) &&
(GetGValue(color) == pEntry->peGreen) &&
(GetBValue(color) == pEntry->peBlue)) return TRUE;
}
return FALSE;
}
/***********************************************************************
* COLOR_PaletteLookupPixel
*/
int COLOR_PaletteLookupPixel( PALETTEENTRY* palPalEntry, int size,
......
......@@ -466,9 +466,8 @@ BOOL WINAPI AnimatePalette(
UINT u;
for( u = 0; u < NumEntries; u++ )
palPtr->logpalette.palPalEntry[u + StartIndex] = PaletteColors[u];
PALETTE_Driver->
pSetMapping(palPtr, StartIndex, NumEntries,
hPal != hPrimaryPalette );
if (PALETTE_Driver) PALETTE_Driver->pSetMapping(palPtr, StartIndex, NumEntries,
hPal != hPrimaryPalette );
GDI_ReleaseObj( hPal );
return TRUE;
}
......@@ -746,11 +745,10 @@ UINT16 WINAPI GDIRealizePalette16( HDC16 hdc )
FIXME("invalid selected palette %04x\n",dc->hPalette);
return 0;
}
realized = PALETTE_Driver->
pSetMapping(palPtr,0,palPtr->logpalette.palNumEntries,
(dc->hPalette != hPrimaryPalette) ||
(dc->hPalette == GetStockObject( DEFAULT_PALETTE )));
if (PALETTE_Driver)
realized = PALETTE_Driver->pSetMapping(palPtr,0,palPtr->logpalette.palNumEntries,
(dc->hPalette != hPrimaryPalette) ||
(dc->hPalette == GetStockObject( DEFAULT_PALETTE )));
hLastRealizedPalette = dc->hPalette;
GDI_ReleaseObj( dc->hPalette );
}
......@@ -782,7 +780,7 @@ UINT16 WINAPI RealizeDefaultPalette16( HDC16 hdc )
if (palPtr)
{
/* lookup is needed to account for SetSystemPaletteUse() stuff */
ret = PALETTE_Driver->pUpdateMapping(palPtr);
if (PALETTE_Driver) ret = PALETTE_Driver->pUpdateMapping(palPtr);
GDI_ReleaseObj( GetStockObject(DEFAULT_PALETTE) );
}
}
......
......@@ -1027,7 +1027,7 @@ HCURSOR16 CURSORICON_IconToCursor(HICON16 hIcon, BOOL bSemiTransparent)
unsigned *psc = (unsigned*)(psPtr + (ix * bpp)/8);
unsigned val = ((*psc) >> (ix * bpp)%8) & val_base;
if(!PALETTE_Driver->pIsDark(val))
if(PALETTE_Driver && !PALETTE_Driver->pIsDark(val))
{
pbc = pxbPtr + ix/8;
*pbc |= 0x80 >> (ix%8);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment