summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/image.c56
-rw-r--r--src/mesa/main/mtypes.h16
-rw-r--r--src/mesa/main/pixel.c32
-rw-r--r--src/mesa/main/pixel.h9
-rw-r--r--src/mesa/main/state.c15
-rw-r--r--src/mesa/swrast/s_copypix.c26
6 files changed, 117 insertions, 37 deletions
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 1c3203f63fe..f2003ccfbe0 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.49 2000/11/22 07:32:17 joukj Exp $ */
+/* $Id: image.c,v 1.50 2000/11/28 00:07:51 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -818,7 +818,11 @@ _mesa_pack_float_rgba_span( GLcontext *ctx,
/* scale & bias */
if (transferOps & IMAGE_SCALE_BIAS_BIT) {
- _mesa_scale_and_bias_rgba( ctx, n, rgba );
+ _mesa_scale_and_bias_rgba(ctx, n, 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) {
@@ -832,6 +836,18 @@ _mesa_pack_float_rgba_span( GLcontext *ctx,
if (transferOps & IMAGE_CONVOLUTION_BIT) {
/* this has to be done in the calling code */
}
+ /* GL_POST_CONVOLUTION_RED/GREEN/BLUE/ALPHA_SCALE/BIAS */
+ if (transferOps & IMAGE_POST_CONVOLUTION_SCALE_BIAS) {
+ _mesa_scale_and_bias_rgba(ctx, n, rgba,
+ 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, n, rgba);
@@ -2589,7 +2605,11 @@ _mesa_unpack_chan_color_span( GLcontext *ctx,
/* scale and bias colors */
if (transferOps & IMAGE_SCALE_BIAS_BIT) {
- _mesa_scale_and_bias_rgba(ctx, n, rgba);
+ _mesa_scale_and_bias_rgba(ctx, n, 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) {
@@ -2606,6 +2626,18 @@ _mesa_unpack_chan_color_span( GLcontext *ctx,
if (transferOps & IMAGE_CONVOLUTION_BIT) {
/* this has to be done in the calling code */
}
+ /* GL_POST_CONVOLUTION_RED/GREEN/BLUE/ALPHA_SCALE/BIAS */
+ if (transferOps & IMAGE_POST_CONVOLUTION_SCALE_BIAS) {
+ _mesa_scale_and_bias_rgba(ctx, n, rgba,
+ 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, n, rgba);
@@ -2847,7 +2879,11 @@ _mesa_unpack_float_color_span( GLcontext *ctx,
/* scale and bias colors */
if (transferOps & IMAGE_SCALE_BIAS_BIT) {
- _mesa_scale_and_bias_rgba(ctx, n, rgba);
+ _mesa_scale_and_bias_rgba(ctx, n, 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) {
@@ -2864,6 +2900,18 @@ _mesa_unpack_float_color_span( GLcontext *ctx,
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, n, rgba,
+ 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, n, rgba);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 41c1000c1d2..ee1fecfb30e 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.3 2000/11/27 18:22:13 brianp Exp $ */
+/* $Id: mtypes.h,v 1.4 2000/11/28 00:07:51 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1235,11 +1235,12 @@ struct gl_extensions {
#define IMAGE_MAP_COLOR_BIT 0x4
#define IMAGE_COLOR_TABLE_BIT 0x8
#define IMAGE_CONVOLUTION_BIT 0x10
-#define IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT 0x20
-#define IMAGE_COLOR_MATRIX_BIT 0x40
-#define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT 0x80
-#define IMAGE_HISTOGRAM_BIT 0x100
-#define IMAGE_MIN_MAX_BIT 0x200
+#define IMAGE_POST_CONVOLUTION_SCALE_BIAS 0x20
+#define IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT 0x40
+#define IMAGE_COLOR_MATRIX_BIT 0x80
+#define IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT 0x100
+#define IMAGE_HISTOGRAM_BIT 0x200
+#define IMAGE_MIN_MAX_BIT 0x400
/* transfer ops up to convolution: */
#define IMAGE_PRE_CONVOLUTION_BITS (IMAGE_SCALE_BIAS_BIT | \
@@ -1248,7 +1249,8 @@ struct gl_extensions {
IMAGE_COLOR_TABLE_BIT)
/* transfer ops after convolution: */
-#define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT | \
+#define IMAGE_POST_CONVOLUTION_BITS (IMAGE_POST_CONVOLUTION_SCALE_BIAS | \
+ IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT | \
IMAGE_COLOR_MATRIX_BIT | \
IMAGE_POST_COLOR_MATRIX_COLOR_TABLE_BIT |\
IMAGE_HISTOGRAM_BIT | \
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index 12097397fbc..efd89cadd42 100644
--- a/src/mesa/main/pixel.c
+++ b/src/mesa/main/pixel.c
@@ -1,4 +1,4 @@
-/* $Id: pixel.c,v 1.19 2000/11/22 07:32:17 joukj Exp $ */
+/* $Id: pixel.c,v 1.20 2000/11/28 00:07:51 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -653,38 +653,34 @@ _mesa_PixelTransferi( GLenum pname, GLint param )
* Apply scale and bias factors to an array of RGBA pixels.
*/
void
-_mesa_scale_and_bias_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4])
+_mesa_scale_and_bias_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4],
+ GLfloat rScale, GLfloat gScale,
+ GLfloat bScale, GLfloat aScale,
+ GLfloat rBias, GLfloat gBias,
+ GLfloat bBias, GLfloat aBias)
{
- if (ctx->Pixel.RedScale != 1.0 || ctx->Pixel.RedBias != 0.0) {
- const GLfloat scale = ctx->Pixel.RedScale;
- const GLfloat bias = ctx->Pixel.RedBias;
+ if (rScale != 1.0 || rBias != 0.0) {
GLuint i;
for (i = 0; i < n; i++) {
- rgba[i][RCOMP] = rgba[i][RCOMP] * scale + bias;
+ rgba[i][RCOMP] = rgba[i][RCOMP] * rScale + rBias;
}
}
- if (ctx->Pixel.GreenScale != 1.0 || ctx->Pixel.GreenBias != 0.0) {
- const GLfloat scale = ctx->Pixel.GreenScale;
- const GLfloat bias = ctx->Pixel.GreenBias;
+ if (gScale != 1.0 || gBias != 0.0) {
GLuint i;
for (i = 0; i < n; i++) {
- rgba[i][GCOMP] = rgba[i][GCOMP] * scale + bias;
+ rgba[i][GCOMP] = rgba[i][GCOMP] * gScale + gBias;
}
}
- if (ctx->Pixel.BlueScale != 1.0 || ctx->Pixel.BlueBias != 0.0) {
- const GLfloat scale = ctx->Pixel.BlueScale;
- const GLfloat bias = ctx->Pixel.BlueBias;
+ if (bScale != 1.0 || bBias != 0.0) {
GLuint i;
for (i = 0; i < n; i++) {
- rgba[i][BCOMP] = rgba[i][BCOMP] * scale + bias;
+ rgba[i][BCOMP] = rgba[i][BCOMP] * bScale + bBias;
}
}
- if (ctx->Pixel.AlphaScale != 1.0 || ctx->Pixel.AlphaBias != 0.0) {
- const GLfloat scale = ctx->Pixel.AlphaScale;
- const GLfloat bias = ctx->Pixel.AlphaBias;
+ if (aScale != 1.0 || aBias != 0.0) {
GLuint i;
for (i = 0; i < n; i++) {
- rgba[i][ACOMP] = rgba[i][ACOMP] * scale + bias;
+ rgba[i][ACOMP] = rgba[i][ACOMP] * aScale + aBias;
}
}
}
diff --git a/src/mesa/main/pixel.h b/src/mesa/main/pixel.h
index 2ff5a4ac6b3..db6dd78ffdb 100644
--- a/src/mesa/main/pixel.h
+++ b/src/mesa/main/pixel.h
@@ -1,4 +1,4 @@
-/* $Id: pixel.h,v 1.7 2000/11/22 07:32:17 joukj Exp $ */
+/* $Id: pixel.h,v 1.8 2000/11/28 00:07:51 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -77,8 +77,11 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor );
*/
extern void
-_mesa_scale_and_bias_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
-
+_mesa_scale_and_bias_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4],
+ GLfloat rScale, GLfloat gScale,
+ GLfloat bScale, GLfloat aScale,
+ GLfloat rBias, GLfloat gBias,
+ GLfloat bBias, GLfloat aBias);
extern void
_mesa_map_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4]);
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 0dbf48163d9..5c4dda99e8d 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,4 +1,4 @@
-/* $Id: state.c,v 1.49 2000/11/27 18:22:13 brianp Exp $ */
+/* $Id: state.c,v 1.50 2000/11/28 00:07:51 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -676,8 +676,19 @@ update_image_transfer_state(GLcontext *ctx)
if (ctx->Pixel.Convolution1DEnabled ||
ctx->Pixel.Convolution2DEnabled ||
- ctx->Pixel.Separable2DEnabled)
+ ctx->Pixel.Separable2DEnabled) {
mask |= IMAGE_CONVOLUTION_BIT;
+ if (ctx->Pixel.PostConvolutionScale[0] != 1.0F ||
+ ctx->Pixel.PostConvolutionScale[1] != 1.0F ||
+ ctx->Pixel.PostConvolutionScale[2] != 1.0F ||
+ ctx->Pixel.PostConvolutionScale[3] != 1.0F ||
+ ctx->Pixel.PostConvolutionBias[0] != 0.0F ||
+ ctx->Pixel.PostConvolutionBias[1] != 0.0F ||
+ ctx->Pixel.PostConvolutionBias[2] != 0.0F ||
+ ctx->Pixel.PostConvolutionBias[3] != 0.0F) {
+ mask |= IMAGE_POST_CONVOLUTION_SCALE_BIAS;
+ }
+ }
if (ctx->Pixel.PostConvolutionColorTableEnabled)
mask |= IMAGE_POST_CONVOLUTION_COLOR_TABLE_BIT;
diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c
index 03887a9e14c..96172e02712 100644
--- a/src/mesa/swrast/s_copypix.c
+++ b/src/mesa/swrast/s_copypix.c
@@ -1,4 +1,4 @@
-/* $Id: s_copypix.c,v 1.4 2000/11/10 18:29:18 brianp Exp $ */
+/* $Id: s_copypix.c,v 1.5 2000/11/28 00:07:52 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -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) {
@@ -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, rgba,
+ 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);