Cleaned up some inter-dll dependencies in palette management.
This commit is contained in:
parent
7200ca9803
commit
5cab46ee58
|
@ -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;
|
||||
|
@ -713,6 +713,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
|
||||
*
|
||||
|
|
|
@ -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 */
|
||||
|
@ -92,30 +87,6 @@ COLORREF COLOR_GetSystemPaletteEntry(UINT i)
|
|||
return *(COLORREF*)(COLOR_sysPal + i) & 0x00ffffff;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* 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
|
||||
*/
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue