8-Bit Colormap fix
Gavriel State
gav at transgaming.com
Sun Apr 15 11:40:27 CDT 2001
This patch fixes some of the 8-bit problems my earlier OpenGL visual
management patch created. Since we're no longer using the default
colormap directly, we have to copy some of the colors out of it to
reduce colormap flashing.
Log:
Gavriel State <gav at transgaming.com>
Copy the first 128 colors from the default colormap to Wine's private
colormap when using 'shared' colors.
--
Gavriel State, CEO
TransGaming Technologies Inc.
http://www.transgaming.com
gav at transgaming.com
-------------- next part --------------
Index: graphics/x11drv/palette.c
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/palette.c,v
retrieving revision 1.20
diff -u -r1.20 palette.c
--- graphics/x11drv/palette.c 2001/03/28 01:45:09 1.20
+++ graphics/x11drv/palette.c 2001/04/15 16:17:58
@@ -312,14 +312,28 @@
int i, j, warn = 0;
int diff, r, g, b, max = 256, bp = 0, wp = 1;
int step = 1;
+ int defaultCM_max_copy;
+ Colormap defaultCM;
+ XColor defaultColors[256];
+ /* Copy the first bunch of colors out of the default colormap to prevent
+ * colormap flashing as much as possible. We're likely to get the most
+ * important Window Manager colors, etc in the first 128 colors */
+ defaultCM = DefaultColormapOfScreen( X11DRV_GetXScreen() );
+ defaultCM_max_copy = PROFILE_GetWineIniInt( "x11drv", "CopyDefaultColors", 128);
+ for (i = 0; i < defaultCM_max_copy; i++)
+ defaultColors[i].pixel = (long) i;
+ TSXQueryColors(display, defaultCM, &defaultColors[0], defaultCM_max_copy);
+ for (i = 0; i < defaultCM_max_copy; i++)
+ TSXAllocColor( display, X11DRV_PALETTE_PaletteXColormap, &defaultColors[i] );
+
/* read "AllocSystemColors" from wine.conf */
COLOR_max = PROFILE_GetWineIniInt( "x11drv", "AllocSystemColors", 256);
if (COLOR_max > 256) COLOR_max = 256;
else if (COLOR_max < 20) COLOR_max = 20;
TRACE("%d colors configured.\n", COLOR_max);
-
+
TRACE("Building shared map - %i palette entries\n", X11DRV_DevCaps.sizePalette);
/* Be nice and allocate system colors as read-only */
Index: include/ts_xlib.h
===================================================================
RCS file: /home/wine/wine/include/ts_xlib.h,v
retrieving revision 1.15
diff -u -r1.15 ts_xlib.h
--- include/ts_xlib.h 2000/12/06 00:04:11 1.15
+++ include/ts_xlib.h 2001/04/15 16:17:58
@@ -106,6 +106,7 @@
extern int TSXPutBackEvent(Display*, XEvent*);
extern int TSXPutImage(Display*, Drawable, GC, XImage*, int, int, int, int, unsigned int, unsigned int);
extern int TSXQueryColor(Display*, Colormap, XColor*);
+extern int TSXQueryColors(Display*, Colormap, XColor*, int);
extern int TSXQueryKeymap(Display*, char*);
extern int TSXQueryPointer(Display*, Window, Window*, Window*, int*, int*, int*, int*, unsigned int*);
extern int TSXQueryTree(Display*, Window, Window*, Window*, Window**, unsigned int*);
Index: tsx11/X11_calls
===================================================================
RCS file: /home/wine/wine/tsx11/X11_calls,v
retrieving revision 1.19
diff -u -r1.19 X11_calls
--- tsx11/X11_calls 2000/09/06 19:47:00 1.19
+++ tsx11/X11_calls 2001/04/15 16:17:59
@@ -109,6 +109,7 @@
XPutBackEvent
XPutImage
XQueryColor
+XQueryColors
XQueryKeymap
XQueryPointer
XQueryTree
Index: tsx11/ts_xlib.c
===================================================================
RCS file: /home/wine/wine/tsx11/ts_xlib.c,v
retrieving revision 1.18
diff -u -r1.18 ts_xlib.c
--- tsx11/ts_xlib.c 2000/12/06 00:04:11 1.18
+++ tsx11/ts_xlib.c 2001/04/15 16:17:59
@@ -811,6 +811,15 @@
return r;
}
+int TSXQueryColors(Display* a0, Colormap a1, XColor* a2, int a3)
+{
+ int r;
+ wine_tsx11_lock();
+ r = XQueryColors(a0, a1, a2, a3);
+ wine_tsx11_unlock();
+ return r;
+}
+
int TSXQueryKeymap(Display* a0, char* a1)
{
int r;
More information about the wine-patches
mailing list