From: Brian Paul Date: Sat, 12 Nov 2011 18:50:31 +0000 (-0700) Subject: xlib: remove a ton of old xlib driver cruft X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bc63b226bcc94f109906bccce26d47509f28d177;p=mesa.git 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 --- 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)); -} - /**********************************************************************/ @@ -492,325 +415,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 (ad@lms.be) - * 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. */ @@ -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: diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index cd059fc09d9..11b7c244ea9 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -255,7 +255,6 @@ xmesa_alloc_front_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb); /* just clear these to be sure we don't accidentally use them */ - xrb->origin1 = NULL; xrb->origin2 = NULL; xrb->origin3 = NULL; xrb->origin4 = NULL; @@ -291,10 +290,6 @@ xmesa_alloc_back_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, /* plus... */ if (xrb->ximage) { - /* Needed by PIXELADDR1 macro */ - xrb->width1 = xrb->ximage->bytes_per_line; - xrb->origin1 = (GLubyte *) xrb->ximage->data + xrb->width1 * (height - 1); - /* Needed by PIXELADDR2 macro */ xrb->width2 = xrb->ximage->bytes_per_line / 2; xrb->origin2 = (GLushort *) xrb->ximage->data + xrb->width2 * (height - 1); @@ -309,8 +304,7 @@ xmesa_alloc_back_storage(struct gl_context *ctx, struct gl_renderbuffer *rb, } else { /* out of memory or buffer size is 0 x 0 */ - xrb->width1 = xrb->width2 = xrb->width3 = xrb->width4 = 0; - xrb->origin1 = NULL; + xrb->width2 = xrb->width3 = xrb->width4 = 0; xrb->origin2 = NULL; xrb->origin3 = NULL; xrb->origin4 = NULL; @@ -412,11 +406,6 @@ xmesa_delete_framebuffer(struct gl_framebuffer *fb) } if (b->backxrb->pixmap) { XMesaFreePixmap( b->display, b->backxrb->pixmap ); - if (b->xm_visual->hpcr_clear_flag) { - XMesaFreePixmap( b->display, - b->xm_visual->hpcr_clear_pixmap ); - XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage ); - } } } diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index c896716c0bc..9ab77e2a631 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -30,22 +30,13 @@ #include "glxheader.h" #include "main/bufferobj.h" -#include "main/buffers.h" #include "main/context.h" #include "main/colormac.h" -#include "main/depth.h" -#include "main/drawpix.h" -#include "main/extensions.h" -#include "main/framebuffer.h" #include "main/macros.h" #include "main/image.h" #include "main/imports.h" #include "main/mtypes.h" #include "main/pbo.h" -#include "main/state.h" -#include "main/texobj.h" -#include "main/teximage.h" -#include "main/texstore.h" #include "main/texformat.h" #include "swrast/swrast.h" #include "swrast/s_context.h" @@ -56,41 +47,6 @@ #include "xmesaP.h" - -/* - * Dithering kernels and lookup tables. - */ - -const int xmesa_kernel8[DITH_DY * DITH_DX] = { - 0 * MAXC, 8 * MAXC, 2 * MAXC, 10 * MAXC, - 12 * MAXC, 4 * MAXC, 14 * MAXC, 6 * MAXC, - 3 * MAXC, 11 * MAXC, 1 * MAXC, 9 * MAXC, - 15 * MAXC, 7 * MAXC, 13 * MAXC, 5 * MAXC, -}; - -const short xmesa_HPCR_DRGB[3][2][16] = { - { - { 16, -4, 1,-11, 14, -6, 3, -9, 15, -5, 2,-10, 13, -7, 4, -8}, - {-15, 5, 0, 12,-13, 7, -2, 10,-14, 6, -1, 11,-12, 8, -3, 9} - }, - { - {-11, 15, -7, 3, -8, 14, -4, 2,-10, 16, -6, 4, -9, 13, -5, 1}, - { 12,-14, 8, -2, 9,-13, 5, -1, 11,-15, 7, -3, 10,-12, 6, 0} - }, - { - { 6,-18, 26,-14, 2,-22, 30,-10, 8,-16, 28,-12, 4,-20, 32, -8}, - { -4, 20,-24, 16, 0, 24,-28, 12, -6, 18,-26, 14, -2, 22,-30, 10} - } -}; - -const int xmesa_kernel1[16] = { - 0*47, 9*47, 4*47, 12*47, /* 47 = (255*3)/16 */ - 6*47, 2*47, 14*47, 8*47, - 10*47, 1*47, 5*47, 11*47, - 7*47, 13*47, 3*47, 15*47 -}; - - static void finish_or_flush( struct gl_context *ctx ) { @@ -187,40 +143,6 @@ clear_pixmap(struct gl_context *ctx, struct xmesa_renderbuffer *xrb, } -static void -clear_8bit_ximage( struct gl_context *ctx, struct xmesa_renderbuffer *xrb, - GLint x, GLint y, GLint width, GLint height ) -{ - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - GLint i; - for (i = 0; i < height; i++) { - GLubyte *ptr = PIXEL_ADDR1(xrb, x, y + i); - memset( ptr, xmesa->clearpixel, width ); - } -} - - -static void -clear_HPCR_ximage( struct gl_context *ctx, struct xmesa_renderbuffer *xrb, - GLint x, GLint y, GLint width, GLint height ) -{ - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - GLint i; - for (i = y; i < y + height; i++) { - GLubyte *ptr = PIXEL_ADDR1( xrb, x, i ); - int j; - const GLubyte *sptr = xmesa->xm_visual->hpcr_clear_ximage_pattern[0]; - if (i & 1) { - sptr += 16; - } - for (j = x; j < x + width; j++) { - *ptr = sptr[j&15]; - ptr++; - } - } -} - - static void clear_16bit_ximage( struct gl_context *ctx, struct xmesa_renderbuffer *xrb, GLint x, GLint y, GLint width, GLint height) @@ -767,76 +689,6 @@ enable( struct gl_context *ctx, GLenum pname, GLboolean state ) } -static void -clear_color_HPCR_ximage( struct gl_context *ctx, - const union gl_color_union color ) -{ - int i; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - - _mesa_unclamped_float_rgba_to_ubyte(xmesa->clearcolor, color.f); - - if (color.f[0] == 0.0 && color.f[1] == 0.0 && color.f[2] == 0.0) { - /* black is black */ - memset( xmesa->xm_visual->hpcr_clear_ximage_pattern, 0x0 , - sizeof(xmesa->xm_visual->hpcr_clear_ximage_pattern)); - } - else { - /* build clear pattern */ - for (i=0; i<16; i++) { - xmesa->xm_visual->hpcr_clear_ximage_pattern[0][i] = - DITHER_HPCR(i, 0, - xmesa->clearcolor[0], - xmesa->clearcolor[1], - xmesa->clearcolor[2]); - xmesa->xm_visual->hpcr_clear_ximage_pattern[1][i] = - DITHER_HPCR(i, 1, - xmesa->clearcolor[0], - xmesa->clearcolor[1], - xmesa->clearcolor[2]); - } - } -} - - -static void -clear_color_HPCR_pixmap( struct gl_context *ctx, - const union gl_color_union color ) -{ - int i; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); - - _mesa_unclamped_float_rgba_to_ubyte(xmesa->clearcolor, color.f); - - if (color.f[0] == 0.0 && color.f[1] == 0.0 && color.f[2] == 0.0) { - /* black is black */ - for (i=0; i<16; i++) { - XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 0, 0); - XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 1, 0); - } - } - else { - for (i=0; i<16; i++) { - XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 0, - DITHER_HPCR(i, 0, - xmesa->clearcolor[0], - xmesa->clearcolor[1], - xmesa->clearcolor[2])); - XMesaPutPixel(xmesa->xm_visual->hpcr_clear_ximage, i, 1, - DITHER_HPCR(i, 1, - xmesa->clearcolor[0], - xmesa->clearcolor[1], - xmesa->clearcolor[2])); - } - } - /* change tile pixmap content */ - XMesaPutImage(xmesa->display, - (XMesaDrawable)xmesa->xm_visual->hpcr_clear_pixmap, - XMESA_BUFFER(ctx->DrawBuffer)->cleargc, - xmesa->xm_visual->hpcr_clear_ximage, 0, 0, 0, 0, 16, 2); -} - - /** * Called when the driver should update its state, based on the new_state * flags. @@ -882,14 +734,6 @@ xmesa_update_state( struct gl_context *ctx, GLbitfield new_state ) } else { switch (xmesa->xm_visual->BitsPerPixel) { - case 8: - if (xmesa->xm_visual->hpcr_clear_flag) { - back_xrb->clearFunc = clear_HPCR_ximage; - } - else { - back_xrb->clearFunc = clear_8bit_ximage; - } - break; case 16: back_xrb->clearFunc = clear_16bit_ximage; break; @@ -906,22 +750,6 @@ xmesa_update_state( struct gl_context *ctx, GLbitfield new_state ) } } } - - if (xmesa->xm_visual->hpcr_clear_flag) { - /* this depends on whether we're drawing to the front or back buffer */ - /* XXX FIX THIS! */ -#if 0 - if (pixmap) { - ctx->Driver.ClearColor = clear_color_HPCR_pixmap; - } - else { - ctx->Driver.ClearColor = clear_color_HPCR_ximage; - } -#else - (void) clear_color_HPCR_pixmap; - (void) clear_color_HPCR_ximage; -#endif - } } diff --git a/src/mesa/drivers/x11/xm_line.c b/src/mesa/drivers/x11/xm_line.c index 5f60f4bfd7d..ad0336f3985 100644 --- a/src/mesa/drivers/x11/xm_line.c +++ b/src/mesa/drivers/x11/xm_line.c @@ -31,7 +31,6 @@ #include "glxheader.h" -#include "main/depth.h" #include "main/macros.h" #include "main/mtypes.h" #include "xmesaP.h" @@ -245,63 +244,6 @@ void xmesa_choose_point( struct gl_context *ctx ) - -/* - * Draw a flat-shaded, PF_DITHER 8-bit line into an XImage. - */ -#define NAME flat_DITHER8_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = vert1->color; \ - GLint r = color[0], g = color[1], b = color[2]; \ - DITHER_SETUP; -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) *pixelPtr = DITHER(X,Y,r,g,b); -#include "swrast/s_linetemp.h" - - - -/* - * Draw a flat-shaded, PF_LOOKUP 8-bit line into an XImage. - */ -#define NAME flat_LOOKUP8_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = vert1->color; \ - GLubyte pixel; \ - LOOKUP_SETUP; \ - pixel = (GLubyte) LOOKUP( color[0], color[1], color[2] ); -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X,Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) *pixelPtr = pixel; -#include "swrast/s_linetemp.h" - - - -/* - * Draw a flat-shaded, PF_HPCR line into an XImage. - */ -#define NAME flat_HPCR_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - const GLubyte *color = vert1->color; \ - GLint r = color[0], g = color[1], b = color[2]; -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X,Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) *pixelPtr = (GLubyte) DITHER_HPCR(X,Y,r,g,b); -#include "swrast/s_linetemp.h" - - - - /* * Draw a flat-shaded, Z-less, PF_TRUECOLOR line into an XImage. */ @@ -463,80 +405,6 @@ void xmesa_choose_point( struct gl_context *ctx ) -/* - * Draw a flat-shaded, Z-less, PF_DITHER 8-bit line into an XImage. - */ -#define NAME flat_DITHER8_z_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = vert1->color; \ - GLint r = color[0], g = color[1], b = color[2]; \ - DITHER_SETUP; -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X,Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - *zPtr = Z; \ - *pixelPtr = (GLubyte) DITHER( X, Y, r, g, b); \ - } -#include "swrast/s_linetemp.h" - - - -/* - * Draw a flat-shaded, Z-less, PF_LOOKUP 8-bit line into an XImage. - */ -#define NAME flat_LOOKUP8_z_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - const GLubyte *color = vert1->color; \ - GLubyte pixel; \ - LOOKUP_SETUP; \ - pixel = (GLubyte) LOOKUP( color[0], color[1], color[2] ); -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X,Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - *zPtr = Z; \ - *pixelPtr = pixel; \ - } -#include "swrast/s_linetemp.h" - - - -/* - * Draw a flat-shaded, Z-less, PF_HPCR line into an XImage. - */ -#define NAME flat_HPCR_z_line -#define SETUP_CODE \ - GET_XRB(xrb); \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - const GLubyte *color = vert1->color; \ - GLint r = color[0], g = color[1], b = color[2]; -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X,Y) -#define CLIP_HACK 1 -#define PLOT(X,Y) \ - if (Z < *zPtr) { \ - *zPtr = Z; \ - *pixelPtr = (GLubyte) DITHER_HPCR( X, Y, r, g, b); \ - } -#include "swrast/s_linetemp.h" - - - - /** * Draw fast, XOR line with XDrawLine in front color buffer. * WARNING: this isn't fully OpenGL conformant because different pixels @@ -581,7 +449,6 @@ get_line_func(struct gl_context *ctx) #if CHAN_BITS == 8 SWcontext *swrast = SWRAST_CONTEXT(ctx); XMesaContext xmesa = XMESA_CONTEXT(ctx); - const int depth = GET_VISUAL_DEPTH(xmesa->xm_visual); const struct xmesa_renderbuffer *xrb; if ((ctx->DrawBuffer->_ColorDrawBufferIndexes[0] != BUFFER_BIT_FRONT_LEFT) && @@ -617,12 +484,6 @@ get_line_func(struct gl_context *ctx) return flat_5R6G5B_z_line; case PF_Dither_5R6G5B: return flat_DITHER_5R6G5B_z_line; - case PF_Dither: - return (depth==8) ? flat_DITHER8_z_line : (swrast_line_func) NULL; - case PF_Lookup: - return (depth==8) ? flat_LOOKUP8_z_line : (swrast_line_func) NULL; - case PF_HPCR: - return flat_HPCR_z_line; default: return (swrast_line_func)NULL; } @@ -645,12 +506,6 @@ get_line_func(struct gl_context *ctx) return flat_5R6G5B_line; case PF_Dither_5R6G5B: return flat_DITHER_5R6G5B_line; - case PF_Dither: - return (depth==8) ? flat_DITHER8_line : (swrast_line_func) NULL; - case PF_Lookup: - return (depth==8) ? flat_LOOKUP8_line : (swrast_line_func) NULL; - case PF_HPCR: - return flat_HPCR_line; default: return (swrast_line_func)NULL; } diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index 294b93a57cc..2a14d530772 100644 --- a/src/mesa/drivers/x11/xm_span.c +++ b/src/mesa/drivers/x11/xm_span.c @@ -23,15 +23,10 @@ */ #include "glxheader.h" -#include "main/colormac.h" #include "main/context.h" -#include "main/depth.h" -#include "main/drawpix.h" -#include "main/extensions.h" #include "main/macros.h" #include "main/imports.h" #include "main/mtypes.h" -#include "main/state.h" #include "xmesaP.h" #include "swrast/swrast.h" @@ -866,629 +861,303 @@ static void put_row_rgb_DITHER_5R6G5B_pixmap( RGB_SPAN_ARGS ) /* - * Write a span of PF_DITHER pixels to a pixmap. + * Write a span of PF_TRUECOLOR pixels to an XImage. */ -static void put_row_DITHER_pixmap( PUT_ROW_ARGS ) +static void put_row_TRUECOLOR_ximage( PUT_ROW_ARGS ) { const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); - XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; + XMesaImage *img = xrb->ximage; register GLuint i; - XDITHER_SETUP(y); y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; + XMesaImage *img = xrb->ximage; register GLuint i; - XDITHER_SETUP(y); y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; + XMesaImage *img = xrb->ximage; register GLuint i; - SETUP_1BIT; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; + XMesaImage *img = xrb->ximage; register GLuint i; - SETUP_1BIT; y = YFLIP(xrb, y); if (mask) { for (i=0;iDrawBuffer)->rowimage; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; - y = YFLIP(xrb, y); + register GLuint *ptr = PIXEL_ADDR4(xrb, x, y); + (void) ctx; if (mask) { - for (i=0;iDrawBuffer)->rowimage; - register GLubyte *ptr = (GLubyte *) XMESA_BUFFER(ctx->DrawBuffer)->rowimage->data; + /* draw all pixels */ for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; - y = YFLIP(xrb, y); + register GLuint *ptr = PIXEL_ADDR4(xrb, x, y); if (mask) { - for (i=0;iDrawBuffer)->rowimage; - register GLubyte *ptr = (GLubyte *) XMESA_BUFFER(ctx->DrawBuffer)->rowimage->data; + /* draw all pixels */ for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; - LOOKUP_SETUP; - y = YFLIP(xrb, y); + register GLuint *ptr = PIXEL_ADDR4(xrb, x, y); if (mask) { - for (i=0;iDrawBuffer)->rowimage; + /* draw all pixels */ for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; - LOOKUP_SETUP; - y = YFLIP(xrb, y); + register GLuint *ptr = PIXEL_ADDR4(xrb, x, y); if (mask) { - for (i=0;iDrawBuffer)->rowimage; + /* draw all pixels */ for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; - y = YFLIP(xrb, y); + register GLuint *ptr = PIXEL_ADDR4(xrb, x, y); if (mask) { - for (i=0;iDrawBuffer)->rowimage; for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; - y = YFLIP(xrb, y); - if (mask) { - for (i=0;iDrawBuffer)->rowimage; for (i=0;iximage; register GLuint i; - y = YFLIP(xrb, y); + register GLubyte *ptr = (GLubyte *) PIXEL_ADDR3(xrb, x, y ); if (mask) { - for (i=0;iximage; - register GLuint i; - y = YFLIP(xrb, y); - if (mask) { - for (i=0;iximage; - register GLuint i; - y = YFLIP(xrb, y); - if (mask) { - for (i=0;iximage; - register GLuint i; - y = YFLIP(xrb, y); - if (mask) { - for (i=0;iximage; - register GLuint i; - int yy = YFLIP(xrb, y); - XDITHER_SETUP(yy); - if (mask) { - for (i=0;iximage; - register GLuint i; - int yy = YFLIP(xrb, y); - XDITHER_SETUP(yy); - if (mask) { - for (i=0;iximage; - register GLuint i; - SETUP_1BIT; - y = YFLIP(xrb, y); - if (mask) { - for (i=0;iximage; - register GLuint i; - SETUP_1BIT; - y = YFLIP(xrb, y); - if (mask) { - for (i=0;iximage; - register GLuint i; - LOOKUP_SETUP; - y = YFLIP(xrb, y); - if (mask) { - for (i=0;iximage; - register GLuint i; - LOOKUP_SETUP; - y = YFLIP(xrb, y); - if (mask) { - for (i=0;iximage; - register GLuint i; - y = YFLIP(xrb, y); - if (mask) { - for (i=0;iximage; - register GLuint i; - y = YFLIP(xrb, y); - if (mask) { - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; - DITHER_SETUP; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; - SETUP_1BIT; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; - LOOKUP_SETUP; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; - for (i=0;iximage; - register GLuint i; - for (i=0;iximage; - register GLuint i; - for (i=0;ir = rgba[i][RCOMP]; - ptr->g = rgba[i][GCOMP]; - ptr->b = rgba[i][BCOMP]; - } - } -} - - -/* - * Write an array of PF_5R6G5B pixels to an ximage. - */ -static void put_values_5R6G5B_ximage( PUT_VALUES_ARGS ) -{ - const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; - GET_XRB(xrb); - register GLuint i; - for (i=0;iximage; - register GLuint i; - DITHER_SETUP; - for (i=0;iximage; - register GLuint i; - SETUP_1BIT; - for (i=0;iximage; - register GLuint i; - LOOKUP_SETUP; - for (i=0;iximage; - register GLuint i; - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], - color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); - register GLuint i; - XMesaSetForeground( xmesa->display, gc, pixel ); - y = YFLIP(xrb, y); - - /* New code contributed by Jeff Epler and cleaned up by Keith - * Whitwell. - */ - for (i = 0; i < n; ) { - GLuint start = i; - - /* Identify and emit contiguous rendered pixels - */ - while (i < n && (!mask || mask[i])) - i++; - - if (start < i) - XMesaFillRectangle( dpy, buffer, gc, - (int)(x+start), (int) y, - (int)(i-start), 1); - - /* Eat up non-rendered pixels - */ - while (i < n && !mask[i]) - i++; - } -} - - - -static void -put_mono_row_ci_pixmap( PUT_MONO_ROW_ARGS ) -{ - GLuint colorIndex = *((GLuint *) value); - XMesaContext xmesa = XMESA_CONTEXT(ctx); - GET_XRB(xrb); - XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; - XMesaSetForeground( xmesa->display, gc, colorIndex ); - y = YFLIP(xrb, y); - - for (i = 0 ; i < n ;) { - GLuint start = i; - - /* Identify and emit contiguous rendered pixels - */ - while (i < n && (!mask || mask[i])) - i++; - - if (start < i) - XMesaFillRectangle( dpy, buffer, gc, - (int)(x+start), (int) y, - (int)(i-start), 1); - - /* Eat up non-rendered pixels - */ - while (i < n && !mask[i]) - i++; - } -} +#define PUT_VALUES_ARGS \ + struct gl_context *ctx, struct gl_renderbuffer *rb, \ + GLuint n, const GLint x[], const GLint y[], \ + const void *values, const GLubyte mask[] /* - * Write a span of PF_TRUEDITHER pixels to a pixmap. + * Write an array of PF_TRUECOLOR pixels to a pixmap. */ -static void put_mono_row_TRUEDITHER_pixmap( PUT_MONO_ROW_ARGS ) +static void put_values_TRUECOLOR_pixmap( PUT_VALUES_ARGS ) { - const GLubyte *color = (const GLubyte *) value; + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; + const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); - XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; - int yy = YFLIP(xrb, y); - for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; - int yy = YFLIP(xrb, y); - XDITHER_SETUP(yy); - for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; - register GLuint i; - SETUP_1BIT; - y = YFLIP(xrb, y); - for (i=0;iximage; - register GLuint i; - const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], - color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); - y = YFLIP(xrb, y); - for (i=0;iximage; register GLuint i; - y = YFLIP(xrb, y); - for (i=0;iximage; - const GLint r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; - GLuint i; - y = YFLIP(xrb, y); - for (i=0;ipixelformat); - ptr = PIXEL_ADDR4(xrb, x, y ); for (i=0;ipixelformat); - ptr = PIXEL_ADDR4(xrb, x, y ); + XMesaDisplay *dpy = xmesa->xm_visual->display; + XMesaDrawable buffer = xrb->drawable; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; + register GLuint i; for (i=0;ixm_visual->display; + XMesaDrawable buffer = xrb->drawable; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; + register GLuint i; for (i=0;ixm_visual->display; + XMesaDrawable buffer = xrb->drawable; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; + register GLuint i; for (i=0;iximage; - int yy = YFLIP(xrb, y); + XMesaDisplay *dpy = xmesa->xm_visual->display; + XMesaDrawable buffer = xrb->drawable; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; - XDITHER_SETUP(yy); - for (i=0;ixm_visual->display; + XMesaDrawable buffer = xrb->drawable; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; - XDITHER_SETUP(y); - for (i=0;iximage; register GLuint i; - register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y); - GLubyte pixel; - LOOKUP_SETUP; - pixel = LOOKUP(color[RCOMP], color[GCOMP], color[BCOMP]); for (i=0;iximage; register GLuint i; - SETUP_1BIT; - y = YFLIP(xrb, y); - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; - const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], - color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); - XMesaSetForeground( xmesa->display, gc, pixel ); for (i=0;ir = rgba[i][RCOMP]; + ptr->g = rgba[i][GCOMP]; + ptr->b = rgba[i][BCOMP]; } } } -static void -put_mono_values_ci_pixmap( PUT_MONO_VALUES_ARGS ) +/* + * Write an array of PF_5R6G5B pixels to an ximage. + */ +static void put_values_5R6G5B_ximage( PUT_VALUES_ARGS ) { - const GLuint colorIndex = *((GLuint *) value); - const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values; GET_XRB(xrb); - XMesaDisplay *dpy = xmesa->xm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; - XMesaSetForeground( xmesa->display, gc, colorIndex ); for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; + const XMesaContext xmesa = XMESA_CONTEXT(ctx); register GLuint i; - const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; for (i=0;ixm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; + const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], + color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); register GLuint i; - const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; - DITHER_SETUP; - for (i=0;idisplay, gc, pixel ); + y = YFLIP(xrb, y); + + /* New code contributed by Jeff Epler and cleaned up by Keith + * Whitwell. + */ + for (i = 0; i < n; ) { + GLuint start = i; + + /* Identify and emit contiguous rendered pixels + */ + while (i < n && (!mask || mask[i])) + i++; + + if (start < i) + XMesaFillRectangle( dpy, buffer, gc, + (int)(x+start), (int) y, + (int)(i-start), 1); + + /* Eat up non-rendered pixels + */ + while (i < n && !mask[i]) + i++; } } + /* - * Write an array of PF_1BIT pixels to a pixmap. + * Write a span of PF_TRUEDITHER pixels to a pixmap. */ -static void put_mono_values_1BIT_pixmap( PUT_MONO_VALUES_ARGS ) +static void put_mono_row_TRUEDITHER_pixmap( PUT_MONO_ROW_ARGS ) { const GLubyte *color = (const GLubyte *) value; - const XMesaContext xmesa = XMESA_CONTEXT(ctx); GET_XRB(xrb); + XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xrb->drawable; XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; - register GLuint i; const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; - SETUP_1BIT; - for (i=0;iximage; register GLuint i; const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); - for (i=0;iximage; - register GLuint i; - for (i=0;iximage; - register GLuint i; - const int r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; + const GLint r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; + GLuint i; + y = YFLIP(xrb, y); for (i=0;ipixelformat); + ptr = PIXEL_ADDR4(xrb, x, y ); for (i=0;ipixelformat); + ptr = PIXEL_ADDR4(xrb, x, y ); for (i=0;ir = r; - ptr->g = g; - ptr->b = b; + if (!mask || mask[i]) { + ptr[i].r = r; + ptr[i].g = g; + ptr[i].b = b; } } } /* - * Write an array of identical PF_DITHER pixels to an XImage. + * Write a span of identical PF_DITHER_5R6G5B pixels to an XImage. */ -static void put_mono_values_DITHER_ximage( PUT_MONO_VALUES_ARGS ) +static void put_mono_row_DITHER_5R6G5B_ximage( PUT_MONO_ROW_ARGS ) { const GLubyte *color = (const GLubyte *) value; GET_XRB(xrb); - const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; - XMesaImage *img = xrb->ximage; - register GLuint i; - DITHER_SETUP; + const XMesaContext xmesa = XMESA_CONTEXT(ctx); + register GLushort *ptr = PIXEL_ADDR2(xrb, x, y ); + const GLint r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; + GLuint i; + y = YFLIP(xrb, y); for (i=0;iximage; + XMesaDisplay *dpy = xmesa->xm_visual->display; + XMesaDrawable buffer = xrb->drawable; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; - SETUP_1BIT; + const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], + color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); + XMesaSetForeground( xmesa->display, gc, pixel ); for (i=0;ixm_visual->display; + XMesaDrawable buffer = xrb->drawable; + XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; register GLuint i; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; for (i=0;iximage; register GLuint i; - register GLubyte p = GRAY_RGB(color[RCOMP], color[GCOMP], color[BCOMP]); + const unsigned long pixel = xmesa_color_to_pixel(ctx, color[RCOMP], + color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); for (i=0;iximage; register GLuint i; + const int r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; + const GLuint p = PACK_8A8B8G8R(color[RCOMP], color[GCOMP], + color[BCOMP], color[ACOMP]); register GLuint i; - y = YFLIP(xrb, y); - if (mask) { - for (i=0;iximage; + const GLuint p = PACK_8A8R8G8B(color[RCOMP], color[GCOMP], + color[BCOMP], color[ACOMP]); register GLuint i; - y = YFLIP(xrb, y); - if (mask) { - for (i=0;ixm_visual->display; - XMesaDrawable buffer = xrb->drawable; - XMesaGC gc = XMESA_BUFFER(ctx->DrawBuffer)->gc; + const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; for (i=0;ir = r; + ptr->g = g; + ptr->b = b; } } } /* - * Write an array of CI pixels to an XImage. + * Write an array of identical PF_DITHER_5R6G5B pixels to an XImage. */ -static void put_values_ci_ximage( PUT_VALUES_ARGS ) +static void put_mono_values_DITHER_5R6G5B_ximage( PUT_MONO_VALUES_ARGS ) { - const GLuint *index = (const GLuint *) values; + const GLubyte *color = (const GLubyte *) value; GET_XRB(xrb); - XMesaImage *img = xrb->ximage; + const XMesaContext xmesa = XMESA_CONTEXT(ctx); + const int r = color[RCOMP], g = color[GCOMP], b = color[BCOMP]; register GLuint i; for (i=0;ipixmap) { - XMesaImage *span = NULL; - int error; - int k = clip_for_xgetimage(ctx, xrb->pixmap, &n, &x, &y); - if (k < 0) - return; - index += k; - - catch_xgetimage_errors( xmesa->display ); - span = XGetImage( xmesa->display, xrb->pixmap, - x, y, n, 1, AllPlanes, ZPixmap ); - error = check_xgetimage_errors(); - if (span && !error) { - for (i=0;iximage) { - XMesaImage *img = xrb->ximage; - for (i=0;iDrawBuffer); if (xrb->pixmap) { /* Read from Pixmap or Window */ @@ -3975,63 +2397,6 @@ get_row_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb, } } break; - case PF_HPCR: - { - GLubyte *ptr1 = (GLubyte *) span->data; - GLuint i; - for (i=0;ipixel_to_r; - GLubyte *gTable = source->pixel_to_g; - GLubyte *bTable = source->pixel_to_b; - if (GET_VISUAL_DEPTH(xmesa->xm_visual)==8) { - const GLubyte *ptr1 = (GLubyte *) span->data; - GLuint i; - for (i=0;ixm_visual->bitFlip; - GLuint i; - for (i=0;ipixel_to_r; - const GLubyte *gTable = source->pixel_to_g; - const GLubyte *bTable = source->pixel_to_b; - if (GET_VISUAL_DEPTH(xmesa->xm_visual)==8) { - GLubyte *ptr1 = PIXEL_ADDR1(xrb, x, y); - GLuint i; - for (i=0;iximage; - GLuint i; - y = YFLIP(xrb, y); - for (i=0;iximage; - int bitFlip = xmesa->xm_visual->bitFlip; - GLuint i; - y = YFLIP(xrb, y); - for (i=0;ipixmap) { - for (i=0;idisplay, xrb->drawable, - x[i], YFLIP(xrb, y[i]) ); - } - } - else if (xrb->ximage) { - XMesaImage *img = xrb->ximage; - for (i=0;ixm_visual->display; - XMesaBuffer source = XMESA_BUFFER(ctx->DrawBuffer); register GLuint i; if (xrb->pixmap) { @@ -4350,46 +2626,6 @@ get_values_rgba(struct gl_context *ctx, struct gl_renderbuffer *rb, rgba[i][ACOMP] = 255; } break; - case PF_HPCR: - for (i=0;ipixel_to_r; - GLubyte *gTable = source->pixel_to_g; - GLubyte *bTable = source->pixel_to_b; - for (i=0;ixm_visual->bitFlip; - for (i=0;ipixel_to_r; - GLubyte *gTable = source->pixel_to_g; - GLubyte *bTable = source->pixel_to_b; - XMesaImage *img = xrb->ximage; - for (i=0;iximage; - int bitFlip = xmesa->xm_visual->bitFlip; - for (i=0;ipixmap ? GL_TRUE : GL_FALSE; switch (pixelformat) { - case PF_Index: - ASSERT(xrb->Base.DataType == GL_UNSIGNED_INT); - if (pixmap) { - xrb->Base.PutRow = put_row_ci_pixmap; - xrb->Base.PutRowRGB = NULL; - xrb->Base.PutMonoRow = put_mono_row_ci_pixmap; - xrb->Base.PutValues = put_values_ci_pixmap; - xrb->Base.PutMonoValues = put_mono_values_ci_pixmap; - } - else { - xrb->Base.PutRow = put_row_ci_ximage; - xrb->Base.PutRowRGB = NULL; - xrb->Base.PutMonoRow = put_mono_row_ci_ximage; - xrb->Base.PutValues = put_values_ci_ximage; - xrb->Base.PutMonoValues = put_mono_values_ci_ximage; - } - break; case PF_Truecolor: if (pixmap) { xrb->Base.PutRow = put_row_TRUECOLOR_pixmap; @@ -4670,113 +2847,6 @@ xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb, xrb->Base.PutMonoValues = put_mono_values_DITHER_5R6G5B_ximage; } break; - case PF_Dither: - if (pixmap) { - xrb->Base.PutRow = put_row_DITHER_pixmap; - xrb->Base.PutRowRGB = put_row_rgb_DITHER_pixmap; - xrb->Base.PutMonoRow = put_mono_row_DITHER_pixmap; - xrb->Base.PutValues = put_values_DITHER_pixmap; - xrb->Base.PutMonoValues = put_mono_values_DITHER_pixmap; - } - else { - if (depth == 8) { - xrb->Base.PutRow = put_row_DITHER8_ximage; - xrb->Base.PutRowRGB = put_row_rgb_DITHER8_ximage; - xrb->Base.PutMonoRow = put_mono_row_DITHER8_ximage; - xrb->Base.PutValues = put_values_DITHER8_ximage; - xrb->Base.PutMonoValues = put_mono_values_DITHER8_ximage; - } - else { - xrb->Base.PutRow = put_row_DITHER_ximage; - xrb->Base.PutRowRGB = put_row_rgb_DITHER_ximage; - xrb->Base.PutMonoRow = put_mono_row_DITHER_ximage; - xrb->Base.PutValues = put_values_DITHER_ximage; - xrb->Base.PutMonoValues = put_mono_values_DITHER_ximage; - } - } - break; - case PF_1Bit: - if (pixmap) { - xrb->Base.PutRow = put_row_1BIT_pixmap; - xrb->Base.PutRowRGB = put_row_rgb_1BIT_pixmap; - xrb->Base.PutMonoRow = put_mono_row_1BIT_pixmap; - xrb->Base.PutValues = put_values_1BIT_pixmap; - xrb->Base.PutMonoValues = put_mono_values_1BIT_pixmap; - } - else { - xrb->Base.PutRow = put_row_1BIT_ximage; - xrb->Base.PutRowRGB = put_row_rgb_1BIT_ximage; - xrb->Base.PutMonoRow = put_mono_row_1BIT_ximage; - xrb->Base.PutValues = put_values_1BIT_ximage; - xrb->Base.PutMonoValues = put_mono_values_1BIT_ximage; - } - break; - case PF_HPCR: - if (pixmap) { - xrb->Base.PutRow = put_row_HPCR_pixmap; - xrb->Base.PutRowRGB = put_row_rgb_HPCR_pixmap; - xrb->Base.PutMonoRow = put_mono_row_pixmap; - xrb->Base.PutValues = put_values_HPCR_pixmap; - xrb->Base.PutMonoValues = put_mono_values_pixmap; - } - else { - xrb->Base.PutRow = put_row_HPCR_ximage; - xrb->Base.PutRowRGB = put_row_rgb_HPCR_ximage; - xrb->Base.PutMonoRow = put_mono_row_HPCR_ximage; - xrb->Base.PutValues = put_values_HPCR_ximage; - xrb->Base.PutMonoValues = put_mono_values_HPCR_ximage; - } - break; - case PF_Lookup: - if (pixmap) { - xrb->Base.PutRow = put_row_LOOKUP_pixmap; - xrb->Base.PutRowRGB = put_row_rgb_LOOKUP_pixmap; - xrb->Base.PutMonoRow = put_mono_row_pixmap; - xrb->Base.PutValues = put_values_LOOKUP_pixmap; - xrb->Base.PutMonoValues = put_mono_values_pixmap; - } - else { - if (depth==8) { - xrb->Base.PutRow = put_row_LOOKUP8_ximage; - xrb->Base.PutRowRGB = put_row_rgb_LOOKUP8_ximage; - xrb->Base.PutMonoRow = put_mono_row_LOOKUP8_ximage; - xrb->Base.PutValues = put_values_LOOKUP8_ximage; - xrb->Base.PutMonoValues = put_mono_values_LOOKUP8_ximage; - } - else { - xrb->Base.PutRow = put_row_LOOKUP_ximage; - xrb->Base.PutRowRGB = put_row_rgb_LOOKUP_ximage; - xrb->Base.PutMonoRow = put_mono_row_ximage; - xrb->Base.PutValues = put_values_LOOKUP_ximage; - xrb->Base.PutMonoValues = put_mono_values_ximage; - } - } - break; - case PF_Grayscale: - if (pixmap) { - xrb->Base.PutRow = put_row_GRAYSCALE_pixmap; - xrb->Base.PutRowRGB = put_row_rgb_GRAYSCALE_pixmap; - xrb->Base.PutMonoRow = put_mono_row_pixmap; - xrb->Base.PutValues = put_values_GRAYSCALE_pixmap; - xrb->Base.PutMonoValues = put_mono_values_pixmap; - } - else { - if (depth == 8) { - xrb->Base.PutRow = put_row_GRAYSCALE8_ximage; - xrb->Base.PutRowRGB = put_row_rgb_GRAYSCALE8_ximage; - xrb->Base.PutMonoRow = put_mono_row_GRAYSCALE8_ximage; - xrb->Base.PutValues = put_values_GRAYSCALE8_ximage; - xrb->Base.PutMonoValues = put_mono_values_GRAYSCALE8_ximage; - } - else { - xrb->Base.PutRow = put_row_GRAYSCALE_ximage; - xrb->Base.PutRowRGB = put_row_rgb_GRAYSCALE_ximage; - xrb->Base.PutMonoRow = put_mono_row_ximage; - xrb->Base.PutValues = put_values_GRAYSCALE_ximage; - xrb->Base.PutMonoValues = put_mono_values_ximage; - } - } - break; default: _mesa_problem(NULL, "Bad pixel format in xmesa_update_state (1)"); return; @@ -4784,13 +2854,7 @@ xmesa_set_renderbuffer_funcs(struct xmesa_renderbuffer *xrb, /* Get functions */ - if (pixelformat == PF_Index) { - xrb->Base.GetRow = get_row_ci; - xrb->Base.GetValues = get_values_ci; - } - else { - xrb->Base.GetRow = get_row_rgba; - xrb->Base.GetValues = get_values_rgba; - } + xrb->Base.GetRow = get_row_rgba; + xrb->Base.GetValues = get_values_rgba; } diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index 9fc19bb1e8a..a2dbf572dc1 100644 --- a/src/mesa/drivers/x11/xm_tri.c +++ b/src/mesa/drivers/x11/xm_tri.c @@ -30,8 +30,6 @@ */ -#include "main/depth.h" -#include "main/macros.h" #include "main/imports.h" #include "main/mtypes.h" #include "glxheader.h" @@ -315,132 +313,6 @@ -/* - * XImage, smooth, depth-buffered, 8-bit, PF_DITHER8 triangle. - */ -#define NAME smooth_DITHER8_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) { \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - XDITHER_SETUP(y); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span.red),\ - FixedToInt(span.green), FixedToInt(span.blue) ); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.z += span.zStep; \ - } } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, depth-buffered, PF_DITHER triangle. - */ -#define NAME smooth_DITHER_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define SETUP_CODE \ - GET_XRB(xrb); \ - XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) { \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - XDITHER_SETUP(y); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - unsigned long p = XDITHER(x, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - XMesaPutPixel(img, x, y, p); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.z += span.zStep; \ - } } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, depth-buffered, 8-bit PF_LOOKUP triangle. - */ -#define NAME smooth_LOOKUP8_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) { \ - GLuint i; \ - LOOKUP_SETUP; \ - for (i = 0; i < span.end; i++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = LOOKUP(FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.z += span.zStep; \ - } } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, depth-buffered, 8-bit PF_HPCR triangle. - */ -#define NAME smooth_HPCR_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) { \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = DITHER_HPCR(x, y, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue) ); \ - zRow[i] = z; \ - } \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - span.z += span.zStep; \ - } } -#include "swrast/s_tritemp.h" - - - /* * XImage, flat, depth-buffered, PF_TRUECOLOR triangle. */ @@ -660,122 +532,6 @@ #include "swrast/s_tritemp.h" - -/* - * XImage, flat, depth-buffered, 8-bit PF_DITHER triangle. - */ -#define NAME flat_DITHER8_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) { \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - FLAT_DITHER_ROW_SETUP(YFLIP(xrb, y)); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x); \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, depth-buffered, PF_DITHER triangle. - */ -#define NAME flat_DITHER_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define SETUP_CODE \ - GET_XRB(xrb); \ - XMesaImage *img = xrb->ximage; \ - FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) { \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - FLAT_DITHER_ROW_SETUP(y); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - unsigned long p = FLAT_DITHER(x); \ - XMesaPutPixel(img, x, y, p); \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, depth-buffered, 8-bit PF_HPCR triangle. - */ -#define NAME flat_HPCR_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); \ - GLubyte r = v2->color[0]; \ - GLubyte g = v2->color[1]; \ - GLubyte b = v2->color[2]; -#define RENDER_SPAN( span ) { \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b); \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, depth-buffered, 8-bit PF_LOOKUP triangle. - */ -#define NAME flat_LOOKUP8_z_triangle -#define INTERP_Z 1 -#define DEPTH_TYPE DEFAULT_SOFTWARE_DEPTH_TYPE -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - LOOKUP_SETUP; \ - GLubyte r = v2->color[0]; \ - GLubyte g = v2->color[1]; \ - GLubyte b = v2->color[2]; \ - GLubyte p = LOOKUP(r,g,b); -#define RENDER_SPAN( span ) { \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - const DEPTH_TYPE z = FixedToDepth(span.z); \ - if (z < zRow[i]) { \ - pRow[i] = p; \ - zRow[i] = z; \ - } \ - span.z += span.zStep; \ - } } -#include "swrast/s_tritemp.h" - - - /* * XImage, smooth, NON-depth-buffered, PF_TRUECOLOR triangle. */ @@ -974,104 +730,6 @@ -/* - * XImage, smooth, NON-depth-buffered, 8-bit PF_DITHER triangle. - */ -#define NAME smooth_DITHER8_triangle -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) { \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - XDITHER_SETUP(y); \ - for (i = 0; i < span.end; i++, x++) { \ - pRow[i] = (PIXEL_TYPE) XDITHER(x, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue) ); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - } } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, NON-depth-buffered, PF_DITHER triangle. - */ -#define NAME smooth_DITHER_triangle -#define INTERP_RGB 1 -#define SETUP_CODE \ - GET_XRB(xrb); \ - XMesaImage *img = xrb->ximage; -#define RENDER_SPAN( span ) { \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - XDITHER_SETUP(y); \ - for (i = 0; i < span.end; i++, x++) { \ - unsigned long p = XDITHER(x, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue) ); \ - XMesaPutPixel(img, x, y, p); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - } } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, NON-depth-buffered, 8-bit PF_LOOKUP triangle. - */ -#define NAME smooth_LOOKUP8_triangle -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) { \ - GLuint i; \ - LOOKUP_SETUP; \ - for (i = 0; i < span.end; i++) { \ - pRow[i] = LOOKUP(FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - } } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, smooth, NON-depth-buffered, 8-bit PF_HPCR triangle. - */ -#define NAME smooth_HPCR_triangle -#define INTERP_RGB 1 -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); -#define RENDER_SPAN( span ) { \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - pRow[i] = DITHER_HPCR(x, y, FixedToInt(span.red), \ - FixedToInt(span.green), FixedToInt(span.blue)); \ - span.red += span.redStep; \ - span.green += span.greenStep; \ - span.blue += span.blueStep; \ - } } -#include "swrast/s_tritemp.h" - - - /* * XImage, flat, NON-depth-buffered, PF_TRUECOLOR triangle. */ @@ -1237,92 +895,6 @@ -/* - * XImage, flat, NON-depth-buffered, 8-bit PF_DITHER triangle. - */ -#define NAME flat_DITHER8_triangle -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) { \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - FLAT_DITHER_ROW_SETUP(YFLIP(xrb, y)); \ - for (i = 0; i < span.end; i++, x++) { \ - pRow[i] = (PIXEL_TYPE) FLAT_DITHER(x); \ - } } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, NON-depth-buffered, PF_DITHER triangle. - */ -#define NAME flat_DITHER_triangle -#define SETUP_CODE \ - GET_XRB(xrb); \ - XMesaImage *img = xrb->ximage; \ - FLAT_DITHER_SETUP( v2->color[0], v2->color[1], v2->color[2] ); -#define RENDER_SPAN( span ) { \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - FLAT_DITHER_ROW_SETUP(y); \ - for (i = 0; i < span.end; i++, x++) { \ - unsigned long p = FLAT_DITHER(x); \ - XMesaPutPixel(img, x, y, p ); \ - } } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, NON-depth-buffered, 8-bit PF_HPCR triangle. - */ -#define NAME flat_HPCR_triangle -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - XMesaContext xmesa = XMESA_CONTEXT(ctx); \ - GET_XRB(xrb); \ - GLubyte r = v2->color[0]; \ - GLubyte g = v2->color[1]; \ - GLubyte b = v2->color[2]; -#define RENDER_SPAN( span ) { \ - GLuint i; \ - GLint x = span.x, y = YFLIP(xrb, span.y); \ - for (i = 0; i < span.end; i++, x++) { \ - pRow[i] = (PIXEL_TYPE) DITHER_HPCR(x, y, r, g, b); \ - } } -#include "swrast/s_tritemp.h" - - - -/* - * XImage, flat, NON-depth-buffered, 8-bit PF_LOOKUP triangle. - */ -#define NAME flat_LOOKUP8_triangle -#define PIXEL_ADDRESS(X,Y) PIXEL_ADDR1(xrb, X, Y) -#define PIXEL_TYPE GLubyte -#define BYTES_PER_ROW (xrb->ximage->bytes_per_line) -#define SETUP_CODE \ - GET_XRB(xrb); \ - LOOKUP_SETUP; \ - GLubyte r = v2->color[0]; \ - GLubyte g = v2->color[1]; \ - GLubyte b = v2->color[2]; \ - GLubyte p = LOOKUP(r,g,b); -#define RENDER_SPAN( span ) { \ - GLuint i; \ - for (i = 0; i < span.end; i++) { \ - pRow[i] = (PIXEL_TYPE) p; \ - } } -#include "swrast/s_tritemp.h" - - #endif /* CHAN_BITS == 8 */ @@ -1347,12 +919,6 @@ void _xmesa_print_triangle_func( swrast_tri_func triFunc ) printf("smooth_5R6G5B_z_triangle\n"); else if (triFunc ==smooth_DITHER_5R6G5B_z_triangle) printf("smooth_DITHER_5R6G5B_z_triangle\n"); - else if (triFunc ==smooth_HPCR_z_triangle) - printf("smooth_HPCR_z_triangle\n"); - else if (triFunc ==smooth_DITHER8_z_triangle) - printf("smooth_DITHER8_z_triangle\n"); - else if (triFunc ==smooth_LOOKUP8_z_triangle) - printf("smooth_LOOKUP8_z_triangle\n"); else if (triFunc ==flat_TRUECOLOR_z_triangle) printf("flat_TRUECOLOR_z_triangle\n"); else if (triFunc ==flat_8A8B8G8R_z_triangle) @@ -1369,12 +935,6 @@ void _xmesa_print_triangle_func( swrast_tri_func triFunc ) printf("flat_5R6G5B_z_triangle\n"); else if (triFunc ==flat_DITHER_5R6G5B_z_triangle) printf("flat_DITHER_5R6G5B_z_triangle\n"); - else if (triFunc ==flat_HPCR_z_triangle) - printf("flat_HPCR_z_triangle\n"); - else if (triFunc ==flat_DITHER8_z_triangle) - printf("flat_DITHER8_z_triangle\n"); - else if (triFunc ==flat_LOOKUP8_z_triangle) - printf("flat_LOOKUP8_z_triangle\n"); else if (triFunc ==smooth_TRUECOLOR_triangle) printf("smooth_TRUECOLOR_triangle\n"); else if (triFunc ==smooth_8A8B8G8R_triangle) @@ -1391,12 +951,6 @@ void _xmesa_print_triangle_func( swrast_tri_func triFunc ) printf("smooth_5R6G5B_triangle\n"); else if (triFunc ==smooth_DITHER_5R6G5B_triangle) printf("smooth_DITHER_5R6G5B_triangle\n"); - else if (triFunc ==smooth_HPCR_triangle) - printf("smooth_HPCR_triangle\n"); - else if (triFunc ==smooth_DITHER8_triangle) - printf("smooth_DITHER8_triangle\n"); - else if (triFunc ==smooth_LOOKUP8_triangle) - printf("smooth_LOOKUP8_triangle\n"); else if (triFunc ==flat_TRUECOLOR_triangle) printf("flat_TRUECOLOR_triangle\n"); else if (triFunc ==flat_TRUEDITHER_triangle) @@ -1413,12 +967,6 @@ void _xmesa_print_triangle_func( swrast_tri_func triFunc ) printf("flat_5R6G5B_triangle\n"); else if (triFunc ==flat_DITHER_5R6G5B_triangle) printf("flat_DITHER_5R6G5B_triangle\n"); - else if (triFunc ==flat_HPCR_triangle) - printf("flat_HPCR_triangle\n"); - else if (triFunc ==flat_DITHER8_triangle) - printf("flat_DITHER8_triangle\n"); - else if (triFunc ==flat_LOOKUP8_triangle) - printf("flat_LOOKUP8_triangle\n"); else printf("???\n"); } @@ -1453,7 +1001,6 @@ get_triangle_func(struct gl_context *ctx) #if CHAN_BITS == 8 SWcontext *swrast = SWRAST_CONTEXT(ctx); XMesaContext xmesa = XMESA_CONTEXT(ctx); - const int depth = GET_VISUAL_DEPTH(xmesa->xm_visual); const struct xmesa_renderbuffer *xrb; #ifdef DEBUG @@ -1502,18 +1049,6 @@ get_triangle_func(struct gl_context *ctx) USE(smooth_5R6G5B_z_triangle); case PF_Dither_5R6G5B: USE(smooth_DITHER_5R6G5B_z_triangle); - case PF_HPCR: - USE(smooth_HPCR_z_triangle); - case PF_Dither: - if (depth == 8) - USE(smooth_DITHER8_z_triangle); - else - USE(smooth_DITHER_z_triangle); - case PF_Lookup: - if (depth == 8) - USE(smooth_LOOKUP8_z_triangle); - else - return (swrast_tri_func) NULL; default: return (swrast_tri_func) NULL; } @@ -1541,18 +1076,6 @@ get_triangle_func(struct gl_context *ctx) USE(flat_5R6G5B_z_triangle); case PF_Dither_5R6G5B: USE(flat_DITHER_5R6G5B_z_triangle); - case PF_HPCR: - USE(flat_HPCR_z_triangle); - case PF_Dither: - if (depth == 8) - USE(flat_DITHER8_z_triangle); - else - USE(flat_DITHER_z_triangle); - case PF_Lookup: - if (depth == 8) - USE(flat_LOOKUP8_z_triangle); - else - return (swrast_tri_func) NULL; default: return (swrast_tri_func) NULL; } @@ -1577,18 +1100,6 @@ get_triangle_func(struct gl_context *ctx) USE(smooth_5R6G5B_triangle); case PF_Dither_5R6G5B: USE(smooth_DITHER_5R6G5B_triangle); - case PF_HPCR: - USE(smooth_HPCR_triangle); - case PF_Dither: - if (depth == 8) - USE(smooth_DITHER8_triangle); - else - USE(smooth_DITHER_triangle); - case PF_Lookup: - if (depth == 8) - USE(smooth_LOOKUP8_triangle); - else - return (swrast_tri_func) NULL; default: return (swrast_tri_func) NULL; } @@ -1614,18 +1125,6 @@ get_triangle_func(struct gl_context *ctx) USE(flat_5R6G5B_triangle); case PF_Dither_5R6G5B: USE(flat_DITHER_5R6G5B_triangle); - case PF_HPCR: - USE(flat_HPCR_triangle); - case PF_Dither: - if (depth == 8) - USE(flat_DITHER8_triangle); - else - USE(flat_DITHER_triangle); - case PF_Lookup: - if (depth == 8) - USE(flat_LOOKUP8_triangle); - else - return (swrast_tri_func) NULL; default: return (swrast_tri_func) NULL; } diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index 81dc25d52eb..7e1cb8a7d49 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -55,7 +55,6 @@ typedef void (*ClearFunc)( struct gl_context *ctx, struct xmesa_renderbuffer *xr /** Framebuffer pixel formats */ enum pixel_format { - PF_Index, /**< Color Index mode */ PF_Truecolor, /**< TrueColor or DirectColor, any depth */ PF_Dither_True, /**< TrueColor with dithering */ PF_8A8R8G8B, /**< 32-bit TrueColor: 8-A, 8-R, 8-G, 8-B bits */ @@ -63,11 +62,6 @@ enum pixel_format { PF_8R8G8B, /**< 32-bit TrueColor: 8-R, 8-G, 8-B bits */ PF_8R8G8B24, /**< 24-bit TrueColor: 8-R, 8-G, 8-B bits */ PF_5R6G5B, /**< 16-bit TrueColor: 5-R, 6-G, 5-B bits */ - PF_Dither, /**< Color-mapped RGB with dither */ - PF_Lookup, /**< Color-mapped RGB without dither */ - PF_HPCR, /**< HP Color Recovery (ad@lms.be 30/08/95) */ - PF_1Bit, /**< monochrome dithering of RGB */ - PF_Grayscale, /**< Grayscale or StaticGray */ PF_Dither_5R6G5B /**< 16-bit dithered TrueColor: 5-R, 6-G, 5-B */ }; @@ -103,16 +97,6 @@ struct xmesa_visual { GLubyte PixelToR[256]; /* Pixel to RGB conversion */ GLubyte PixelToG[256]; GLubyte PixelToB[256]; - - /* For PF_HPCR */ - short hpcr_rgbTbl[3][256]; - GLboolean hpcr_clear_flag; - GLubyte hpcr_clear_ximage_pattern[2][16]; - XMesaImage *hpcr_clear_ximage; - XMesaPixmap hpcr_clear_pixmap; - - /* For PF_1BIT */ - int bitFlip; }; @@ -174,8 +158,6 @@ struct xmesa_renderbuffer XMesaPixmap pixmap; /* Back color buffer */ XMesaImage *ximage; /* The back buffer, if not using a Pixmap */ - GLubyte *origin1; /* used for PIXEL_ADDR1 macro */ - GLint width1; GLushort *origin2; /* used for PIXEL_ADDR2 macro */ GLint width2; GLubyte *origin3; /* used for PIXEL_ADDR3 macro */ @@ -317,134 +299,6 @@ struct xmesa_buffer { -/** - * If pixelformat==PF_DITHER: - * - * Improved 8-bit RGB dithering code contributed by Bob Mercier - * (mercier@hollywood.cinenet.net). Thanks Bob! - */ -#ifdef DITHER666 -# define DITH_R 6 -# define DITH_G 6 -# define DITH_B 6 -# define DITH_MIX(r,g,b) (((r) * DITH_G + (g)) * DITH_B + (b)) -#else -# define DITH_R 5 -# define DITH_G 9 -# define DITH_B 5 -# define DITH_MIX(r,g,b) (((g) << 6) | ((b) << 3) | (r)) -#endif -#define DITH_DX 4 -#define DITH_DY 4 -#define DITH_N (DITH_DX * DITH_DY) - -#define _dither(C, c, d) (((unsigned)((DITH_N * (C - 1) + 1) * c + d)) >> 12) - -#define MAXC 256 -extern const int xmesa_kernel8[DITH_DY * DITH_DX]; - -/* Dither for random X,Y */ -#define DITHER_SETUP \ - int __d; \ - unsigned long *ctable = XMESA_BUFFER(ctx->DrawBuffer)->color_table; - -#define DITHER( X, Y, R, G, B ) \ - (__d = xmesa_kernel8[(((Y)&3)<<2) | ((X)&3)], \ - ctable[DITH_MIX(_dither(DITH_R, (R), __d), \ - _dither(DITH_G, (G), __d), \ - _dither(DITH_B, (B), __d))]) - -/* Dither for random X, fixed Y */ -#define XDITHER_SETUP(Y) \ - int __d; \ - unsigned long *ctable = XMESA_BUFFER(ctx->DrawBuffer)->color_table; \ - const int *kernel = &xmesa_kernel8[ ((Y)&3) << 2 ]; - -#define XDITHER( X, R, G, B ) \ - (__d = kernel[(X)&3], \ - ctable[DITH_MIX(_dither(DITH_R, (R), __d), \ - _dither(DITH_G, (G), __d), \ - _dither(DITH_B, (B), __d))]) - - - -/* - * Dithering for flat-shaded triangles. Precompute all 16 possible - * pixel values given the triangle's RGB color. Contributed by Martin Shenk. - */ -#define FLAT_DITHER_SETUP( R, G, B ) \ - GLushort ditherValues[16]; \ - { \ - unsigned long *ctable = XMESA_BUFFER(ctx->DrawBuffer)->color_table; \ - int msdr = (DITH_N*((DITH_R)-1)+1) * (R); \ - int msdg = (DITH_N*((DITH_G)-1)+1) * (G); \ - int msdb = (DITH_N*((DITH_B)-1)+1) * (B); \ - int i; \ - for (i=0;i<16;i++) { \ - int k = xmesa_kernel8[i]; \ - int j = DITH_MIX( (msdr+k)>>12, (msdg+k)>>12, (msdb+k)>>12 );\ - ditherValues[i] = (GLushort) ctable[j]; \ - } \ - } - -#define FLAT_DITHER_ROW_SETUP(Y) \ - GLushort *ditherRow = ditherValues + ( ((Y)&3) << 2); - -#define FLAT_DITHER(X) ditherRow[(X)&3] - - - -/** - * If pixelformat==PF_LOOKUP: - */ -#define _dither_lookup(C, c) (((unsigned)((DITH_N * (C - 1) + 1) * c)) >> 12) - -#define LOOKUP_SETUP \ - unsigned long *ctable = XMESA_BUFFER(ctx->DrawBuffer)->color_table - -#define LOOKUP( R, G, B ) \ - ctable[DITH_MIX(_dither_lookup(DITH_R, (R)), \ - _dither_lookup(DITH_G, (G)), \ - _dither_lookup(DITH_B, (B)))] - - -/** - * If pixelformat==PF_HPCR: - * - * HP Color Recovery dithering (ad@lms.be 30/08/95) - * HP has on its 8-bit 700-series computers, a feature called - * 'Color Recovery'. This allows near 24-bit output (so they say). - * It is enabled by selecting the 8-bit TrueColor visual AND - * corresponding colormap (see tkInitWindow) AND doing some special - * dither. - */ -extern const short xmesa_HPCR_DRGB[3][2][16]; - -#define DITHER_HPCR( X, Y, R, G, B ) \ - ( ((xmesa->xm_visual->hpcr_rgbTbl[0][R] + xmesa_HPCR_DRGB[0][(Y)&1][(X)&15]) & 0xE0) \ - |(((xmesa->xm_visual->hpcr_rgbTbl[1][G] + xmesa_HPCR_DRGB[1][(Y)&1][(X)&15]) & 0xE0)>>3) \ - | ((xmesa->xm_visual->hpcr_rgbTbl[2][B] + xmesa_HPCR_DRGB[2][(Y)&1][(X)&15])>>6) \ - ) - - - -/** - * If pixelformat==PF_1BIT: - */ -extern const int xmesa_kernel1[16]; - -#define SETUP_1BIT int bitFlip = xmesa->xm_visual->bitFlip -#define DITHER_1BIT( X, Y, R, G, B ) \ - (( ((int)(R)+(int)(G)+(int)(B)) > xmesa_kernel1[(((Y)&3) << 2) | ((X)&3)] ) ^ bitFlip) - - - -/** - * If pixelformat==PF_GRAYSCALE: - */ -#define GRAY_RGB( R, G, B ) XMESA_BUFFER(ctx->DrawBuffer)->color_table[((R) + (G) + (B))/3] - - /** * Converts a GL window Y coord to an X window Y coord: @@ -453,12 +307,9 @@ extern const int xmesa_kernel1[16]; /** - * Return the address of a 1, 2 or 4-byte pixel in the buffer's XImage: + * Return the address of a 2, 3 or 4-byte pixel in the buffer's XImage: * X==0 is left, Y==0 is bottom. */ -#define PIXEL_ADDR1(XRB, X, Y) \ - ( (XRB)->origin1 - (Y) * (XRB)->width1 + (X) ) - #define PIXEL_ADDR2(XRB, X, Y) \ ( (XRB)->origin2 - (Y) * (XRB)->width2 + (X) ) diff --git a/src/mesa/drivers/x11/xmesa_x.h b/src/mesa/drivers/x11/xmesa_x.h index ea6cb3f24e1..f557cbb3016 100644 --- a/src/mesa/drivers/x11/xmesa_x.h +++ b/src/mesa/drivers/x11/xmesa_x.h @@ -81,6 +81,5 @@ typedef XColor XMesaColor; #define GET_VISUAL_DEPTH(__v) __v->visinfo->depth #define GET_BLACK_PIXEL(__v) BlackPixel(__v->display, __v->screen) #define CHECK_BYTE_ORDER(__v) host_byte_order()==ImageByteOrder(__v->display) -#define CHECK_FOR_HPCR(__v) XInternAtom(__v->display, "_HP_RGB_SMOOTH_MAP_LIST", True) #endif diff --git a/src/mesa/drivers/x11/xmesa_xf86.h b/src/mesa/drivers/x11/xmesa_xf86.h index 10f93c3ab62..ef3d9382642 100644 --- a/src/mesa/drivers/x11/xmesa_xf86.h +++ b/src/mesa/drivers/x11/xmesa_xf86.h @@ -193,6 +193,5 @@ do { \ #define GET_VISUAL_DEPTH(__v) __v->nplanes #define GET_BLACK_PIXEL(__v) __v->display->blackPixel #define CHECK_BYTE_ORDER(__v) GL_TRUE -#define CHECK_FOR_HPCR(__v) GL_FALSE #endif