diff options
author | Keith Whitwell <[email protected]> | 2001-05-10 15:42:42 +0000 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2001-05-10 15:42:42 +0000 |
commit | 8b6a91a93f1b3f79796f398884aaca77a8a09198 (patch) | |
tree | 3323c86826125422774042db5a174e403ea8e5e1 /src/mesa/drivers/x11/xm_span.c | |
parent | e296d7f0e455ebb1776d01196020a3b4ce2507fb (diff) |
Set 'prefer_float_colors' true, now that tnl uses them natively.
Apply Jeff Epler's optimization to ci spans as well, remove old code.
Diffstat (limited to 'src/mesa/drivers/x11/xm_span.c')
-rw-r--r-- | src/mesa/drivers/x11/xm_span.c | 95 |
1 files changed, 40 insertions, 55 deletions
diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index 404bd9e02b8..c9c1bdeb84b 100644 --- a/src/mesa/drivers/x11/xm_span.c +++ b/src/mesa/drivers/x11/xm_span.c @@ -1,4 +1,4 @@ -/* $Id: xm_span.c,v 1.12 2001/05/10 14:21:17 brianp Exp $ */ +/* $Id: xm_span.c,v 1.13 2001/05/10 15:42:43 keithw Exp $ */ /* * Mesa 3-D graphics library @@ -2547,51 +2547,35 @@ static void write_span_mono_pixmap( MONO_SPAN_ARGS ) XMesaGC gc = xmesa->xm_buffer->gc; const unsigned long pixel = xmesa_color_to_pixel(xmesa, color[RCOMP], color[GCOMP], color[BCOMP], color[ACOMP], xmesa->pixelformat); - register GLboolean write_all; register GLuint i; XMesaSetForeground( xmesa->display, gc, pixel ); y = FLIP(xmesa->xm_buffer, y); - write_all = GL_TRUE; - for (i=0;i<n;i++) { - if (!mask[i]) { - write_all = GL_FALSE; - break; - } - } - if (write_all) { - XMesaFillRectangle( dpy, buffer, gc, (int) x, (int) y, n, 1 ); - } - else { -#if 0 - for (i=0;i<n;i++,x++) { - if (mask[i]) { - XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y ); - } - } -#else - /* This version is usually faster. Contributed by Jeff Epler - * and cleaned up by Keith Whitwell. + + /* 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 */ - for (i = 0; i < n; ) { - GLuint start = i; - /* Identify and emit contiguous rendered pixels - */ - for( ; i < n && mask[i]; i++) - /* Nothing */; - if (start < i) - XMesaFillRectangle( dpy, buffer, gc, - (int)(x+start), (int) y, - (int)(i-start), 1); - /* Eat up non-rendered pixels - */ - for(; i < n && !mask[i]; i++) - /* Nothing */; - } -#endif + while (i < n && 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 write_span_mono_index_pixmap( const GLcontext *ctx, GLuint n, GLint x, GLint y, GLuint colorIndex, const GLubyte mask[] ) @@ -2600,26 +2584,27 @@ static void write_span_mono_index_pixmap( const GLcontext *ctx, GLuint n, XMesaDisplay *dpy = xmesa->xm_visual->display; XMesaDrawable buffer = xmesa->xm_buffer->buffer; XMesaGC gc = xmesa->xm_buffer->gc; - register GLboolean write_all; register GLuint i; XMesaSetForeground( xmesa->display, gc, colorIndex ); y = FLIP(xmesa->xm_buffer, y); - write_all = GL_TRUE; - for (i=0;i<n;i++) { - if (!mask[i]) { - write_all = GL_FALSE; - break; - } - } - if (write_all) { - XMesaFillRectangle( dpy, buffer, gc, (int) x, (int) y, n, 1 ); - } - else { - for (i=0;i<n;i++,x++) { - if (mask[i]) { - XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y ); - } - } + + for (i = 0 ; i < n ;) { + GLuint start = i; + + /* Identify and emit contiguous rendered pixels + */ + while (i < n && 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++; } } |