-/**
- * 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 *****/
/**********************************************************************/
}
-/**
- * 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 * _mesa_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 * _mesa_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 * _mesa_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);
-#ifndef XFree86Server
- v->hpcr_clear_ximage = XGetImage(v->display, v->hpcr_clear_pixmap,
- 0, 0, 16, 2, AllPlanes, ZPixmap);
-#endif
- }
-}
-
-
/**
* Setup RGB rendering for a window with a True/DirectColor visual.
*/
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 );
- }
}
}
#endif
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);
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;
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;
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,
}
-static void
-clear_HPCR_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, GLuint value)
-
-{
- const XMesaContext xmesa = XMESA_CONTEXT(ctx);
- GLint width = xrb->St.Base.Width;
- GLint height = xrb->St.Base.Height;
- GLint i;
- for (i = 0; i < height; i++) {
- GLubyte *ptr = PIXEL_ADDR1( xrb, 0, i );
- int j;
- const GLubyte *sptr = xmesa->xm_visual->hpcr_clear_ximage_pattern[0];
- if (i & 1) {
- sptr += 16;
- }
- for (j = 0; j < width; j++) {
- *ptr = sptr[j&15];
- ptr++;
- }
- }
-}
-
-
static void
clear_16bit_ximage(GLcontext *ctx, struct xmesa_renderbuffer *xrb, GLuint value)
{
}
-static void
-clear_color_HPCR_ximage( GLcontext *ctx, const GLfloat color[4] )
-{
- int i;
- const XMesaContext xmesa = XMESA_CONTEXT(ctx);
-
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]);
-
- if (color[0] == 0.0 && color[1] == 0.0 && color[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( GLcontext *ctx, const GLfloat color[4] )
-{
- int i;
- const XMesaContext xmesa = XMESA_CONTEXT(ctx);
-
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[0], color[0]);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[1], color[1]);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[2], color[2]);
- CLAMPED_FLOAT_TO_UBYTE(xmesa->clearcolor[3], color[3]);
-
- if (color[0] == 0.0 && color[1] == 0.0 && color[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.
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;
- }
+ back_xrb->clearFunc = clear_8bit_ximage;
break;
case 16:
back_xrb->clearFunc = clear_16bit_ximage;
}
}
}
-
- 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
- }
}
}
-/*
- * Write a span of PF_HPCR pixels to a pixmap.
- */
-static void put_row_HPCR_pixmap( 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;
- register GLuint i;
- y = YFLIP(xrb, y);
- if (mask) {
- for (i=0;i<n;i++,x++) {
- if (mask[i]) {
- XMesaSetForeground( dpy, gc,
- DITHER_HPCR( x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ) );
- XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y );
- }
- }
- }
- else {
- XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage;
- register GLubyte *ptr = (GLubyte *) XMESA_BUFFER(ctx->DrawBuffer)->rowimage->data;
- for (i=0;i<n;i++) {
- ptr[i] = DITHER_HPCR( (x+i), y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
- }
- XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, n, 1 );
- }
-}
-
-
-/*
- * Write a span of PF_HPCR pixels to a pixmap (no alpha).
- */
-static void put_row_rgb_HPCR_pixmap( RGB_SPAN_ARGS )
-{
- const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) 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;
- register GLuint i;
- y = YFLIP(xrb, y);
- if (mask) {
- for (i=0;i<n;i++,x++) {
- if (mask[i]) {
- XMesaSetForeground( dpy, gc,
- DITHER_HPCR(x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP]) );
- XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y );
- }
- }
- }
- else {
- XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage;
- register GLubyte *ptr = (GLubyte *) XMESA_BUFFER(ctx->DrawBuffer)->rowimage->data;
- for (i=0;i<n;i++) {
- ptr[i] = DITHER_HPCR( (x+i), y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] );
- }
- XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, n, 1 );
- }
-}
-
/*
* Write a span of PF_LOOKUP pixels to a pixmap.
*/
}
-/*
- * Write a span of PF_HPCR pixels to an XImage.
- */
-static void put_row_HPCR_ximage( PUT_ROW_ARGS )
-{
- const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
- GET_XRB(xrb);
- const XMesaContext xmesa = XMESA_CONTEXT(ctx);
- register GLuint i;
- register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y);
- if (mask) {
- for (i=0;i<n;i++,x++) {
- if (mask[i]) {
- ptr[i] = DITHER_HPCR( x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
- }
- }
- }
- else {
- /* draw all pixels */
- for (i=0;i<n;i++,x++) {
- ptr[i] = DITHER_HPCR( x, y, rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
- }
- }
-}
-
-
-/*
- * Write a span of PF_HPCR pixels to an XImage (no alpha).
- */
-static void put_row_rgb_HPCR_ximage( RGB_SPAN_ARGS )
-{
- const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;
- GET_XRB(xrb);
- const XMesaContext xmesa = XMESA_CONTEXT(ctx);
- register GLuint i;
- register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y);
- if (mask) {
- for (i=0;i<n;i++,x++) {
- if (mask[i]) {
- ptr[i] = DITHER_HPCR( x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] );
- }
- }
- }
- else {
- /* draw all pixels */
- for (i=0;i<n;i++,x++) {
- ptr[i] = DITHER_HPCR( x, y, rgb[i][RCOMP], rgb[i][GCOMP], rgb[i][BCOMP] );
- }
- }
-}
-
-
/*
* Write a span of PF_LOOKUP pixels to an XImage.
*/
}
-/*
- * Write an array of PF_HPCR pixels to a pixmap.
- */
-static void put_values_HPCR_pixmap( PUT_VALUES_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;
- register GLuint i;
- for (i=0;i<n;i++) {
- if (mask[i]) {
- XMesaSetForeground( dpy, gc,
- DITHER_HPCR( x[i], y[i], rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ));
- XMesaDrawPoint( dpy, buffer, gc, (int) x[i], (int) YFLIP(xrb, y[i]) );
- }
- }
-}
-
/*
* Write an array of PF_LOOKUP pixels to a pixmap.
}
-/*
- * Write an array of PF_HPCR pixels to an XImage.
- */
-static void put_values_HPCR_ximage( PUT_VALUES_ARGS )
-{
- const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
- GET_XRB(xrb);
- const XMesaContext xmesa = XMESA_CONTEXT(ctx);
- register GLuint i;
- for (i=0;i<n;i++) {
- if (mask[i]) {
- GLubyte *ptr = PIXEL_ADDR1(xrb, x[i], y[i]);
- *ptr = (GLubyte) DITHER_HPCR( x[i], y[i], rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
- }
- }
-}
-
-
/*
* Write an array of PF_LOOKUP pixels to an XImage.
*/
}
-/*
- * Write a span of identical HPCR pixels to an XImage.
- */
-static void put_mono_row_HPCR_ximage( PUT_MONO_ROW_ARGS )
-{
- const GLubyte *color = (const GLubyte *) value;
- GET_XRB(xrb);
- const XMesaContext xmesa = XMESA_CONTEXT(ctx);
- const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP];
- register GLubyte *ptr = PIXEL_ADDR1(xrb, x, y);
- register GLuint i;
- for (i=0;i<n;i++,x++) {
- if (!mask || mask[i]) {
- ptr[i] = DITHER_HPCR( x, y, r, g, b );
- }
- }
-}
-
-
/*
* Write a span of identical 8-bit GRAYSCALE pixels to an XImage.
*/
}
-/*
- * Write an array of identical PF_HPCR pixels to an XImage.
- */
-static void put_mono_values_HPCR_ximage( PUT_MONO_VALUES_ARGS )
-{
- const GLubyte *color = (const GLubyte *) value;
- GET_XRB(xrb);
- const XMesaContext xmesa = XMESA_CONTEXT(ctx);
- const GLubyte r = color[RCOMP], g = color[GCOMP], b = color[BCOMP];
- register GLuint i;
- for (i=0;i<n;i++) {
- if (mask[i]) {
- GLubyte *ptr = PIXEL_ADDR1(xrb, x[i], y[i]);
- *ptr = DITHER_HPCR( x[i], y[i], r, g, b );
- }
- }
-}
-
-
/*
* Write an array of identical 8-bit PF_GRAYSCALE pixels to an XImage.
*/
}
}
break;
- case PF_HPCR:
- {
- GLubyte *ptr1 = (GLubyte *) span->data;
- GLuint i;
- for (i=0;i<n;i++) {
- GLubyte p = *ptr1++;
- rgba[i][RCOMP] = p & 0xE0;
- rgba[i][GCOMP] = (p & 0x1C) << 3;
- rgba[i][BCOMP] = (p & 0x03) << 6;
- rgba[i][ACOMP] = 255;
- }
- }
- break;
case PF_Dither:
case PF_Lookup:
case PF_Grayscale:
}
}
break;
- case PF_HPCR:
- {
- const GLubyte *ptr1 = PIXEL_ADDR1(xrb, x, y);
- GLuint i;
- for (i=0;i<n;i++) {
- GLubyte p = *ptr1++;
- rgba[i][RCOMP] = p & 0xE0;
- rgba[i][GCOMP] = (p & 0x1C) << 3;
- rgba[i][BCOMP] = (p & 0x03) << 6;
- rgba[i][ACOMP] = 255;
- }
- }
- break;
case PF_Dither:
case PF_Lookup:
case PF_Grayscale:
rgba[i][ACOMP] = 255;
}
break;
- case PF_HPCR:
- for (i=0;i<n;i++) {
- unsigned long p = read_pixel( dpy, buffer,
- x[i], YFLIP(xrb, y[i]) );
- rgba[i][RCOMP] = (GLubyte) ( p & 0xE0 );
- rgba[i][GCOMP] = (GLubyte) ((p & 0x1C) << 3);
- rgba[i][BCOMP] = (GLubyte) ((p & 0x03) << 6);
- rgba[i][ACOMP] = (GLubyte) 255;
- }
- break;
case PF_Dither:
case PF_Lookup:
case PF_Grayscale:
rgba[i][ACOMP] = 255;
}
break;
- case PF_HPCR:
- for (i=0;i<n;i++) {
- GLubyte *ptr1 = PIXEL_ADDR1(xrb, x[i], y[i]);
- GLubyte p = *ptr1;
- rgba[i][RCOMP] = p & 0xE0;
- rgba[i][GCOMP] = (p & 0x1C) << 3;
- rgba[i][BCOMP] = (p & 0x03) << 6;
- rgba[i][ACOMP] = 255;
- }
- break;
case PF_Dither:
case PF_Lookup:
case PF_Grayscale:
rb->PutMonoValues = put_mono_values_1BIT_ximage;
}
break;
- case PF_HPCR:
- if (pixmap) {
- rb->PutRow = put_row_HPCR_pixmap;
- rb->PutRowRGB = put_row_rgb_HPCR_pixmap;
- rb->PutMonoRow = put_mono_row_pixmap;
- rb->PutValues = put_values_HPCR_pixmap;
- rb->PutMonoValues = put_mono_values_pixmap;
- }
- else {
- rb->PutRow = put_row_HPCR_ximage;
- rb->PutRowRGB = put_row_rgb_HPCR_ximage;
- rb->PutMonoRow = put_mono_row_HPCR_ximage;
- rb->PutValues = put_values_HPCR_ximage;
- rb->PutMonoValues = put_mono_values_HPCR_ximage;
- }
- break;
case PF_Lookup:
if (pixmap) {
rb->PutRow = put_row_LOOKUP_pixmap;