Implemented post-convolution scale and bias operation.
-/* $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
/* 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) {
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);
/* 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) {
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);
/* 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) {
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);
-/* $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
#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 | \
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 | \
-/* $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
* 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;
}
}
}
-/* $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
*/
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]);
-/* $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
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;
-/* $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
/* 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) {
}
/* 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) {
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);