summaryrefslogtreecommitdiff
path: root/src/mesa/swrast/s_span.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2002-02-02 21:40:33 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2002-02-02 21:40:33 +0000
commitb37a084357dd08573b86d6d8c5ba43d65bdc1bd7 (patch)
treee9b71cecbc7500a5c6144c79cda6ac2a7a7e3558 /src/mesa/swrast/s_span.c
parent733a4b602bbbfda83ee03b7ae4f3737bbe659034 (diff)
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.
Diffstat (limited to 'src/mesa/swrast/s_span.c')
-rw-r--r--src/mesa/swrast/s_span.c68
1 files changed, 59 insertions, 9 deletions
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);