/* * Apply the current logic operator to a span of RGBA pixels. * We can handle horizontal runs of pixels (spans) or arrays of x/y * pixel coordinates. */ void _swrast_logicop_rgba_span( GLcontext *ctx, const struct sw_span *span, GLchan rgba[][4] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLchan dest[MAX_WIDTH][4]; ASSERT(span->end < MAX_WIDTH); ASSERT(span->arrayMask & SPAN_RGBA); if (span->arrayMask & SPAN_XY) { (*swrast->Driver.ReadRGBAPixels)(ctx, span->end, span->array->x, span->array->y, dest, span->array->mask); if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { _swrast_read_alpha_pixels(ctx, span->end, span->array->x, span->array->y, dest, span->array->mask); } } else { _swrast_read_rgba_span(ctx, ctx->DrawBuffer, span->end, span->x, span->y, dest); } if (sizeof(GLchan) * 4 == sizeof(GLuint)) { rgba_logicop_ui(ctx, span->end, span->array->mask, (GLuint *) rgba, (const GLuint *) dest); } else { rgba_logicop_chan(ctx, 4 * span->end, span->array->mask, (GLchan *) rgba, (const GLchan *) dest); } }
/* * Apply the current logic operator to a span of RGBA pixels. * This is only used if the device driver can't do logic ops. */ void _mesa_logicop_rgba_span( GLcontext *ctx, GLuint n, GLint x, GLint y, GLchan rgba[][4], const GLubyte mask[] ) { GLchan dest[MAX_WIDTH][4]; _mesa_read_rgba_span( ctx, ctx->DrawBuffer, n, x, y, dest ); if (sizeof(GLchan) * 4 == sizeof(GLuint)) { rgba_logicop_ui(ctx, n, mask, (GLuint *) rgba, (const GLuint *) dest); } else { rgba_logicop_chan(ctx, 4 * n, mask, (GLchan *) rgba, (const GLchan *) dest); } }
/* * Apply the current logic operator to an array of RGBA pixels. * This is only used if the device driver can't do logic ops. */ void _mesa_logicop_rgba_pixels( GLcontext *ctx, GLuint n, const GLint x[], const GLint y[], GLchan rgba[][4], const GLubyte mask[] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); GLchan dest[PB_SIZE][4]; (*swrast->Driver.ReadRGBAPixels)( ctx, n, x, y, dest, mask ); if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { _mesa_read_alpha_pixels( ctx, n, x, y, dest, mask ); } if (sizeof(GLchan) * 4 == sizeof(GLuint)) { rgba_logicop_ui(ctx, n, mask, (GLuint *) rgba, (const GLuint *) dest); } else { rgba_logicop_chan(ctx, 4 * n, mask, (GLchan *) rgba, (const GLchan *) dest); } }