simplify INIT_SPAN code
authorBrian <brian.paul@tungstengraphics.com>
Sat, 30 Jun 2007 03:52:18 +0000 (21:52 -0600)
committerBrian <brian.paul@tungstengraphics.com>
Sat, 30 Jun 2007 03:52:18 +0000 (21:52 -0600)
12 files changed:
src/mesa/swrast/s_aalinetemp.h
src/mesa/swrast/s_aatritemp.h
src/mesa/swrast/s_accum.c
src/mesa/swrast/s_bitmap.c
src/mesa/swrast/s_buffers.c
src/mesa/swrast/s_copypix.c
src/mesa/swrast/s_drawpix.c
src/mesa/swrast/s_linetemp.h
src/mesa/swrast/s_points.c
src/mesa/swrast/s_span.h
src/mesa/swrast/s_tritemp.h
src/mesa/swrast/s_zoom.c

index 3d3511823d79615f530d33bec2cd129410395330..69a1f0cd3961fad98816734c68324abc46b2adce 100644 (file)
@@ -137,8 +137,8 @@ NAME(line)(GLcontext *ctx, const SWvertex *v0, const SWvertex *v1)
    if (line.len == 0.0 || IS_INF_OR_NAN(line.len))
       return;
 
-   INIT_SPAN(line.span, GL_LINE, 0, 0, SPAN_XY | SPAN_COVERAGE);
-
+   INIT_SPAN(line.span, GL_LINE);
+   line.span.arrayMask = SPAN_XY | SPAN_COVERAGE;
    line.xAdj = line.dx / line.len * line.halfWidth;
    line.yAdj = line.dy / line.len * line.halfWidth;
 
index 34a2305b39378de921b15e576fda8cb6e8defd3d..42d74a16328481470edf9a2c51f6371c2dbe3072 100644 (file)
@@ -69,7 +69,8 @@
    
    (void) swrast;
 
-   INIT_SPAN(span, GL_POLYGON, 0, 0, SPAN_COVERAGE);
+   INIT_SPAN(span, GL_POLYGON);
+   span.arrayMask = SPAN_COVERAGE;
 
    /* determine bottom to top order of vertices */
    {
index f53e7f52c5e919f242368f304163c1ac7dc9209e..3c45dee3998382fb9c815ba36adae3b5c411da1a 100644 (file)
@@ -474,7 +474,9 @@ accum_return(GLcontext *ctx, GLfloat value,
          SWspan span;
 
          /* init color span */
-         INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_RGBA);
+         INIT_SPAN(span, GL_BITMAP);
+         span.end = width;
+         span.arrayMask = SPAN_RGBA;
          span.x = xpos;
          span.y = ypos + i;
 
index 563b5fe602cb4f262032874b00dcbbb4487afc2c..1e7f6c18e6a2df7d7c8248019be0635e6a26e0cf 100644 (file)
@@ -82,7 +82,9 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
    if (SWRAST_CONTEXT(ctx)->NewState)
       _swrast_validate_derived( ctx );
 
-   INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_XY);
+   INIT_SPAN(span, GL_BITMAP);
+   span.end = width;
+   span.arrayMask = SPAN_XY;
    _swrast_span_default_attribs(ctx, &span);
 
    for (row = 0; row < height; row++) {
@@ -180,7 +182,9 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
    if (SWRAST_CONTEXT(ctx)->NewState)
       _swrast_validate_derived( ctx );
 
-   INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_MASK);
+   INIT_SPAN(span, GL_BITMAP);
+   span.end = width;
+   span.arrayMask = SPAN_MASK;
    _swrast_span_default_attribs(ctx, &span);
 
    /*span.arrayMask |= SPAN_MASK;*/  /* we'll init span.mask[] */
index bd66cf125b59f601acc0522a4195998ecaeccc7a..90a56284c51d96a187ca63c29e4f5fe6da93547a 100644 (file)
@@ -55,7 +55,9 @@ clear_rgba_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
 
    /* Initialize color span with clear color */
    /* XXX optimize for clearcolor == black/zero (bzero) */
-   INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_RGBA);
+   INIT_SPAN(span, GL_BITMAP);
+   span.end = width;
+   span.arrayMask = SPAN_RGBA;
    span.array->ChanType = rb->DataType;
    if (span.array->ChanType == GL_UNSIGNED_BYTE) {
       GLubyte clearColor[4];
@@ -119,7 +121,9 @@ clear_ci_buffer_with_masking(GLcontext *ctx, struct gl_renderbuffer *rb)
    ASSERT(rb->DataType == GL_UNSIGNED_INT);
 
    /* Initialize index span with clear index */
-   INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_INDEX);
+   INIT_SPAN(span, GL_BITMAP);
+   span.end = width;
+   span.arrayMask = SPAN_INDEX;
    for (i = 0; i < width;i++) {
       span.array->index[i] = ctx->Color.ClearIndex;
    }
index 9cd6ca20a9d494986a5c82a1a89cd65af12e246a..bbe1081860d885a1721ae4caa128fea7f6a4f9ad 100644 (file)
@@ -102,8 +102,10 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
    GLfloat *dest, *tmpImage, *convImage;
    SWspan span;
 
-   INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
+   INIT_SPAN(span, GL_BITMAP);
    _swrast_span_default_attribs(ctx, &span);
+   span.arrayMask = SPAN_RGBA;
+   span.arrayAttribs = FRAG_BIT_COL0;
 
    /* allocate space for GLfloat image */
    tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
@@ -232,8 +234,9 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
       stepy = 1;
    }
 
-   INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
+   INIT_SPAN(span, GL_BITMAP);
    _swrast_span_default_attribs(ctx, &span);
+   span.arrayMask = SPAN_RGBA;
    span.arrayAttribs = FRAG_BIT_COL0; /* we'll fill in COL0 attrib values */
 
    if (overlapping) {
@@ -315,8 +318,9 @@ copy_ci_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
       return;
    }
 
-   INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX);
+   INIT_SPAN(span, GL_BITMAP);
    _swrast_span_default_attribs(ctx, &span);
+   span.arrayMask = SPAN_INDEX;
 
    if (ctx->DrawBuffer == ctx->ReadBuffer) {
       overlapping = regions_overlap(srcx, srcy, destx, desty, width, height,
@@ -449,8 +453,9 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
       return;
    }
 
-   INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z);
+   INIT_SPAN(span, GL_BITMAP);
    _swrast_span_default_attribs(ctx, &span);
+   span.arrayMask = SPAN_Z;
 
    if (ctx->DrawBuffer == ctx->ReadBuffer) {
       overlapping = regions_overlap(srcx, srcy, destx, desty, width, height,
index b5388745bab44816c9b8a1964215d98786a3511f..b8b452e33ddfee3b30d8adb8a6ac3139203de541 100644 (file)
@@ -70,7 +70,9 @@ fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y,
       return GL_FALSE;
    }
 
-   INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
+   INIT_SPAN(span, GL_BITMAP);
+   span.arrayMask = SPAN_RGBA;
+   span.arrayAttribs = FRAG_BIT_COL0;
    _swrast_span_default_attribs(ctx, &span);
 
    /* copy input params since clipping may change them */
@@ -332,7 +334,8 @@ draw_index_pixels( GLcontext *ctx, GLint x, GLint y,
    GLint row, skipPixels;
    SWspan span;
 
-   INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_INDEX);
+   INIT_SPAN(span, GL_BITMAP);
+   span.arrayMask = SPAN_INDEX;
    _swrast_span_default_attribs(ctx, &span);
 
    /*
@@ -427,7 +430,8 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
    const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0;
    SWspan span;
 
-   INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z);
+   INIT_SPAN(span, GL_BITMAP);
+   span.arrayMask = SPAN_Z;
    _swrast_span_default_attribs(ctx, &span);
 
    if (type == GL_UNSIGNED_SHORT
@@ -544,8 +548,9 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
       return;
    }
 
-   INIT_SPAN(span, GL_BITMAP, 0, 0x0, SPAN_RGBA);
+   INIT_SPAN(span, GL_BITMAP);
    _swrast_span_default_attribs(ctx, &span);
+   span.arrayMask = SPAN_RGBA;
    span.arrayAttribs = FRAG_BIT_COL0; /* we're fill in COL0 attrib values */
 
    if (ctx->Pixel.Convolution2DEnabled || ctx->Pixel.Separable2DEnabled) {
index 55548f27b08a4a0568613bac3bfa9f3d4fa165a5..1accfc67e2ce66ff1f32e0c10845913a1bf2e23e 100644 (file)
@@ -303,7 +303,10 @@ NAME( GLcontext *ctx, const SWvertex *vert0, const SWvertex *vert1 )
    }
 #endif
 
-   INIT_SPAN(span, GL_LINE, numPixels, interpFlags, SPAN_XY);
+   INIT_SPAN(span, GL_LINE);
+   span.end = numPixels;
+   span.interpMask = interpFlags;
+   span.arrayMask = SPAN_XY;
 
    /*
     * Draw
index ade1eab89178824d82a6bf44a6ea101c66ef7b69..8eba53c80766ce64150402b3c62acdbedfae0ea3 100644 (file)
@@ -82,7 +82,7 @@ sprite_point(GLcontext *ctx, const SWvertex *vert)
    size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize);
 
    /* span init */
-   INIT_SPAN(span, GL_POINT, 0, 0, 0);
+   INIT_SPAN(span, GL_POINT);
    span.interpMask = SPAN_Z | SPAN_RGBA;
 
    span.red   = ChanToFixed(vert->color[0]);
@@ -248,7 +248,7 @@ smooth_point(GLcontext *ctx, const SWvertex *vert)
    (void) alphaAtten; /* not used */
 
    /* span init */
-   INIT_SPAN(span, GL_POINT, 0, 0, 0);
+   INIT_SPAN(span, GL_POINT);
    span.interpMask = SPAN_Z | SPAN_RGBA;
    span.arrayMask = SPAN_COVERAGE | SPAN_MASK;
 
@@ -367,7 +367,7 @@ large_point(GLcontext *ctx, const SWvertex *vert)
    size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize);
 
    /* span init */
-   INIT_SPAN(span, GL_POINT, 0, 0, 0);
+   INIT_SPAN(span, GL_POINT);
    span.arrayMask = SPAN_XY;
 
    if (ciMode) {
index 585cce91ee97998b0f55ef1a9042b38bb23811d4..512134db0f83bd1b0a07ec5f845b35a2eaae10e4 100644 (file)
@@ -159,15 +159,15 @@ typedef struct sw_span
 
 
 
-#define INIT_SPAN(S, PRIMITIVE, END, INTERP_MASK, ARRAY_MASK)  \
-do {                                                           \
-   (S).primitive = (PRIMITIVE);                                        \
-   (S).interpMask = (INTERP_MASK);                             \
-   (S).arrayMask = (ARRAY_MASK);                               \
-   (S).arrayAttribs = 0x0;                                     \
-   (S).end = (END);                                            \
-   (S).facing = 0;                                             \
-   (S).array = SWRAST_CONTEXT(ctx)->SpanArrays;                        \
+#define INIT_SPAN(S, PRIMITIVE)                        \
+do {                                           \
+   (S).primitive = (PRIMITIVE);                        \
+   (S).interpMask = 0x0;                       \
+   (S).arrayMask = 0x0;                                \
+   (S).arrayAttribs = 0x0;                     \
+   (S).end = 0;                                        \
+   (S).facing = 0;                             \
+   (S).array = SWRAST_CONTEXT(ctx)->SpanArrays;        \
 } while (0)
 
 
index 2a90ffd85f80a9f5f91c50d07c1eb12bf8d4e7a4..f5bc03e81e4a878599bd6aa588d1ee17509cd93b 100644 (file)
@@ -144,7 +144,7 @@ static void NAME(GLcontext *ctx, const SWvertex *v0,
 
    (void) swrast;
 
-   INIT_SPAN(span, GL_POLYGON, 0, 0, 0);
+   INIT_SPAN(span, GL_POLYGON);
    span.y = 0; /* silence warnings */
 
 #ifdef INTERP_Z
index 5f495e36c124d913b5b6e980a7244f35a3074c53..9f1a4c6f0a7e054ac12b8ef5fc29940799d2d272 100644 (file)
@@ -148,7 +148,7 @@ zoom_span( GLcontext *ctx, GLint imgX, GLint imgY, const SWspan *span,
    ASSERT((span->arrayMask & SPAN_XY) == 0);
    ASSERT(span->primitive == GL_BITMAP);
 
-   INIT_SPAN(zoomed, GL_BITMAP, 0, 0, 0);
+   INIT_SPAN(zoomed, GL_BITMAP);
    zoomed.x = x0;
    zoomed.end = zoomedWidth;
    zoomed.array = &zoomed_arrays;