simplify INIT_SPAN code

This commit is contained in:
Brian
2007-06-29 21:52:18 -06:00
parent fcc77d3ece
commit f4b103dc99
12 changed files with 55 additions and 31 deletions
+2 -2
View 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;
+2 -1
View 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 */
{
+3 -1
View 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;
+6 -2
View 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[] */
+6 -2
View 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;
}
+9 -4
View 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,
+9 -4
View 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) {
+4 -1
View 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
+3 -3
View 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) {
+9 -9
View 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)
+1 -1
View 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
+1 -1
View 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;