From bd3d9b9d0497e64feec50153ad953a58a35bcd89 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 10 May 2001 16:54:12 +0000 Subject: [PATCH] RGBA mode GL_NAND was wrong, fixed 16-bit GLchan support --- src/mesa/swrast/s_logic.c | 151 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 144 insertions(+), 7 deletions(-) diff --git a/src/mesa/swrast/s_logic.c b/src/mesa/swrast/s_logic.c index 2d763c7..adc885e 100644 --- a/src/mesa/swrast/s_logic.c +++ b/src/mesa/swrast/s_logic.c @@ -1,4 +1,4 @@ -/* $Id: s_logic.c,v 1.6 2001/03/19 02:25:36 keithw Exp $ */ +/* $Id: s_logic.c,v 1.7 2001/05/10 16:54:12 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -207,9 +207,9 @@ _mesa_logicop_ci_pixels( GLcontext *ctx, * Note: Since the R, G, B, and A channels are all treated the same we * process them as 4-byte GLuints instead of four GLubytes. */ -static void rgba_logicop( const GLcontext *ctx, GLuint n, - const GLubyte mask[], - GLuint src[], const GLuint dest[] ) +static void rgba_logicop_ui( const GLcontext *ctx, GLuint n, + const GLubyte mask[], + GLuint src[], const GLuint dest[] ) { GLuint i; switch (ctx->Color.LogicOp) { @@ -261,7 +261,132 @@ static void rgba_logicop( const GLcontext *ctx, GLuint n, case GL_NAND: for (i=0;iColor.LogicOp) { + case GL_CLEAR: + for (i=0;iDrawBuffer, n, x, y, dest ); - rgba_logicop( ctx, n, mask, (GLuint *) rgba, (const GLuint *) 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); + } } @@ -360,5 +491,11 @@ _mesa_logicop_rgba_pixels( GLcontext *ctx, if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) { _mesa_read_alpha_pixels( ctx, n, x, y, dest, mask ); } - rgba_logicop( ctx, n, mask, (GLuint *) rgba, (const GLuint *) 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); + } } -- 2.7.4