params[0] = ENUM_TO_BOOLEAN(ctx->Hint.PerspectiveCorrection);
break;
case GL_PIXEL_MAP_A_TO_A_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapAtoAsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.AtoA.Size);
break;
case GL_PIXEL_MAP_B_TO_B_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapBtoBsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.BtoB.Size);
break;
case GL_PIXEL_MAP_G_TO_G_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapGtoGsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.GtoG.Size);
break;
case GL_PIXEL_MAP_I_TO_A_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoAsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoA.Size);
break;
case GL_PIXEL_MAP_I_TO_B_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoBsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoB.Size);
break;
case GL_PIXEL_MAP_I_TO_G_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoGsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoG.Size);
break;
case GL_PIXEL_MAP_I_TO_I_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoIsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoI.Size);
break;
case GL_PIXEL_MAP_I_TO_R_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapItoRsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.ItoR.Size);
break;
case GL_PIXEL_MAP_R_TO_R_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapRtoRsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.RtoR.Size);
break;
case GL_PIXEL_MAP_S_TO_S_SIZE:
- params[0] = INT_TO_BOOLEAN(ctx->Pixel.MapStoSsize);
+ params[0] = INT_TO_BOOLEAN(ctx->PixelMaps.StoS.Size);
break;
case GL_POINT_SIZE:
params[0] = FLOAT_TO_BOOLEAN(ctx->Point.Size);
params[0] = ENUM_TO_FLOAT(ctx->Hint.PerspectiveCorrection);
break;
case GL_PIXEL_MAP_A_TO_A_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapAtoAsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.AtoA.Size);
break;
case GL_PIXEL_MAP_B_TO_B_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapBtoBsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.BtoB.Size);
break;
case GL_PIXEL_MAP_G_TO_G_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapGtoGsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.GtoG.Size);
break;
case GL_PIXEL_MAP_I_TO_A_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapItoAsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.ItoA.Size);
break;
case GL_PIXEL_MAP_I_TO_B_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapItoBsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.ItoB.Size);
break;
case GL_PIXEL_MAP_I_TO_G_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapItoGsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.ItoG.Size);
break;
case GL_PIXEL_MAP_I_TO_I_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapItoIsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.ItoI.Size);
break;
case GL_PIXEL_MAP_I_TO_R_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapItoRsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.ItoR.Size);
break;
case GL_PIXEL_MAP_R_TO_R_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapRtoRsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.RtoR.Size);
break;
case GL_PIXEL_MAP_S_TO_S_SIZE:
- params[0] = (GLfloat)(ctx->Pixel.MapStoSsize);
+ params[0] = (GLfloat)(ctx->PixelMaps.StoS.Size);
break;
case GL_POINT_SIZE:
params[0] = ctx->Point.Size;
params[0] = ENUM_TO_INT(ctx->Hint.PerspectiveCorrection);
break;
case GL_PIXEL_MAP_A_TO_A_SIZE:
- params[0] = ctx->Pixel.MapAtoAsize;
+ params[0] = ctx->PixelMaps.AtoA.Size;
break;
case GL_PIXEL_MAP_B_TO_B_SIZE:
- params[0] = ctx->Pixel.MapBtoBsize;
+ params[0] = ctx->PixelMaps.BtoB.Size;
break;
case GL_PIXEL_MAP_G_TO_G_SIZE:
- params[0] = ctx->Pixel.MapGtoGsize;
+ params[0] = ctx->PixelMaps.GtoG.Size;
break;
case GL_PIXEL_MAP_I_TO_A_SIZE:
- params[0] = ctx->Pixel.MapItoAsize;
+ params[0] = ctx->PixelMaps.ItoA.Size;
break;
case GL_PIXEL_MAP_I_TO_B_SIZE:
- params[0] = ctx->Pixel.MapItoBsize;
+ params[0] = ctx->PixelMaps.ItoB.Size;
break;
case GL_PIXEL_MAP_I_TO_G_SIZE:
- params[0] = ctx->Pixel.MapItoGsize;
+ params[0] = ctx->PixelMaps.ItoG.Size;
break;
case GL_PIXEL_MAP_I_TO_I_SIZE:
- params[0] = ctx->Pixel.MapItoIsize;
+ params[0] = ctx->PixelMaps.ItoI.Size;
break;
case GL_PIXEL_MAP_I_TO_R_SIZE:
- params[0] = ctx->Pixel.MapItoRsize;
+ params[0] = ctx->PixelMaps.ItoR.Size;
break;
case GL_PIXEL_MAP_R_TO_R_SIZE:
- params[0] = ctx->Pixel.MapRtoRsize;
+ params[0] = ctx->PixelMaps.RtoR.Size;
break;
case GL_PIXEL_MAP_S_TO_S_SIZE:
- params[0] = ctx->Pixel.MapStoSsize;
+ params[0] = ctx->PixelMaps.StoS.Size;
break;
case GL_POINT_SIZE:
params[0] = IROUND(ctx->Point.Size);
( "GL_PACK_INVERT_MESA", GLboolean, ["ctx->Pack.Invert"], "", None ),
( "GL_PERSPECTIVE_CORRECTION_HINT", GLenum,
["ctx->Hint.PerspectiveCorrection"], "", None ),
- ( "GL_PIXEL_MAP_A_TO_A_SIZE", GLint, ["ctx->Pixel.MapAtoAsize"], "", None ),
- ( "GL_PIXEL_MAP_B_TO_B_SIZE", GLint, ["ctx->Pixel.MapBtoBsize"], "", None ),
- ( "GL_PIXEL_MAP_G_TO_G_SIZE", GLint, ["ctx->Pixel.MapGtoGsize"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_A_SIZE", GLint, ["ctx->Pixel.MapItoAsize"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_B_SIZE", GLint, ["ctx->Pixel.MapItoBsize"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_G_SIZE", GLint, ["ctx->Pixel.MapItoGsize"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_I_SIZE", GLint, ["ctx->Pixel.MapItoIsize"], "", None ),
- ( "GL_PIXEL_MAP_I_TO_R_SIZE", GLint, ["ctx->Pixel.MapItoRsize"], "", None ),
- ( "GL_PIXEL_MAP_R_TO_R_SIZE", GLint, ["ctx->Pixel.MapRtoRsize"], "", None ),
- ( "GL_PIXEL_MAP_S_TO_S_SIZE", GLint, ["ctx->Pixel.MapStoSsize"], "", None ),
+ ( "GL_PIXEL_MAP_A_TO_A_SIZE", GLint, ["ctx->PixelMaps.AtoA.Size"], "", None ),
+ ( "GL_PIXEL_MAP_B_TO_B_SIZE", GLint, ["ctx->PixelMaps.BtoB.Size"], "", None ),
+ ( "GL_PIXEL_MAP_G_TO_G_SIZE", GLint, ["ctx->PixelMaps.GtoG.Size"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_A_SIZE", GLint, ["ctx->PixelMaps.ItoA.Size"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_B_SIZE", GLint, ["ctx->PixelMaps.ItoB.Size"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_G_SIZE", GLint, ["ctx->PixelMaps.ItoG.Size"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_I_SIZE", GLint, ["ctx->PixelMaps.ItoI.Size"], "", None ),
+ ( "GL_PIXEL_MAP_I_TO_R_SIZE", GLint, ["ctx->PixelMaps.ItoR.Size"], "", None ),
+ ( "GL_PIXEL_MAP_R_TO_R_SIZE", GLint, ["ctx->PixelMaps.RtoR.Size"], "", None ),
+ ( "GL_PIXEL_MAP_S_TO_S_SIZE", GLint, ["ctx->PixelMaps.StoS.Size"], "", None ),
( "GL_POINT_SIZE", GLfloat, ["ctx->Point.Size"], "", None ),
( "GL_POINT_SIZE_GRANULARITY", GLfloat,
["ctx->Const.PointSizeGranularity"], "", None ),
};
+/**
+ * A pixelmap (see glPixelMap)
+ */
+struct gl_pixelmap
+{
+ GLint Size;
+ GLfloat Map[MAX_PIXEL_MAP_TABLE];
+ GLubyte Map8[MAX_PIXEL_MAP_TABLE]; /**< converted to 8-bit color */
+};
+
+
+/**
+ * Collection of all pixelmaps
+ */
+struct gl_pixelmaps
+{
+ struct gl_pixelmap RtoR; /**< i.e. GL_PIXEL_MAP_R_TO_R */
+ struct gl_pixelmap GtoG;
+ struct gl_pixelmap BtoB;
+ struct gl_pixelmap AtoA;
+ struct gl_pixelmap ItoR;
+ struct gl_pixelmap ItoG;
+ struct gl_pixelmap ItoB;
+ struct gl_pixelmap ItoA;
+ struct gl_pixelmap ItoI;
+ struct gl_pixelmap StoS;
+};
+
+
/**
* Pixel attribute group (GL_PIXEL_MODE_BIT).
*/
struct gl_pixel_attrib
{
GLenum ReadBuffer; /**< source buffer for glRead/CopyPixels() */
+
+ /*--- Begin Pixel Transfer State ---*/
+ /* Fields are in the order in which they're applied... */
+
+ /* Scale & Bias (index shift, offset) */
GLfloat RedBias, RedScale;
GLfloat GreenBias, GreenScale;
GLfloat BlueBias, BlueScale;
GLfloat AlphaBias, AlphaScale;
GLfloat DepthBias, DepthScale;
GLint IndexShift, IndexOffset;
+
+ /* Pixel Maps */
+ /* Note: actual pixel maps are not part of this attrib group */
GLboolean MapColorFlag;
GLboolean MapStencilFlag;
- GLfloat ZoomX, ZoomY;
- /* XXX move these out of gl_pixel_attrib */
- GLint MapStoSsize; /**< Size of each pixel map */
- GLint MapItoIsize;
- GLint MapItoRsize;
- GLint MapItoGsize;
- GLint MapItoBsize;
- GLint MapItoAsize;
- GLint MapRtoRsize;
- GLint MapGtoGsize;
- GLint MapBtoBsize;
- GLint MapAtoAsize;
- GLint MapStoS[MAX_PIXEL_MAP_TABLE]; /**< Pixel map tables */
- GLfloat MapItoI[MAX_PIXEL_MAP_TABLE];
- GLfloat MapItoR[MAX_PIXEL_MAP_TABLE];
- GLfloat MapItoG[MAX_PIXEL_MAP_TABLE];
- GLfloat MapItoB[MAX_PIXEL_MAP_TABLE];
- GLfloat MapItoA[MAX_PIXEL_MAP_TABLE];
- GLubyte MapItoR8[MAX_PIXEL_MAP_TABLE]; /**< converted to 8-bit color */
- GLubyte MapItoG8[MAX_PIXEL_MAP_TABLE];
- GLubyte MapItoB8[MAX_PIXEL_MAP_TABLE];
- GLubyte MapItoA8[MAX_PIXEL_MAP_TABLE];
- GLfloat MapRtoR[MAX_PIXEL_MAP_TABLE];
- GLfloat MapGtoG[MAX_PIXEL_MAP_TABLE];
- GLfloat MapBtoB[MAX_PIXEL_MAP_TABLE];
- GLfloat MapAtoA[MAX_PIXEL_MAP_TABLE];
- /** GL_EXT_histogram */
- GLboolean HistogramEnabled;
- GLboolean MinMaxEnabled;
- /** GL_SGI_color_matrix */
- GLfloat PostColorMatrixScale[4]; /**< RGBA */
- GLfloat PostColorMatrixBias[4]; /**< RGBA */
- /** GL_SGI_color_table */
+
+ /* Color table lookup (GL_SGI_color_table) */
+ /* Note: actual table is not part of this attrib group */
GLfloat ColorTableScale[4];
GLfloat ColorTableBias[4];
GLboolean ColorTableEnabled;
- GLfloat PCCTscale[4];
- GLfloat PCCTbias[4];
- GLboolean PostConvolutionColorTableEnabled;
- GLfloat PCMCTscale[4];
- GLfloat PCMCTbias[4];
- GLboolean PostColorMatrixColorTableEnabled;
- /** GL_SGI_texture_color_table */
- GLfloat TextureColorTableScale[4];
- GLfloat TextureColorTableBias[4];
- /** Convolution */
+
+ /* Convolution (GL_EXT_convolution) */
GLboolean Convolution1DEnabled;
GLboolean Convolution2DEnabled;
GLboolean Separable2DEnabled;
GLfloat ConvolutionBorderColor[3][4];
GLenum ConvolutionBorderMode[3];
- GLfloat ConvolutionFilterScale[3][4];
- GLfloat ConvolutionFilterBias[3][4];
+ GLfloat ConvolutionFilterScale[3][4]; /**< RGBA */
+ GLfloat ConvolutionFilterBias[3][4]; /**< RGBA */
GLfloat PostConvolutionScale[4]; /**< RGBA */
GLfloat PostConvolutionBias[4]; /**< RGBA */
+
+ /* Post-convolution color table */
+ /* Note: actual table is not part of this attrib group */
+ GLboolean PostConvolutionColorTableEnabled;
+ GLfloat PCCTscale[4]; /** Post Convolution Color Table scale */
+ GLfloat PCCTbias[4]; /** Post Convolution Color Table bias */
+
+ /* Color matrix (GL_SGI_color_matrix) */
+ /* Note: the color matrix is not part of this attrib group */
+ GLfloat PostColorMatrixScale[4]; /**< RGBA */
+ GLfloat PostColorMatrixBias[4]; /**< RGBA */
+
+ /* Post color matrix color table */
+ /* Note: actual table is not part of this attrib group */
+ GLboolean PostColorMatrixColorTableEnabled;
+ GLfloat PCMCTscale[4]; /** Post Color Matrix Color Table scale */
+ GLfloat PCMCTbias[4]; /** Post Color Matrix Color Table bias */
+
+ /* Histogram & minmax (GL_EXT_histogram) */
+ /* Note: histogram and minmax data are not part of this attrib group */
+ GLboolean HistogramEnabled;
+ GLboolean MinMaxEnabled;
+
+ /*--- End Pixel Transfer State ---*/
+
+ /* Pixel Zoom */
+ GLfloat ZoomX, ZoomY;
+
+ /** GL_SGI_texture_color_table */
+ GLfloat TextureColorTableScale[4];
+ GLfloat TextureColorTableBias[4];
};
/** \name Other assorted state (not pushed/popped on attribute stack) */
/*@{*/
+ struct gl_pixelmaps PixelMaps;
struct gl_histogram_attrib Histogram;
struct gl_minmax_attrib MinMax;
struct gl_convolution_attrib Convolution1D;
GLint i;
switch (map) {
case GL_PIXEL_MAP_S_TO_S:
- ctx->Pixel.MapStoSsize = mapsize;
+ ctx->PixelMaps.StoS.Size = mapsize;
for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapStoS[i] = IROUND(values[i]);
+ ctx->PixelMaps.StoS.Map[i] = IROUND(values[i]);
}
break;
case GL_PIXEL_MAP_I_TO_I:
- ctx->Pixel.MapItoIsize = mapsize;
+ ctx->PixelMaps.ItoI.Size = mapsize;
for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapItoI[i] = values[i];
+ ctx->PixelMaps.ItoI.Map[i] = values[i];
}
break;
case GL_PIXEL_MAP_I_TO_R:
- ctx->Pixel.MapItoRsize = mapsize;
+ ctx->PixelMaps.ItoR.Size = mapsize;
for (i = 0; i < mapsize; i++) {
GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
- ctx->Pixel.MapItoR[i] = val;
- ctx->Pixel.MapItoR8[i] = (GLint) (val * 255.0F);
+ ctx->PixelMaps.ItoR.Map[i] = val;
+ ctx->PixelMaps.ItoR.Map8[i] = (GLint) (val * 255.0F);
}
break;
case GL_PIXEL_MAP_I_TO_G:
- ctx->Pixel.MapItoGsize = mapsize;
+ ctx->PixelMaps.ItoG.Size = mapsize;
for (i = 0; i < mapsize; i++) {
GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
- ctx->Pixel.MapItoG[i] = val;
- ctx->Pixel.MapItoG8[i] = (GLint) (val * 255.0F);
+ ctx->PixelMaps.ItoG.Map[i] = val;
+ ctx->PixelMaps.ItoG.Map8[i] = (GLint) (val * 255.0F);
}
break;
case GL_PIXEL_MAP_I_TO_B:
- ctx->Pixel.MapItoBsize = mapsize;
+ ctx->PixelMaps.ItoB.Size = mapsize;
for (i = 0; i < mapsize; i++) {
GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
- ctx->Pixel.MapItoB[i] = val;
- ctx->Pixel.MapItoB8[i] = (GLint) (val * 255.0F);
+ ctx->PixelMaps.ItoB.Map[i] = val;
+ ctx->PixelMaps.ItoB.Map8[i] = (GLint) (val * 255.0F);
}
break;
case GL_PIXEL_MAP_I_TO_A:
- ctx->Pixel.MapItoAsize = mapsize;
+ ctx->PixelMaps.ItoA.Size = mapsize;
for (i = 0; i < mapsize; i++) {
GLfloat val = CLAMP( values[i], 0.0F, 1.0F );
- ctx->Pixel.MapItoA[i] = val;
- ctx->Pixel.MapItoA8[i] = (GLint) (val * 255.0F);
+ ctx->PixelMaps.ItoA.Map[i] = val;
+ ctx->PixelMaps.ItoA.Map8[i] = (GLint) (val * 255.0F);
}
break;
case GL_PIXEL_MAP_R_TO_R:
- ctx->Pixel.MapRtoRsize = mapsize;
+ ctx->PixelMaps.RtoR.Size = mapsize;
for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapRtoR[i] = CLAMP( values[i], 0.0F, 1.0F );
+ ctx->PixelMaps.RtoR.Map[i] = CLAMP( values[i], 0.0F, 1.0F );
}
break;
case GL_PIXEL_MAP_G_TO_G:
- ctx->Pixel.MapGtoGsize = mapsize;
+ ctx->PixelMaps.GtoG.Size = mapsize;
for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapGtoG[i] = CLAMP( values[i], 0.0F, 1.0F );
+ ctx->PixelMaps.GtoG.Map[i] = CLAMP( values[i], 0.0F, 1.0F );
}
break;
case GL_PIXEL_MAP_B_TO_B:
- ctx->Pixel.MapBtoBsize = mapsize;
+ ctx->PixelMaps.BtoB.Size = mapsize;
for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapBtoB[i] = CLAMP( values[i], 0.0F, 1.0F );
+ ctx->PixelMaps.BtoB.Map[i] = CLAMP( values[i], 0.0F, 1.0F );
}
break;
case GL_PIXEL_MAP_A_TO_A:
- ctx->Pixel.MapAtoAsize = mapsize;
+ ctx->PixelMaps.AtoA.Size = mapsize;
for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapAtoA[i] = CLAMP( values[i], 0.0F, 1.0F );
+ ctx->PixelMaps.AtoA.Map[i] = CLAMP( values[i], 0.0F, 1.0F );
}
break;
default:
{
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
- return ctx->Pixel.MapItoIsize;
+ return ctx->PixelMaps.ItoI.Size;
case GL_PIXEL_MAP_S_TO_S:
- return ctx->Pixel.MapStoSsize;
+ return ctx->PixelMaps.StoS.Size;
case GL_PIXEL_MAP_I_TO_R:
- return ctx->Pixel.MapItoRsize;
+ return ctx->PixelMaps.ItoR.Size;
case GL_PIXEL_MAP_I_TO_G:
- return ctx->Pixel.MapItoGsize;
+ return ctx->PixelMaps.ItoG.Size;
case GL_PIXEL_MAP_I_TO_B:
- return ctx->Pixel.MapItoBsize;
+ return ctx->PixelMaps.ItoB.Size;
case GL_PIXEL_MAP_I_TO_A:
- return ctx->Pixel.MapItoAsize;
+ return ctx->PixelMaps.ItoA.Size;
case GL_PIXEL_MAP_R_TO_R:
- return ctx->Pixel.MapRtoRsize;
+ return ctx->PixelMaps.RtoR.Size;
case GL_PIXEL_MAP_G_TO_G:
- return ctx->Pixel.MapGtoGsize;
+ return ctx->PixelMaps.GtoG.Size;
case GL_PIXEL_MAP_B_TO_B:
- return ctx->Pixel.MapBtoBsize;
+ return ctx->PixelMaps.BtoB.Size;
case GL_PIXEL_MAP_A_TO_A:
- return ctx->Pixel.MapAtoAsize;
+ return ctx->PixelMaps.AtoA.Size;
default:
return 0;
}
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
- MEMCPY(values, ctx->Pixel.MapItoI, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.ItoI.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_S_TO_S:
for (i = 0; i < mapsize; i++) {
- values[i] = (GLfloat) ctx->Pixel.MapStoS[i];
+ values[i] = (GLfloat) ctx->PixelMaps.StoS.Map[i];
}
break;
case GL_PIXEL_MAP_I_TO_R:
- MEMCPY(values, ctx->Pixel.MapItoR, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.ItoR.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_I_TO_G:
- MEMCPY(values, ctx->Pixel.MapItoG, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.ItoG.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_I_TO_B:
- MEMCPY(values, ctx->Pixel.MapItoB, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.ItoB.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_I_TO_A:
- MEMCPY(values, ctx->Pixel.MapItoA, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.ItoA.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_R_TO_R:
- MEMCPY(values, ctx->Pixel.MapRtoR, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.RtoR.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_G_TO_G:
- MEMCPY(values, ctx->Pixel.MapGtoG, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.GtoG.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_B_TO_B:
- MEMCPY(values, ctx->Pixel.MapBtoB, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.BtoB.Map, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_A_TO_A:
- MEMCPY(values, ctx->Pixel.MapAtoA, mapsize * sizeof(GLfloat));
+ MEMCPY(values, ctx->PixelMaps.AtoA.Map, mapsize * sizeof(GLfloat));
break;
default:
_mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" );
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoI[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.ItoI.Map[i] );
}
break;
case GL_PIXEL_MAP_S_TO_S:
- MEMCPY(values, ctx->Pixel.MapStoS, mapsize * sizeof(GLint));
+ MEMCPY(values, ctx->PixelMaps.StoS.Map, mapsize * sizeof(GLint));
break;
case GL_PIXEL_MAP_I_TO_R:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoR[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.ItoR.Map[i] );
}
break;
case GL_PIXEL_MAP_I_TO_G:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoG[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.ItoG.Map[i] );
}
break;
case GL_PIXEL_MAP_I_TO_B:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoB[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.ItoB.Map[i] );
}
break;
case GL_PIXEL_MAP_I_TO_A:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoA[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.ItoA.Map[i] );
}
break;
case GL_PIXEL_MAP_R_TO_R:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapRtoR[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.RtoR.Map[i] );
}
break;
case GL_PIXEL_MAP_G_TO_G:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapGtoG[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.GtoG.Map[i] );
}
break;
case GL_PIXEL_MAP_B_TO_B:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapBtoB[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.BtoB.Map[i] );
}
break;
case GL_PIXEL_MAP_A_TO_A:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_UINT( ctx->Pixel.MapAtoA[i] );
+ values[i] = FLOAT_TO_UINT( ctx->PixelMaps.AtoA.Map[i] );
}
break;
default:
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
for (i = 0; i < mapsize; i++) {
- values[i] = (GLushort) CLAMP(ctx->Pixel.MapItoI[i], 0.0, 65535.0);
+ values[i] = (GLushort) CLAMP(ctx->PixelMaps.ItoI.Map[i], 0.0, 65535.0);
}
break;
case GL_PIXEL_MAP_S_TO_S:
for (i = 0; i < mapsize; i++) {
- values[i] = (GLushort) CLAMP(ctx->Pixel.MapStoS[i], 0.0, 65535.0);
+ values[i] = (GLushort) CLAMP(ctx->PixelMaps.StoS.Map[i], 0.0, 65535.0);
}
break;
case GL_PIXEL_MAP_I_TO_R:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoR[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.ItoR.Map[i] );
}
break;
case GL_PIXEL_MAP_I_TO_G:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoG[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.ItoG.Map[i] );
}
break;
case GL_PIXEL_MAP_I_TO_B:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoB[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.ItoB.Map[i] );
}
break;
case GL_PIXEL_MAP_I_TO_A:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoA[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.ItoA.Map[i] );
}
break;
case GL_PIXEL_MAP_R_TO_R:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapRtoR[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.RtoR.Map[i] );
}
break;
case GL_PIXEL_MAP_G_TO_G:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapGtoG[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.GtoG.Map[i] );
}
break;
case GL_PIXEL_MAP_B_TO_B:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapBtoB[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.BtoB.Map[i] );
}
break;
case GL_PIXEL_MAP_A_TO_A:
for (i = 0; i < mapsize; i++) {
- CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapAtoA[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->PixelMaps.AtoA.Map[i] );
}
break;
default:
void
_mesa_map_rgba( const GLcontext *ctx, GLuint n, GLfloat rgba[][4] )
{
- const GLfloat rscale = (GLfloat) (ctx->Pixel.MapRtoRsize - 1);
- const GLfloat gscale = (GLfloat) (ctx->Pixel.MapGtoGsize - 1);
- const GLfloat bscale = (GLfloat) (ctx->Pixel.MapBtoBsize - 1);
- const GLfloat ascale = (GLfloat) (ctx->Pixel.MapAtoAsize - 1);
- const GLfloat *rMap = ctx->Pixel.MapRtoR;
- const GLfloat *gMap = ctx->Pixel.MapGtoG;
- const GLfloat *bMap = ctx->Pixel.MapBtoB;
- const GLfloat *aMap = ctx->Pixel.MapAtoA;
+ const GLfloat rscale = (GLfloat) (ctx->PixelMaps.RtoR.Size - 1);
+ const GLfloat gscale = (GLfloat) (ctx->PixelMaps.GtoG.Size - 1);
+ const GLfloat bscale = (GLfloat) (ctx->PixelMaps.BtoB.Size - 1);
+ const GLfloat ascale = (GLfloat) (ctx->PixelMaps.AtoA.Size - 1);
+ const GLfloat *rMap = ctx->PixelMaps.RtoR.Map;
+ const GLfloat *gMap = ctx->PixelMaps.GtoG.Map;
+ const GLfloat *bMap = ctx->PixelMaps.BtoB.Map;
+ const GLfloat *aMap = ctx->PixelMaps.AtoA.Map;
GLuint i;
for (i=0;i<n;i++) {
GLfloat r = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F);
_mesa_map_ci_to_rgba( const GLcontext *ctx, GLuint n,
const GLuint index[], GLfloat rgba[][4] )
{
- GLuint rmask = ctx->Pixel.MapItoRsize - 1;
- GLuint gmask = ctx->Pixel.MapItoGsize - 1;
- GLuint bmask = ctx->Pixel.MapItoBsize - 1;
- GLuint amask = ctx->Pixel.MapItoAsize - 1;
- const GLfloat *rMap = ctx->Pixel.MapItoR;
- const GLfloat *gMap = ctx->Pixel.MapItoG;
- const GLfloat *bMap = ctx->Pixel.MapItoB;
- const GLfloat *aMap = ctx->Pixel.MapItoA;
+ GLuint rmask = ctx->PixelMaps.ItoR.Size - 1;
+ GLuint gmask = ctx->PixelMaps.ItoG.Size - 1;
+ GLuint bmask = ctx->PixelMaps.ItoB.Size - 1;
+ GLuint amask = ctx->PixelMaps.ItoA.Size - 1;
+ const GLfloat *rMap = ctx->PixelMaps.ItoR.Map;
+ const GLfloat *gMap = ctx->PixelMaps.ItoG.Map;
+ const GLfloat *bMap = ctx->PixelMaps.ItoB.Map;
+ const GLfloat *aMap = ctx->PixelMaps.ItoA.Map;
GLuint i;
for (i=0;i<n;i++) {
rgba[i][RCOMP] = rMap[index[i] & rmask];
_mesa_map_ci8_to_rgba8(const GLcontext *ctx, GLuint n, const GLubyte index[],
GLubyte rgba[][4])
{
- GLuint rmask = ctx->Pixel.MapItoRsize - 1;
- GLuint gmask = ctx->Pixel.MapItoGsize - 1;
- GLuint bmask = ctx->Pixel.MapItoBsize - 1;
- GLuint amask = ctx->Pixel.MapItoAsize - 1;
- const GLubyte *rMap = ctx->Pixel.MapItoR8;
- const GLubyte *gMap = ctx->Pixel.MapItoG8;
- const GLubyte *bMap = ctx->Pixel.MapItoB8;
- const GLubyte *aMap = ctx->Pixel.MapItoA8;
+ GLuint rmask = ctx->PixelMaps.ItoR.Size - 1;
+ GLuint gmask = ctx->PixelMaps.ItoG.Size - 1;
+ GLuint bmask = ctx->PixelMaps.ItoB.Size - 1;
+ GLuint amask = ctx->PixelMaps.ItoA.Size - 1;
+ const GLubyte *rMap = ctx->PixelMaps.ItoR.Map8;
+ const GLubyte *gMap = ctx->PixelMaps.ItoG.Map8;
+ const GLubyte *bMap = ctx->PixelMaps.ItoB.Map8;
+ const GLubyte *aMap = ctx->PixelMaps.ItoA.Map8;
GLuint i;
for (i=0;i<n;i++) {
rgba[i][RCOMP] = rMap[index[i] & rmask];
/***** Initialization *****/
/**********************************************************************/
+static void
+init_pixelmap(struct gl_pixelmap *map)
+{
+ map->Size = 1;
+ map->Map[0] = 0.0;
+ map->Map8[0] = 0;
+}
+
/**
* Initialize the context's PIXEL attribute group.
ctx->Pixel.ZoomY = 1.0;
ctx->Pixel.MapColorFlag = GL_FALSE;
ctx->Pixel.MapStencilFlag = GL_FALSE;
- ctx->Pixel.MapStoSsize = 1;
- ctx->Pixel.MapItoIsize = 1;
- ctx->Pixel.MapItoRsize = 1;
- ctx->Pixel.MapItoGsize = 1;
- ctx->Pixel.MapItoBsize = 1;
- ctx->Pixel.MapItoAsize = 1;
- ctx->Pixel.MapRtoRsize = 1;
- ctx->Pixel.MapGtoGsize = 1;
- ctx->Pixel.MapBtoBsize = 1;
- ctx->Pixel.MapAtoAsize = 1;
- ctx->Pixel.MapStoS[0] = 0;
- ctx->Pixel.MapItoI[0] = 0.0;
- ctx->Pixel.MapItoR[0] = 0.0;
- ctx->Pixel.MapItoG[0] = 0.0;
- ctx->Pixel.MapItoB[0] = 0.0;
- ctx->Pixel.MapItoA[0] = 0.0;
- ctx->Pixel.MapItoR8[0] = 0;
- ctx->Pixel.MapItoG8[0] = 0;
- ctx->Pixel.MapItoB8[0] = 0;
- ctx->Pixel.MapItoA8[0] = 0;
- ctx->Pixel.MapRtoR[0] = 0.0;
- ctx->Pixel.MapGtoG[0] = 0.0;
- ctx->Pixel.MapBtoB[0] = 0.0;
- ctx->Pixel.MapAtoA[0] = 0.0;
+ init_pixelmap(&ctx->PixelMaps.StoS);
+ init_pixelmap(&ctx->PixelMaps.ItoI);
+ init_pixelmap(&ctx->PixelMaps.ItoR);
+ init_pixelmap(&ctx->PixelMaps.ItoG);
+ init_pixelmap(&ctx->PixelMaps.ItoB);
+ init_pixelmap(&ctx->PixelMaps.ItoA);
+ init_pixelmap(&ctx->PixelMaps.RtoR);
+ init_pixelmap(&ctx->PixelMaps.GtoG);
+ init_pixelmap(&ctx->PixelMaps.BtoB);
+ init_pixelmap(&ctx->PixelMaps.AtoA);
ctx->Pixel.HistogramEnabled = GL_FALSE;
ctx->Pixel.MinMaxEnabled = GL_FALSE;
ASSIGN_4V(ctx->Pixel.PostColorMatrixScale, 1.0, 1.0, 1.0, 1.0);