-
-void
-_swrast_mask_rgba_span(GLcontext *ctx, struct gl_renderbuffer *rb,
- const struct sw_span *span, GLchan rgba[][4])
-{
- GLchan dest[MAX_WIDTH][4];
-#if CHAN_BITS == 8
- GLuint srcMask = *((GLuint*)ctx->Color.ColorMask);
- GLuint dstMask = ~srcMask;
- GLuint *rgba32 = (GLuint *) rgba;
- GLuint *dest32 = (GLuint *) dest;
-#else
- const GLboolean rMask = ctx->Color.ColorMask[RCOMP];
- const GLboolean gMask = ctx->Color.ColorMask[GCOMP];
- const GLboolean bMask = ctx->Color.ColorMask[BCOMP];
- const GLboolean aMask = ctx->Color.ColorMask[ACOMP];
-#endif
- const GLuint n = span->end;
- GLuint i;
-
- ASSERT(n < MAX_WIDTH);
- ASSERT(span->arrayMask & SPAN_RGBA);
-
- if (span->arrayMask & SPAN_XY) {
- _swrast_get_values(ctx, rb, n, span->array->x, span->array->y,
- dest, 4 * sizeof(GLchan));
- }
- else {
- _swrast_read_rgba_span(ctx, rb, n, span->x, span->y, dest);
- }
-
-#if CHAN_BITS == 8
- for (i = 0; i < n; i++) {
- rgba32[i] = (rgba32[i] & srcMask) | (dest32[i] & dstMask);
- }
-#else
- for (i = 0; i < n; i++) {
- if (!rMask) rgba[i][RCOMP] = dest[i][RCOMP];
- if (!gMask) rgba[i][GCOMP] = dest[i][GCOMP];
- if (!bMask) rgba[i][BCOMP] = dest[i][BCOMP];
- if (!aMask) rgba[i][ACOMP] = dest[i][ACOMP];
- }
-#endif
-}
-
-
-/*
- * Apply glColorMask to a span of RGBA pixels.