diff options
| author | Nian Wu <nian.wu@intel.com> | 2007-03-15 17:00:22 +0800 | 
|---|---|---|
| committer | Nian Wu <nian.wu@intel.com> | 2007-03-15 17:00:22 +0800 | 
| commit | d63eef4b86af02aea5b26f90de9cf3d46aee398c (patch) | |
| tree | 3923da93925a0c3de4222dbcc45411813e3ff1a5 /src | |
| parent | 805b1cf4821aa807ce0f87d03dc464c0ee01a33a (diff) | |
| parent | 32d196820f5669a03bfd1adde1352b857ffda3b6 (diff) | |
Merge git://proxy01.pd.intel.com:9419/git/mesa/mesa into crestline
Diffstat (limited to 'src')
| -rw-r--r-- | src/mesa/drivers/x11/xm_api.c | 6 | ||||
| -rw-r--r-- | src/mesa/drivers/x11/xm_buffer.c | 9 | ||||
| -rw-r--r-- | src/mesa/main/get.c | 60 | ||||
| -rw-r--r-- | src/mesa/main/get_gen.py | 20 | ||||
| -rw-r--r-- | src/mesa/main/image.c | 12 | ||||
| -rw-r--r-- | src/mesa/main/mtypes.h | 121 | ||||
| -rw-r--r-- | src/mesa/main/pixel.c | 467 | 
7 files changed, 297 insertions, 398 deletions
diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 776928dec4..cbbbd56efd 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -483,6 +483,12 @@ xmesa_free_buffer(XMesaBuffer buffer)           /* mark as delete pending */           fb->DeletePending = GL_TRUE; + +         /* Since the X window for the XMesaBuffer is going away, we don't +          * want to dereference this pointer in the future. +          */ +         b->frontxrb->drawable = 0; +           /* Unreference.  If count = zero we'll really delete the buffer */           _mesa_unreference_framebuffer(&fb); diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index 747971a6c3..73c46b1fe6 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -362,16 +362,13 @@ xmesa_delete_framebuffer(struct gl_framebuffer *fb)  {     XMesaBuffer b = XMESA_BUFFER(fb); -#ifdef XFree86Server -   int client = 0; -   if (b->frontxrb->drawable) -       client = CLIENT_ID(b->frontxrb->drawable->id); -#endif -     if (b->num_alloced > 0) {        /* If no other buffer uses this X colormap then free the colors. */        if (!xmesa_find_buffer(b->display, b->cmap, b)) {  #ifdef XFree86Server +         int client = 0; +         if (b->frontxrb->drawable) +            client = CLIENT_ID(b->frontxrb->drawable->id);           (void)FreeColors(b->cmap, client,                            b->num_alloced, b->alloced_colors, 0);  #else diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 9b2a42f7c1..7601f32069 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -677,34 +677,34 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )           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); @@ -2504,34 +2504,34 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )           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; @@ -4331,34 +4331,34 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )           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); diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index c18216d4a8..76417d2899 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -337,16 +337,16 @@ StateVars = [  	( "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 ), diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index a60f4d3f4d..cdcf49886a 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1129,11 +1129,11 @@ _mesa_apply_ci_transfer_ops(const GLcontext *ctx, GLbitfield transferOps,        shift_and_offset_ci(ctx, n, indexes);     }     if (transferOps & IMAGE_MAP_COLOR_BIT) { -      const GLuint mask = ctx->Pixel.MapItoIsize - 1; +      const GLuint mask = ctx->PixelMaps.ItoI.Size - 1;        GLuint i;        for (i = 0; i < n; i++) {           const GLuint j = indexes[i] & mask; -         indexes[i] = IROUND(ctx->Pixel.MapItoI[j]); +         indexes[i] = IROUND(ctx->PixelMaps.ItoI.Map[j]);        }     }  } @@ -1169,10 +1169,10 @@ _mesa_apply_stencil_transfer_ops(const GLcontext *ctx, GLuint n,        }     }     if (ctx->Pixel.MapStencilFlag) { -      GLuint mask = ctx->Pixel.MapStoSsize - 1; +      GLuint mask = ctx->PixelMaps.StoS.Size - 1;        GLuint i;        for (i = 0; i < n; i++) { -         stencil[i] = ctx->Pixel.MapStoS[ stencil[i] & mask ]; +         stencil[i] = ctx->PixelMaps.StoS.Map[ stencil[i] & mask ];        }     }  } @@ -3691,10 +3691,10 @@ _mesa_unpack_stencil_span( const GLcontext *ctx, GLuint n,           if (ctx->Pixel.MapStencilFlag) {              /* Apply stencil lookup table */ -            GLuint mask = ctx->Pixel.MapStoSsize - 1; +            GLuint mask = ctx->PixelMaps.StoS.Size - 1;              GLuint i;              for (i=0;i<n;i++) { -               indexes[i] = ctx->Pixel.MapStoS[ indexes[i] & mask ]; +               indexes[i] = ctx->PixelMaps.StoS.Map[ indexes[i] & mask ];              }           }        } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 7caa1f8d7f..bced1a64d9 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -965,74 +965,104 @@ struct gl_multisample_attrib  /** + * 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];  }; @@ -2893,6 +2923,7 @@ struct __GLcontextRec     /** \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; diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index 4e47cdba89..ae014a23c4 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -1,8 +1,8 @@  /*   * Mesa 3-D graphics library - * Version:  6.5.2 + * Version:  6.5.3   * - * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved. + * Copyright (C) 1999-2007  Brian Paul   All Rights Reserved.   *   * Permission is hereby granted, free of charge, to any person obtaining a   * copy of this software and associated documentation files (the "Software"), @@ -252,85 +252,76 @@ _mesa_PixelStoref( GLenum pname, GLfloat param )  /*****                         glPixelMap                         *****/  /**********************************************************************/ +/** + * Return pointer to a pixelmap by name. + */ +static struct gl_pixelmap * +get_pixelmap(GLcontext *ctx, GLenum map) +{ +   switch (map) { +   case GL_PIXEL_MAP_I_TO_I: +      return &ctx->PixelMaps.ItoI; +   case GL_PIXEL_MAP_S_TO_S: +      return &ctx->PixelMaps.StoS; +   case GL_PIXEL_MAP_I_TO_R: +      return &ctx->PixelMaps.ItoR; +   case GL_PIXEL_MAP_I_TO_G: +      return &ctx->PixelMaps.ItoG; +   case GL_PIXEL_MAP_I_TO_B: +      return &ctx->PixelMaps.ItoB; +   case GL_PIXEL_MAP_I_TO_A: +      return &ctx->PixelMaps.ItoA; +   case GL_PIXEL_MAP_R_TO_R: +      return &ctx->PixelMaps.RtoR; +   case GL_PIXEL_MAP_G_TO_G: +      return &ctx->PixelMaps.GtoG; +   case GL_PIXEL_MAP_B_TO_B: +      return &ctx->PixelMaps.BtoB; +   case GL_PIXEL_MAP_A_TO_A: +      return &ctx->PixelMaps.AtoA; +   default: +      return NULL; +   } +} +  /**   * Helper routine used by the other _mesa_PixelMap() functions.   */  static void -pixelmap(GLcontext *ctx, GLenum map, GLsizei mapsize, const GLfloat *values) +store_pixelmap(GLcontext *ctx, GLenum map, GLsizei mapsize, +               const GLfloat *values)  {     GLint i; +   struct gl_pixelmap *pm = get_pixelmap(ctx, map); +   if (!pm) { +      _mesa_error(ctx, GL_INVALID_ENUM, "glPixelMap(map)"); +      return; +   } +     switch (map) { -      case GL_PIXEL_MAP_S_TO_S: -         ctx->Pixel.MapStoSsize = mapsize; -         for (i = 0; i < mapsize; i++) { -	    ctx->Pixel.MapStoS[i] = IROUND(values[i]); -	 } -	 break; -      case GL_PIXEL_MAP_I_TO_I: -         ctx->Pixel.MapItoIsize = mapsize; -         for (i = 0; i < mapsize; i++) { -	    ctx->Pixel.MapItoI[i] = values[i]; -	 } -	 break; -      case GL_PIXEL_MAP_I_TO_R: -         ctx->Pixel.MapItoRsize = 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); -	 } -	 break; -      case GL_PIXEL_MAP_I_TO_G: -         ctx->Pixel.MapItoGsize = 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); -	 } -	 break; -      case GL_PIXEL_MAP_I_TO_B: -         ctx->Pixel.MapItoBsize = 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); -	 } -	 break; -      case GL_PIXEL_MAP_I_TO_A: -         ctx->Pixel.MapItoAsize = 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); -	 } -	 break; -      case GL_PIXEL_MAP_R_TO_R: -         ctx->Pixel.MapRtoRsize = mapsize; -         for (i = 0; i < mapsize; i++) { -	    ctx->Pixel.MapRtoR[i] = CLAMP( values[i], 0.0F, 1.0F ); -	 } -	 break; -      case GL_PIXEL_MAP_G_TO_G: -         ctx->Pixel.MapGtoGsize = mapsize; -         for (i = 0; i < mapsize; i++) { -	    ctx->Pixel.MapGtoG[i] = CLAMP( values[i], 0.0F, 1.0F ); -	 } -	 break; -      case GL_PIXEL_MAP_B_TO_B: -         ctx->Pixel.MapBtoBsize = mapsize; -         for (i = 0; i < mapsize; i++) { -	    ctx->Pixel.MapBtoB[i] = CLAMP( values[i], 0.0F, 1.0F ); -	 } -	 break; -      case GL_PIXEL_MAP_A_TO_A: -         ctx->Pixel.MapAtoAsize = mapsize; -         for (i = 0; i < mapsize; i++) { -	    ctx->Pixel.MapAtoA[i] = CLAMP( values[i], 0.0F, 1.0F ); -	 } -	 break; -      default: -         _mesa_error( ctx, GL_INVALID_ENUM, "glPixelMap(map)" ); +   case GL_PIXEL_MAP_S_TO_S: +      /* special case */ +      ctx->PixelMaps.StoS.Size = mapsize; +      for (i = 0; i < mapsize; i++) { +         ctx->PixelMaps.StoS.Map[i] = IROUND(values[i]); +      } +      break; +   case GL_PIXEL_MAP_I_TO_I: +      /* special case */ +      ctx->PixelMaps.ItoI.Size = mapsize; +      for (i = 0; i < mapsize; i++) { +         ctx->PixelMaps.ItoI.Map[i] = values[i]; +      } +      break; +   default: +      /* general case */ +      pm->Size = mapsize; +      for (i = 0; i < mapsize; i++) { +         GLfloat val = CLAMP(values[i], 0.0F, 1.0F); +         pm->Map[i] = val; +         pm->Map8[i] = (GLint) (val * 255.0F); +      }     }  } @@ -385,7 +376,7 @@ _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values )        return;     } -   pixelmap(ctx, map, mapsize, values); +   store_pixelmap(ctx, map, mapsize, values);     if (ctx->Unpack.BufferObj->Name) {        ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_UNPACK_BUFFER_EXT, @@ -394,7 +385,6 @@ _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values )  } -  void GLAPIENTRY  _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values )  { @@ -464,11 +454,10 @@ _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values )                                ctx->Unpack.BufferObj);     } -   pixelmap(ctx, map, mapsize, fvalues); +   store_pixelmap(ctx, map, mapsize, fvalues);  } -  void GLAPIENTRY  _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values )  { @@ -520,7 +509,7 @@ _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values )        return;     } -    /* convert to floats */ +   /* convert to floats */     if (map == GL_PIXEL_MAP_I_TO_I || map == GL_PIXEL_MAP_S_TO_S) {        GLint i;        for (i = 0; i < mapsize; i++) { @@ -539,40 +528,7 @@ _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values )                                ctx->Unpack.BufferObj);     } -   pixelmap(ctx, map, mapsize, fvalues); -} - - -/** - * Return size of the named map. - */ -static GLuint -get_map_size(GLcontext *ctx, GLenum map) -{ -   switch (map) { -      case GL_PIXEL_MAP_I_TO_I: -         return ctx->Pixel.MapItoIsize; -      case GL_PIXEL_MAP_S_TO_S: -         return ctx->Pixel.MapStoSsize; -      case GL_PIXEL_MAP_I_TO_R: -         return ctx->Pixel.MapItoRsize; -      case GL_PIXEL_MAP_I_TO_G: -         return ctx->Pixel.MapItoGsize; -      case GL_PIXEL_MAP_I_TO_B: -         return ctx->Pixel.MapItoBsize; -      case GL_PIXEL_MAP_I_TO_A: -         return ctx->Pixel.MapItoAsize; -      case GL_PIXEL_MAP_R_TO_R: -         return ctx->Pixel.MapRtoRsize; -      case GL_PIXEL_MAP_G_TO_G: -         return ctx->Pixel.MapGtoGsize; -      case GL_PIXEL_MAP_B_TO_B: -         return ctx->Pixel.MapBtoBsize; -      case GL_PIXEL_MAP_A_TO_A: -         return ctx->Pixel.MapAtoAsize; -      default: -         return 0; -   } +   store_pixelmap(ctx, map, mapsize, fvalues);  } @@ -581,9 +537,17 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values )  {     GET_CURRENT_CONTEXT(ctx);     GLuint mapsize, i; +   const struct gl_pixelmap *pm; +     ASSERT_OUTSIDE_BEGIN_END(ctx); -   mapsize = get_map_size(ctx, map); +   pm = get_pixelmap(ctx, map); +   if (!pm) { +      _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapfv(map)"); +      return; +   } + +   mapsize = pm->Size;     if (ctx->Pack.BufferObj->Name) {        /* pack pixelmap into PBO */ @@ -613,41 +577,14 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values )        return;     } -   switch (map) { -      case GL_PIXEL_MAP_I_TO_I: -         MEMCPY(values, ctx->Pixel.MapItoI, mapsize * sizeof(GLfloat)); -	 break; -      case GL_PIXEL_MAP_S_TO_S: -         for (i = 0; i < mapsize; i++) { -	    values[i] = (GLfloat) ctx->Pixel.MapStoS[i]; -	 } -	 break; -      case GL_PIXEL_MAP_I_TO_R: -         MEMCPY(values, ctx->Pixel.MapItoR, mapsize * sizeof(GLfloat)); -	 break; -      case GL_PIXEL_MAP_I_TO_G: -         MEMCPY(values, ctx->Pixel.MapItoG, mapsize * sizeof(GLfloat)); -	 break; -      case GL_PIXEL_MAP_I_TO_B: -         MEMCPY(values, ctx->Pixel.MapItoB, mapsize * sizeof(GLfloat)); -	 break; -      case GL_PIXEL_MAP_I_TO_A: -         MEMCPY(values, ctx->Pixel.MapItoA, mapsize * sizeof(GLfloat)); -	 break; -      case GL_PIXEL_MAP_R_TO_R: -         MEMCPY(values, ctx->Pixel.MapRtoR, mapsize * sizeof(GLfloat)); -	 break; -      case GL_PIXEL_MAP_G_TO_G: -         MEMCPY(values, ctx->Pixel.MapGtoG, mapsize * sizeof(GLfloat)); -	 break; -      case GL_PIXEL_MAP_B_TO_B: -         MEMCPY(values, ctx->Pixel.MapBtoB, mapsize * sizeof(GLfloat)); -	 break; -      case GL_PIXEL_MAP_A_TO_A: -         MEMCPY(values, ctx->Pixel.MapAtoA, mapsize * sizeof(GLfloat)); -	 break; -      default: -         _mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" ); +   if (map == GL_PIXEL_MAP_S_TO_S) { +      /* special case */ +      for (i = 0; i < mapsize; i++) { +         values[i] = (GLfloat) ctx->PixelMaps.StoS.Map[i]; +      } +   } +   else { +      MEMCPY(values, pm->Map, mapsize * sizeof(GLfloat));     }     if (ctx->Pack.BufferObj->Name) { @@ -662,9 +599,16 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values )  {     GET_CURRENT_CONTEXT(ctx);     GLint mapsize, i; +   const struct gl_pixelmap *pm; +     ASSERT_OUTSIDE_BEGIN_END(ctx); -   mapsize = get_map_size(ctx, map); +   pm = get_pixelmap(ctx, map); +   if (!pm) { +      _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapuiv(map)"); +      return; +   } +   mapsize = pm->Size;     if (ctx->Pack.BufferObj->Name) {        /* pack pixelmap into PBO */ @@ -694,57 +638,14 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values )        return;     } -   switch (map) { -      case GL_PIXEL_MAP_I_TO_I: -	 for (i = 0; i < mapsize; i++) { -	    values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoI[i] ); -	 } -	 break; -      case GL_PIXEL_MAP_S_TO_S: -         MEMCPY(values, ctx->Pixel.MapStoS, 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] ); -	 } -	 break; -      case GL_PIXEL_MAP_I_TO_G: -	 for (i = 0; i < mapsize; i++) { -	    values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoG[i] ); -	 } -	 break; -      case GL_PIXEL_MAP_I_TO_B: -	 for (i = 0; i < mapsize; i++) { -	    values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoB[i] ); -	 } -	 break; -      case GL_PIXEL_MAP_I_TO_A: -	 for (i = 0; i < mapsize; i++) { -	    values[i] = FLOAT_TO_UINT( ctx->Pixel.MapItoA[i] ); -	 } -	 break; -      case GL_PIXEL_MAP_R_TO_R: -	 for (i = 0; i < mapsize; i++) { -	    values[i] = FLOAT_TO_UINT( ctx->Pixel.MapRtoR[i] ); -	 } -	 break; -      case GL_PIXEL_MAP_G_TO_G: -	 for (i = 0; i < mapsize; i++) { -	    values[i] = FLOAT_TO_UINT( ctx->Pixel.MapGtoG[i] ); -	 } -	 break; -      case GL_PIXEL_MAP_B_TO_B: -	 for (i = 0; i < mapsize; i++) { -	    values[i] = FLOAT_TO_UINT( ctx->Pixel.MapBtoB[i] ); -	 } -	 break; -      case GL_PIXEL_MAP_A_TO_A: -	 for (i = 0; i < mapsize; i++) { -	    values[i] = FLOAT_TO_UINT( ctx->Pixel.MapAtoA[i] ); -	 } -	 break; -      default: -         _mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" ); +   if (map == GL_PIXEL_MAP_S_TO_S) { +      /* special case */ +      MEMCPY(values, ctx->PixelMaps.StoS.Map, mapsize * sizeof(GLint)); +   } +   else { +      for (i = 0; i < mapsize; i++) { +         values[i] = FLOAT_TO_UINT( pm->Map[i] ); +      }     }     if (ctx->Pack.BufferObj->Name) { @@ -759,9 +660,16 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values )  {     GET_CURRENT_CONTEXT(ctx);     GLint mapsize, i; +   const struct gl_pixelmap *pm; +     ASSERT_OUTSIDE_BEGIN_END(ctx); -   mapsize = get_map_size(ctx, map); +   pm = get_pixelmap(ctx, map); +   if (!pm) { +      _mesa_error(ctx, GL_INVALID_ENUM, "glGetPixelMapusv(map)"); +      return; +   } +   mapsize = pm ? pm->Size : 0;     if (ctx->Pack.BufferObj->Name) {        /* pack pixelmap into PBO */ @@ -793,58 +701,21 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values )     }     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); -	 } -	 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); -	 } -	 break; -      case GL_PIXEL_MAP_I_TO_R: -	 for (i = 0; i < mapsize; i++) { -	    CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoR[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] ); -	 } -	 break; -      case GL_PIXEL_MAP_I_TO_B: -	 for (i = 0; i < mapsize; i++) { -	    CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapItoB[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] ); -	 } -	 break; -      case GL_PIXEL_MAP_R_TO_R: -	 for (i = 0; i < mapsize; i++) { -	    CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapRtoR[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] ); -	 } -	 break; -      case GL_PIXEL_MAP_B_TO_B: -	 for (i = 0; i < mapsize; i++) { -	    CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapBtoB[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] ); -	 } -	 break; -      default: -         _mesa_error( ctx, GL_INVALID_ENUM, "glGetPixelMapfv" ); +   /* special cases */ +   case GL_PIXEL_MAP_I_TO_I: +      for (i = 0; i < mapsize; i++) { +         values[i] = (GLushort) CLAMP(ctx->PixelMaps.ItoI.Map[i], 0.0, 65535.); +      } +      break; +   case GL_PIXEL_MAP_S_TO_S: +      for (i = 0; i < mapsize; i++) { +         values[i] = (GLushort) CLAMP(ctx->PixelMaps.StoS.Map[i], 0.0, 65535.); +      } +      break; +   default: +      for (i = 0; i < mapsize; i++) { +         CLAMPED_FLOAT_TO_USHORT(values[i], pm->Map[i] ); +      }     }     if (ctx->Pack.BufferObj->Name) { @@ -1113,14 +984,14 @@ _mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4],  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); @@ -1413,14 +1284,14 @@ void  _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]; @@ -1438,14 +1309,14 @@ void  _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]; @@ -1558,6 +1429,14 @@ void _mesa_update_pixel( GLcontext *ctx, GLuint new_state )  /*****                      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. @@ -1584,30 +1463,16 @@ _mesa_init_pixel( GLcontext *ctx )     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);  | 
