added dispatch override mechanism, used by trace extension
[mesa.git] / src / mesa / swrast / s_copypix.c
index a379cf0d5ce736a171eed6633a9d4bada9b93b96..401b448a630e613afd0ed95c441bea26b720764f 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: s_copypix.c,v 1.3 2000/11/05 18:24:40 keithw Exp $ */
+/* $Id: s_copypix.c,v 1.9 2001/01/05 21:28:31 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -37,7 +37,7 @@
 
 #include "s_context.h"
 #include "s_depth.h"
-#include "s_imaging.h"
+#include "s_histogram.h"
 #include "s_pixeltex.h"
 #include "s_span.h"
 #include "s_stencil.h"
@@ -167,7 +167,11 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
 
       /* scale & bias */
       if (transferOps & IMAGE_SCALE_BIAS_BIT) {
-         _mesa_scale_and_bias_rgba(ctx, width, rgba);
+         _mesa_scale_and_bias_rgba(ctx, width, rgba,
+                                   ctx->Pixel.RedScale, ctx->Pixel.GreenScale,
+                                   ctx->Pixel.BlueScale, ctx->Pixel.AlphaScale,
+                                   ctx->Pixel.RedBias, ctx->Pixel.GreenBias,
+                                   ctx->Pixel.BlueBias, ctx->Pixel.AlphaBias);
       }
       /* color map lookup */
       if (transferOps & IMAGE_MAP_COLOR_BIT) {
@@ -240,11 +244,11 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
 
          MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLchan));
 
-         for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) {
+         for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
             _mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba,
                               s, t, r, q);
-            gl_texture_pixels(ctx, unit, width, s, t, r, NULL,
-                              primary_rgba, rgba);
+            _swrast_texture_fragments(ctx, unit, width, s, t, r, NULL,
+                                      primary_rgba, rgba);
          }
       }
 
@@ -415,7 +419,11 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
          }
          /* scale & bias */
          if (transferOps & IMAGE_SCALE_BIAS_BIT) {
-            _mesa_scale_and_bias_rgba(ctx, width, rgbaFloat);
+            _mesa_scale_and_bias_rgba(ctx, width, rgbaFloat,
+                                   ctx->Pixel.RedScale, ctx->Pixel.GreenScale,
+                                   ctx->Pixel.BlueScale, ctx->Pixel.AlphaScale,
+                                   ctx->Pixel.RedBias, ctx->Pixel.GreenBias,
+                                   ctx->Pixel.BlueBias, ctx->Pixel.AlphaBias);
          }
          /* color map lookup */
          if (transferOps & IMAGE_MAP_COLOR_BIT) {
@@ -429,6 +437,18 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
          if (transferOps & IMAGE_CONVOLUTION_BIT) {
             /* XXX to do */
          }
+         /* GL_POST_CONVOLUTION_RED/GREEN/BLUE/ALPHA_SCALE/BIAS */
+         if (transferOps & IMAGE_POST_CONVOLUTION_SCALE_BIAS) {
+            _mesa_scale_and_bias_rgba(ctx, width, rgbaFloat,
+                                      ctx->Pixel.PostConvolutionScale[RCOMP],
+                                      ctx->Pixel.PostConvolutionScale[GCOMP],
+                                      ctx->Pixel.PostConvolutionScale[BCOMP],
+                                      ctx->Pixel.PostConvolutionScale[ACOMP],
+                                      ctx->Pixel.PostConvolutionBias[RCOMP],
+                                      ctx->Pixel.PostConvolutionBias[GCOMP],
+                                      ctx->Pixel.PostConvolutionBias[BCOMP],
+                                      ctx->Pixel.PostConvolutionBias[ACOMP]);
+         }
          /* GL_POST_CONVOLUTION_COLOR_TABLE lookup */
          if (transferOps & IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT) {
             _mesa_lookup_rgba(&ctx->PostConvolutionColorTable, width, rgbaFloat);
@@ -470,11 +490,11 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
 
          MEMCPY(primary_rgba, rgba, 4 * width * sizeof(GLchan));
 
-         for (unit = 0; unit < MAX_TEXTURE_UNITS; unit++) {
+         for (unit = 0; unit < ctx->Const.MaxTextureUnits; unit++) {
             _mesa_pixeltexgen(ctx, width, (const GLchan (*)[4]) rgba,
                               s, t, r, q);
-            gl_texture_pixels(ctx, unit, width, s, t, r, NULL,
-                              primary_rgba, rgba);
+            _swrast_texture_fragments(ctx, unit, width, s, t, r, NULL,
+                                      primary_rgba, rgba);
          }
       }
 
@@ -630,7 +650,7 @@ static void copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
    const GLboolean zoom = ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F;
    GLint overlapping;
 
-   if (!ctx->ReadBuffer->DepthBuffer || !ctx->DrawBuffer->DepthBuffer) {
+   if (!ctx->Visual.DepthBits) {
       gl_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" );
       return;
    }
@@ -738,7 +758,7 @@ static void copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
    const GLboolean shift_or_offset = ctx->Pixel.IndexShift || ctx->Pixel.IndexOffset;
    GLint overlapping;
 
-   if (!ctx->DrawBuffer->Stencil || !ctx->ReadBuffer->Stencil) {
+   if (!ctx->Visual.StencilBits) {
       gl_error( ctx, GL_INVALID_OPERATION, "glCopyPixels" );
       return;
    }