From b37a084357dd08573b86d6d8c5ba43d65bdc1bd7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 2 Feb 2002 21:40:33 +0000 Subject: Converted line drawing over to new span code, pb no longer used. Big clean-up of line drawing code. Removed many obsolete span processing functions. --- src/mesa/swrast/s_span.c | 68 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 59 insertions(+), 9 deletions(-) (limited to 'src/mesa/swrast/s_span.c') diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 2242a0827d..736049f7b9 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -1,4 +1,4 @@ -/* $Id: s_span.c,v 1.29 2002/02/02 17:24:11 brianp Exp $ */ +/* $Id: s_span.c,v 1.30 2002/02/02 21:40:33 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -45,7 +45,6 @@ #include "s_fog.h" #include "s_logic.h" #include "s_masking.h" -#include "s_scissor.h" #include "s_span.h" #include "s_stencil.h" #include "s_texture.h" @@ -433,10 +432,19 @@ clip_span( GLcontext *ctx, struct sw_span *span ) const GLint n = span->end; GLubyte *mask = span->mask; GLint i; - /* note: using & intead of && to reduce branches */ - for (i = 0; i < n; i++) { - mask[i] = (x[i] >= xmin) & (x[i] < xmax) - & (y[i] >= ymin) & (y[i] < ymax); + if (span->arrayMask & SPAN_MASK) { + /* note: using & intead of && to reduce branches */ + for (i = 0; i < n; i++) { + mask[i] &= (x[i] >= xmin) & (x[i] < xmax) + & (y[i] >= ymin) & (y[i] < ymax); + } + } + else { + /* note: using & intead of && to reduce branches */ + for (i = 0; i < n; i++) { + mask[i] = (x[i] >= xmin) & (x[i] < xmax) + & (y[i] >= ymin) & (y[i] < ymax); + } } return GL_TRUE; /* some pixels visible */ } @@ -640,12 +648,26 @@ _mesa_write_index_span( GLcontext *ctx, struct sw_span *span, /* Clipping */ if ((swrast->_RasterMask & CLIP_BIT) || (primitive == GL_BITMAP) - || (primitive == GL_POINT)) { + || (primitive == GL_POINT) || (primitive == GL_LINE)) { if (!clip_span(ctx, span)) { return; } } +#ifdef DEBUG + if (span->arrayMask & SPAN_XY) { + int i; + for (i = 0; i < span->end; i++) { + if (span->mask[i]) { + assert(span->xArray[i] >= ctx->DrawBuffer->_Xmin); + assert(span->xArray[i] < ctx->DrawBuffer->_Xmax); + assert(span->yArray[i] >= ctx->DrawBuffer->_Ymin); + assert(span->yArray[i] < ctx->DrawBuffer->_Ymax); + } + } + } +#endif + /* Polygon Stippling */ if (ctx->Polygon.StippleFlag && primitive == GL_POLYGON) { stipple_polygon_span(ctx, span); @@ -801,12 +823,26 @@ _mesa_write_rgba_span( GLcontext *ctx, struct sw_span *span, /* Clipping */ if ((swrast->_RasterMask & CLIP_BIT) || (primitive == GL_BITMAP) - || (primitive == GL_POINT)) { + || (primitive == GL_POINT) || (primitive == GL_LINE)) { if (!clip_span(ctx, span)) { return; } } +#ifdef DEBUG + if (span->arrayMask & SPAN_XY) { + int i; + for (i = 0; i < span->end; i++) { + if (span->mask[i]) { + assert(span->xArray[i] >= ctx->DrawBuffer->_Xmin); + assert(span->xArray[i] < ctx->DrawBuffer->_Xmax); + assert(span->yArray[i] >= ctx->DrawBuffer->_Ymin); + assert(span->yArray[i] < ctx->DrawBuffer->_Ymax); + } + } + } +#endif + /* Polygon Stippling */ if (ctx->Polygon.StippleFlag && primitive == GL_POLYGON) { stipple_polygon_span(ctx, span); @@ -1014,12 +1050,26 @@ _mesa_write_texture_span( GLcontext *ctx, struct sw_span *span, /* Clipping */ if ((swrast->_RasterMask & CLIP_BIT) || (primitive == GL_BITMAP) - || (primitive == GL_POINT)) { + || (primitive == GL_POINT) || (primitive == GL_LINE)) { if (!clip_span(ctx, span)) { return; } } +#ifdef DEBUG + if (span->arrayMask & SPAN_XY) { + int i; + for (i = 0; i < span->end; i++) { + if (span->mask[i]) { + assert(span->xArray[i] >= ctx->DrawBuffer->_Xmin); + assert(span->xArray[i] < ctx->DrawBuffer->_Xmax); + assert(span->yArray[i] >= ctx->DrawBuffer->_Ymin); + assert(span->yArray[i] < ctx->DrawBuffer->_Ymax); + } + } + } +#endif + /* Polygon Stippling */ if (ctx->Polygon.StippleFlag && primitive == GL_POLYGON) { stipple_polygon_span(ctx, span); -- cgit v1.2.3