xlib: remove a ton of old xlib driver cruft
[mesa.git] / src / mesa / drivers / x11 / xm_dd.c
index c896716c0bce71b49042d67b0a4548fea70908a5..9ab77e2a6312b4cc6dbdfc2495ec23f9e65c7877 100644 (file)
 
 #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"
 #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
-   }
 }