summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/x11/xm_api.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-11-12 11:50:31 -0700
committerBrian Paul <[email protected]>2011-11-15 07:49:25 -0700
commitbc63b226bcc94f109906bccce26d47509f28d177 (patch)
treeba944ec9581ec534f54bab6267b4a0808fd6402f /src/mesa/drivers/x11/xm_api.c
parentc9bfad2921904780d982917def276a6979a5debd (diff)
xlib: remove a ton of old xlib driver cruft
The days of 1-bpp, 8-bpp and dithering are long behind us. Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/drivers/x11/xm_api.c')
-rw-r--r--src/mesa/drivers/x11/xm_api.c489
1 files changed, 0 insertions, 489 deletions
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c
index 5513f68d901..7d602801ab5 100644
--- a/src/mesa/drivers/x11/xm_api.c
+++ b/src/mesa/drivers/x11/xm_api.c
@@ -88,68 +88,6 @@ _glthread_Mutex _xmesa_lock;
-/**
- * Lookup tables for HPCR pixel format:
- */
-static short hpcr_rgbTbl[3][256] = {
-{
- 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23,
- 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31,
- 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
-112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
-128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
-144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
-160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
-176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
-192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
-208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
-224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239
-},
-{
- 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23,
- 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31,
- 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
-112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
-128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
-144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
-160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
-176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
-192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
-208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
-224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239
-},
-{
- 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39,
- 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47,
- 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55,
- 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63,
- 64, 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71,
- 72, 72, 73, 73, 74, 74, 75, 75, 76, 76, 77, 77, 78, 78, 79, 79,
- 80, 80, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87,
- 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
-112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
-128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
-144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159,
-160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175,
-176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
-192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
-208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223
-}
-};
-
-
-
/**********************************************************************/
/***** X Utility Functions *****/
/**********************************************************************/
@@ -470,21 +408,6 @@ xmesa_free_buffer(XMesaBuffer buffer)
}
-/**
- * Copy X color table stuff from one XMesaBuffer to another.
- */
-static void
-copy_colortable_info(XMesaBuffer dst, const XMesaBuffer src)
-{
- memcpy(dst->color_table, src->color_table, sizeof(src->color_table));
- memcpy(dst->pixel_to_r, src->pixel_to_r, sizeof(src->pixel_to_r));
- memcpy(dst->pixel_to_g, src->pixel_to_g, sizeof(src->pixel_to_g));
- memcpy(dst->pixel_to_b, src->pixel_to_b, sizeof(src->pixel_to_b));
- dst->num_alloced = src->num_alloced;
- memcpy(dst->alloced_colors, src->alloced_colors,
- sizeof(src->alloced_colors));
-}
-
/**********************************************************************/
@@ -493,325 +416,6 @@ copy_colortable_info(XMesaBuffer dst, const XMesaBuffer src)
/**
- * A replacement for XAllocColor. This function should never
- * fail to allocate a color. When XAllocColor fails, we return
- * the nearest matching color. If we have to allocate many colors
- * this function isn't too efficient; the XQueryColors() could be
- * done just once.
- * Written by Michael Pichler, Brian Paul, Mark Kilgard
- * Input: dpy - X display
- * cmap - X colormap
- * cmapSize - size of colormap
- * In/Out: color - the XColor struct
- * Output: exact - 1=exact color match, 0=closest match
- * alloced - 1=XAlloc worked, 0=XAlloc failed
- */
-static void
-noFaultXAllocColor( int client,
- XMesaDisplay *dpy,
- XMesaColormap cmap,
- int cmapSize,
- XMesaColor *color,
- int *exact, int *alloced )
-{
- /* we'll try to cache ctable for better remote display performance */
- static Display *prevDisplay = NULL;
- static XMesaColormap prevCmap = 0;
- static int prevCmapSize = 0;
- static XMesaColor *ctable = NULL;
- XMesaColor subColor;
- int i, bestmatch;
- double mindist; /* 3*2^16^2 exceeds long int precision. */
-
- (void) client;
-
- /* First try just using XAllocColor. */
- if (XAllocColor(dpy, cmap, color))
- {
- *exact = 1;
- *alloced = 1;
- return;
- }
-
- /* Alloc failed, search for closest match */
-
- /* Retrieve color table entries. */
- /* XXX alloca candidate. */
- if (prevDisplay != dpy || prevCmap != cmap
- || prevCmapSize != cmapSize || !ctable) {
- /* free previously cached color table */
- if (ctable)
- free(ctable);
- /* Get the color table from X */
- ctable = (XMesaColor *) MALLOC(cmapSize * sizeof(XMesaColor));
- assert(ctable);
- for (i = 0; i < cmapSize; i++) {
- ctable[i].pixel = i;
- }
- XQueryColors(dpy, cmap, ctable, cmapSize);
- prevDisplay = dpy;
- prevCmap = cmap;
- prevCmapSize = cmapSize;
- }
-
- /* Find best match. */
- bestmatch = -1;
- mindist = 0.0;
- for (i = 0; i < cmapSize; i++) {
- double dr = 0.30 * ((double) color->red - (double) ctable[i].red);
- double dg = 0.59 * ((double) color->green - (double) ctable[i].green);
- double db = 0.11 * ((double) color->blue - (double) ctable[i].blue);
- double dist = dr * dr + dg * dg + db * db;
- if (bestmatch < 0 || dist < mindist) {
- bestmatch = i;
- mindist = dist;
- }
- }
-
- /* Return result. */
- subColor.red = ctable[bestmatch].red;
- subColor.green = ctable[bestmatch].green;
- subColor.blue = ctable[bestmatch].blue;
- /* Try to allocate the closest match color. This should only
- * fail if the cell is read/write. Otherwise, we're incrementing
- * the cell's reference count.
- */
- if (XAllocColor(dpy, cmap, &subColor)) {
- *alloced = 1;
- }
- else {
- /* do this to work around a problem reported by Frank Ortega */
- subColor.pixel = (unsigned long) bestmatch;
- subColor.red = ctable[bestmatch].red;
- subColor.green = ctable[bestmatch].green;
- subColor.blue = ctable[bestmatch].blue;
- subColor.flags = DoRed | DoGreen | DoBlue;
- *alloced = 0;
- }
- /* don't free table, save it for next time */
-
- *color = subColor;
- *exact = 0;
-}
-
-
-
-/**
- * Do setup for PF_GRAYSCALE pixel format.
- * Note that buffer may be NULL.
- */
-static GLboolean
-setup_grayscale(int client, XMesaVisual v,
- XMesaBuffer buffer, XMesaColormap cmap)
-{
- if (GET_VISUAL_DEPTH(v)<4 || GET_VISUAL_DEPTH(v)>16) {
- return GL_FALSE;
- }
-
- if (buffer) {
- XMesaBuffer prevBuffer;
-
- if (!cmap) {
- return GL_FALSE;
- }
-
- prevBuffer = xmesa_find_buffer(v->display, cmap, buffer);
- if (prevBuffer) {
- /* Copy colormap stuff from previous XMesaBuffer which uses same
- * X colormap. Do this to avoid time spent in noFaultXAllocColor.
- */
- copy_colortable_info(buffer, prevBuffer);
- }
- else {
- /* Allocate 256 shades of gray */
- int gray;
- int colorsfailed = 0;
- for (gray=0;gray<256;gray++) {
- GLint r = gamma_adjust( v->RedGamma, gray, 255 );
- GLint g = gamma_adjust( v->GreenGamma, gray, 255 );
- GLint b = gamma_adjust( v->BlueGamma, gray, 255 );
- int exact, alloced;
- XMesaColor xcol;
- xcol.red = (r << 8) | r;
- xcol.green = (g << 8) | g;
- xcol.blue = (b << 8) | b;
- noFaultXAllocColor( client, v->display,
- cmap, GET_COLORMAP_SIZE(v),
- &xcol, &exact, &alloced );
- if (!exact) {
- colorsfailed++;
- }
- if (alloced) {
- assert(buffer->num_alloced<256);
- buffer->alloced_colors[buffer->num_alloced] = xcol.pixel;
- buffer->num_alloced++;
- }
-
- /*OLD
- assert(gray < 576);
- buffer->color_table[gray*3+0] = xcol.pixel;
- buffer->color_table[gray*3+1] = xcol.pixel;
- buffer->color_table[gray*3+2] = xcol.pixel;
- assert(xcol.pixel < 65536);
- buffer->pixel_to_r[xcol.pixel] = gray * 30 / 100;
- buffer->pixel_to_g[xcol.pixel] = gray * 59 / 100;
- buffer->pixel_to_b[xcol.pixel] = gray * 11 / 100;
- */
- buffer->color_table[gray] = xcol.pixel;
- assert(xcol.pixel < 65536);
- buffer->pixel_to_r[xcol.pixel] = gray;
- buffer->pixel_to_g[xcol.pixel] = gray;
- buffer->pixel_to_b[xcol.pixel] = gray;
- }
-
- if (colorsfailed && _mesa_getenv("MESA_DEBUG")) {
- _mesa_warning(NULL,
- "Note: %d out of 256 needed colors do not match exactly.\n",
- colorsfailed );
- }
- }
- }
-
- v->dithered_pf = PF_Grayscale;
- v->undithered_pf = PF_Grayscale;
- return GL_TRUE;
-}
-
-
-
-/**
- * Setup RGB rendering for a window with a PseudoColor, StaticColor,
- * or 8-bit TrueColor visual visual. We try to allocate a palette of 225
- * colors (5 red, 9 green, 5 blue) and dither to approximate a 24-bit RGB
- * color. While this function was originally designed just for 8-bit
- * visuals, it has also proven to work from 4-bit up to 16-bit visuals.
- * Dithering code contributed by Bob Mercier.
- */
-static GLboolean
-setup_dithered_color(int client, XMesaVisual v,
- XMesaBuffer buffer, XMesaColormap cmap)
-{
- if (GET_VISUAL_DEPTH(v)<4 || GET_VISUAL_DEPTH(v)>16) {
- return GL_FALSE;
- }
-
- if (buffer) {
- XMesaBuffer prevBuffer;
-
- if (!cmap) {
- return GL_FALSE;
- }
-
- prevBuffer = xmesa_find_buffer(v->display, cmap, buffer);
- if (prevBuffer) {
- /* Copy colormap stuff from previous, matching XMesaBuffer.
- * Do this to avoid time spent in noFaultXAllocColor.
- */
- copy_colortable_info(buffer, prevBuffer);
- }
- else {
- /* Allocate X colors and initialize color_table[], red_table[], etc */
- int r, g, b, i;
- int colorsfailed = 0;
- for (r = 0; r < DITH_R; r++) {
- for (g = 0; g < DITH_G; g++) {
- for (b = 0; b < DITH_B; b++) {
- XMesaColor xcol;
- int exact, alloced;
- xcol.red =gamma_adjust(v->RedGamma, r*65535/(DITH_R-1),65535);
- xcol.green=gamma_adjust(v->GreenGamma, g*65535/(DITH_G-1),65535);
- xcol.blue =gamma_adjust(v->BlueGamma, b*65535/(DITH_B-1),65535);
- noFaultXAllocColor( client, v->display,
- cmap, GET_COLORMAP_SIZE(v),
- &xcol, &exact, &alloced );
- if (!exact) {
- colorsfailed++;
- }
- if (alloced) {
- assert(buffer->num_alloced<256);
- buffer->alloced_colors[buffer->num_alloced] = xcol.pixel;
- buffer->num_alloced++;
- }
- i = DITH_MIX( r, g, b );
- assert(i < 576);
- buffer->color_table[i] = xcol.pixel;
- assert(xcol.pixel < 65536);
- buffer->pixel_to_r[xcol.pixel] = r * 255 / (DITH_R-1);
- buffer->pixel_to_g[xcol.pixel] = g * 255 / (DITH_G-1);
- buffer->pixel_to_b[xcol.pixel] = b * 255 / (DITH_B-1);
- }
- }
- }
-
- if (colorsfailed && _mesa_getenv("MESA_DEBUG")) {
- _mesa_warning(NULL,
- "Note: %d out of %d needed colors do not match exactly.\n",
- colorsfailed, DITH_R * DITH_G * DITH_B );
- }
- }
- }
-
- v->dithered_pf = PF_Dither;
- v->undithered_pf = PF_Lookup;
- return GL_TRUE;
-}
-
-
-/**
- * Setup for Hewlett Packard Color Recovery 8-bit TrueColor mode.
- * HPCR simulates 24-bit color fidelity with an 8-bit frame buffer.
- * Special dithering tables have to be initialized.
- */
-static void
-setup_8bit_hpcr(XMesaVisual v)
-{
- /* HP Color Recovery contributed by: Alex De Bruyn ([email protected])
- * To work properly, the atom _HP_RGB_SMOOTH_MAP_LIST must be defined
- * on the root window AND the colormap obtainable by XGetRGBColormaps
- * for that atom must be set on the window. (see also tkInitWindow)
- * If that colormap is not set, the output will look stripy.
- */
-
- /* Setup color tables with gamma correction */
- int i;
- double g;
-
- g = 1.0 / v->RedGamma;
- for (i=0; i<256; i++) {
- GLint red = IROUND_POS(255.0 * pow( hpcr_rgbTbl[0][i]/255.0, g ));
- v->hpcr_rgbTbl[0][i] = CLAMP( red, 16, 239 );
- }
-
- g = 1.0 / v->GreenGamma;
- for (i=0; i<256; i++) {
- GLint green = IROUND_POS(255.0 * pow( hpcr_rgbTbl[1][i]/255.0, g ));
- v->hpcr_rgbTbl[1][i] = CLAMP( green, 16, 239 );
- }
-
- g = 1.0 / v->BlueGamma;
- for (i=0; i<256; i++) {
- GLint blue = IROUND_POS(255.0 * pow( hpcr_rgbTbl[2][i]/255.0, g ));
- v->hpcr_rgbTbl[2][i] = CLAMP( blue, 32, 223 );
- }
- v->undithered_pf = PF_HPCR; /* can't really disable dithering for now */
- v->dithered_pf = PF_HPCR;
-
- /* which method should I use to clear */
- /* GL_FALSE: keep the ordinary method */
- /* GL_TRUE : clear with dither pattern */
- v->hpcr_clear_flag = _mesa_getenv("MESA_HPCR_CLEAR") ? GL_TRUE : GL_FALSE;
-
- if (v->hpcr_clear_flag) {
- v->hpcr_clear_pixmap = XMesaCreatePixmap(v->display,
- DefaultRootWindow(v->display),
- 16, 2, 8);
- v->hpcr_clear_ximage = XGetImage(v->display, v->hpcr_clear_pixmap,
- 0, 0, 16, 2, AllPlanes, ZPixmap);
- }
-}
-
-
-/**
* Setup RGB rendering for a window with a True/DirectColor visual.
*/
static void
@@ -936,31 +540,9 @@ setup_truecolor(XMesaVisual v, XMesaBuffer buffer, XMesaColormap cmap)
v->undithered_pf = PF_5R6G5B;
v->dithered_pf = PF_Dither_5R6G5B;
}
- else if (GET_REDMASK(v) ==0xe0
- && GET_GREENMASK(v)==0x1c
- && GET_BLUEMASK(v) ==0x03
- && CHECK_FOR_HPCR(v)) {
- /* 8-bit HP color recovery */
- setup_8bit_hpcr( v );
- }
-}
-
-
-
-/**
- * Setup RGB rendering for a window with a monochrome visual.
- */
-static void
-setup_monochrome( XMesaVisual v, XMesaBuffer b )
-{
- (void) b;
- v->dithered_pf = v->undithered_pf = PF_1Bit;
- /* if black=1 then we must flip pixel values */
- v->bitFlip = (GET_BLACK_PIXEL(v) != 0);
}
-
/**
* When a context is bound for the first time, we can finally finish
* initializing the context's visual and buffer information.
@@ -976,7 +558,6 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
XMesaDrawable window,
XMesaColormap cmap)
{
- int client = 0;
const int xclass = v->visualType;
@@ -992,20 +573,6 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
if (xclass == GLX_TRUE_COLOR || xclass == GLX_DIRECT_COLOR) {
setup_truecolor( v, b, cmap );
}
- else if (xclass == GLX_STATIC_GRAY && GET_VISUAL_DEPTH(v) == 1) {
- setup_monochrome( v, b );
- }
- else if (xclass == GLX_GRAY_SCALE || xclass == GLX_STATIC_GRAY) {
- if (!setup_grayscale( client, v, b, cmap )) {
- return GL_FALSE;
- }
- }
- else if ((xclass == GLX_PSEUDO_COLOR || xclass == GLX_STATIC_COLOR)
- && GET_VISUAL_DEPTH(v)>=4 && GET_VISUAL_DEPTH(v)<=16) {
- if (!setup_dithered_color( client, v, b, cmap )) {
- return GL_FALSE;
- }
- }
else {
_mesa_warning(NULL, "XMesa: RGB mode rendering not supported in given visual.\n");
return GL_FALSE;
@@ -1065,23 +632,6 @@ initialize_visual_and_buffer(XMesaVisual v, XMesaBuffer b,
GCGraphicsExposures, &gcvalues);
}
XMesaSetFunction( v->display, b->swapgc, GXcopy );
- /*
- * Set fill style and tile pixmap once for all for HPCR stuff
- * (instead of doing it each time in clear_color_HPCR_pixmap())
- * Initialize whole stuff
- * Patch contributed by Jacques Leroy March 8, 1998.
- */
- if (v->hpcr_clear_flag && b->backxrb && b->backxrb->pixmap) {
- int i;
- for (i = 0; i < 16; i++) {
- XMesaPutPixel(v->hpcr_clear_ximage, i, 0, 0);
- XMesaPutPixel(v->hpcr_clear_ximage, i, 1, 0);
- }
- XMesaPutImage(b->display, (XMesaDrawable) v->hpcr_clear_pixmap,
- b->cleargc, v->hpcr_clear_ximage, 0, 0, 0, 0, 16, 2);
- XMesaSetFillStyle( v->display, b->cleargc, FillTiled);
- XMesaSetTile( v->display, b->cleargc, v->hpcr_clear_pixmap );
- }
/* Initialize the row buffer XImage for use in write_color_span() */
data = (char*) MALLOC(MAX_WIDTH*4);
@@ -1112,8 +662,6 @@ xmesa_color_to_pixel(struct gl_context *ctx,
{
XMesaContext xmesa = XMESA_CONTEXT(ctx);
switch (pixelFormat) {
- case PF_Index:
- return 0;
case PF_Truecolor:
{
unsigned long p;
@@ -1130,23 +678,6 @@ xmesa_color_to_pixel(struct gl_context *ctx,
return PACK_8R8G8B( r, g, b );
case PF_5R6G5B:
return PACK_5R6G5B( r, g, b );
- case PF_Dither:
- {
- DITHER_SETUP;
- return DITHER( 1, 0, r, g, b );
- }
- case PF_1Bit:
- /* 382 = (3*255)/2 */
- return ((r+g+b) > 382) ^ xmesa->xm_visual->bitFlip;
- case PF_HPCR:
- return DITHER_HPCR(1, 1, r, g, b);
- case PF_Lookup:
- {
- LOOKUP_SETUP;
- return LOOKUP( r, g, b );
- }
- case PF_Grayscale:
- return GRAY_RGB( r, g, b );
case PF_Dither_True:
/* fall through */
case PF_Dither_5R6G5B:
@@ -2046,15 +1577,12 @@ unsigned long XMesaDitherColor( XMesaContext xmesa, GLint x, GLint y,
GLfloat red, GLfloat green,
GLfloat blue, GLfloat alpha )
{
- struct gl_context *ctx = &xmesa->mesa;
GLint r = (GLint) (red * 255.0F);
GLint g = (GLint) (green * 255.0F);
GLint b = (GLint) (blue * 255.0F);
GLint a = (GLint) (alpha * 255.0F);
switch (xmesa->pixelformat) {
- case PF_Index:
- return 0;
case PF_Truecolor:
{
unsigned long p;
@@ -2069,23 +1597,6 @@ unsigned long XMesaDitherColor( XMesaContext xmesa, GLint x, GLint y,
return PACK_8R8G8B( r, g, b );
case PF_5R6G5B:
return PACK_5R6G5B( r, g, b );
- case PF_Dither:
- {
- DITHER_SETUP;
- return DITHER( x, y, r, g, b );
- }
- case PF_1Bit:
- /* 382 = (3*255)/2 */
- return ((r+g+b) > 382) ^ xmesa->xm_visual->bitFlip;
- case PF_HPCR:
- return DITHER_HPCR(x, y, r, g, b);
- case PF_Lookup:
- {
- LOOKUP_SETUP;
- return LOOKUP( r, g, b );
- }
- case PF_Grayscale:
- return GRAY_RGB( r, g, b );
case PF_Dither_5R6G5B:
/* fall through */
case PF_Dither_True: