Cleaned up some inter-dll dependencies in palette management.
diff --git a/dlls/ttydrv/dc.c b/dlls/ttydrv/dc.c
index 9a1c6f9..acbac12 100644
--- a/dlls/ttydrv/dc.c
+++ b/dlls/ttydrv/dc.c
@@ -31,13 +31,6 @@
/**********************************************************************/
-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 @@
*/
BOOL TTYDRV_GDI_Initialize(void)
{
- PALETTE_Driver = &TTYDRV_PALETTE_Driver;
-
return TTYDRV_PALETTE_Initialize();
}
diff --git a/dlls/ttydrv/palette.c b/dlls/ttydrv/palette.c
index ac359f9..7a25ad2 100644
--- a/dlls/ttydrv/palette.c
+++ b/dlls/ttydrv/palette.c
@@ -33,10 +33,6 @@
/**********************************************************************/
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 @@
}
}
- 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;
-}
diff --git a/dlls/ttydrv/ttydrv.h b/dlls/ttydrv/ttydrv.h
index 1bcc57e..7e24df9 100644
--- a/dlls/ttydrv/ttydrv.h
+++ b/dlls/ttydrv/ttydrv.h
@@ -113,12 +113,7 @@
/* 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
diff --git a/graphics/x11drv/brush.c b/graphics/x11drv/brush.c
index 27b13c4..aa8ccc7 100644
--- a/graphics/x11drv/brush.c
+++ b/graphics/x11drv/brush.c
@@ -158,7 +158,7 @@
{
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 );
diff --git a/graphics/x11drv/palette.c b/graphics/x11drv/palette.c
index 0a69f0e..7f2a7f0 100644
--- a/graphics/x11drv/palette.c
+++ b/graphics/x11drv/palette.c
@@ -53,12 +53,12 @@
*/
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 @@
/***********************************************************************
+ * 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.
diff --git a/include/color.h b/include/color.h
index af63f2f..43b73ed 100644
--- a/include/color.h
+++ b/include/color.h
@@ -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);
diff --git a/objects/color.c b/objects/color.c
index e6c4f9e..311a926 100644
--- a/objects/color.c
+++ b/objects/color.c
@@ -37,11 +37,6 @@
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 @@
}
/***********************************************************************
- * 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,
diff --git a/objects/palette.c b/objects/palette.c
index f789e8d..32dac05 100644
--- a/objects/palette.c
+++ b/objects/palette.c
@@ -466,9 +466,8 @@
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 @@
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 @@
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) );
}
}
diff --git a/windows/cursoricon.c b/windows/cursoricon.c
index 6331572..022b735 100644
--- a/windows/cursoricon.c
+++ b/windows/cursoricon.c
@@ -1027,7 +1027,7 @@
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);