diff options
author | Brian Paul <[email protected]> | 2001-05-10 14:21:17 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2001-05-10 14:21:17 +0000 |
commit | e296d7f0e455ebb1776d01196020a3b4ce2507fb (patch) | |
tree | b827432b8ad5ea7c0f557a0288e203f1e7186a0e /src/mesa/drivers/x11 | |
parent | ad51be1ad4c60ad678405a860735901ef1e6ce94 (diff) |
applied Jeff & Keith's optimization to write_span_mono_pixmap()
Diffstat (limited to 'src/mesa/drivers/x11')
-rw-r--r-- | src/mesa/drivers/x11/xm_span.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index 0991a44f7e9..404bd9e02b8 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.11 2001/03/19 02:25:36 keithw Exp $ */ +/* $Id: xm_span.c,v 1.12 2001/05/10 14:21:17 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -2562,11 +2562,32 @@ static void write_span_mono_pixmap( MONO_SPAN_ARGS ) 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. + */ + 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 } } |