replace color table FloatTable boolean with Type enum
[mesa.git] / src / mesa / main / pixel.c
index ce4be7eadc86a86e226a9cf7e88e8a567c6db64e..f211af91703b0a605cf2cfda2686d90f7d80a8c6 100644 (file)
@@ -1,9 +1,9 @@
 
 /*
  * Mesa 3-D graphics library
- * Version:  4.1
+ * Version:  5.1
  *
- * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2003  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"),
@@ -38,7 +38,7 @@
 
 
 
-void
+void GLAPIENTRY
 _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -59,7 +59,7 @@ _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor )
 /**********************************************************************/
 
 
-void
+void GLAPIENTRY
 _mesa_PixelStorei( GLenum pname, GLint param )
 {
    /* NOTE: this call can't be compiled into the display list */
@@ -240,7 +240,7 @@ _mesa_PixelStorei( GLenum pname, GLint param )
 }
 
 
-void
+void GLAPIENTRY
 _mesa_PixelStoref( GLenum pname, GLfloat param )
 {
    _mesa_PixelStorei( pname, (GLint) param );
@@ -254,8 +254,8 @@ _mesa_PixelStoref( GLenum pname, GLfloat param )
 
 
 
-void
-_mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values )
+void GLAPIENTRY
+_mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values )
 {
    GLint i;
    GET_CURRENT_CONTEXT(ctx);
@@ -352,8 +352,8 @@ _mesa_PixelMapfv( GLenum map, GLint mapsize, const GLfloat *values )
 
 
 
-void
-_mesa_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values )
+void GLAPIENTRY
+_mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values )
 {
    const GLint n = MIN2(mapsize, MAX_PIXEL_MAP_TABLE);
    GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
@@ -373,8 +373,8 @@ _mesa_PixelMapuiv(GLenum map, GLint mapsize, const GLuint *values )
 
 
 
-void
-_mesa_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values )
+void GLAPIENTRY
+_mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values )
 {
    const GLint n = MIN2(mapsize, MAX_PIXEL_MAP_TABLE);
    GLfloat fvalues[MAX_PIXEL_MAP_TABLE];
@@ -394,7 +394,7 @@ _mesa_PixelMapusv(GLenum map, GLint mapsize, const GLushort *values )
 
 
 
-void
+void GLAPIENTRY
 _mesa_GetPixelMapfv( GLenum map, GLfloat *values )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -442,7 +442,7 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values )
 }
 
 
-void
+void GLAPIENTRY
 _mesa_GetPixelMapuiv( GLenum map, GLuint *values )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -502,7 +502,7 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values )
 }
 
 
-void
+void GLAPIENTRY
 _mesa_GetPixelMapusv( GLenum map, GLushort *values )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -576,7 +576,7 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values )
  * Implements glPixelTransfer[fi] whether called immediately or from a
  * display list.
  */
-void
+void GLAPIENTRY
 _mesa_PixelTransferf( GLenum pname, GLfloat param )
 {
    GET_CURRENT_CONTEXT(ctx);
@@ -770,7 +770,7 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param )
 }
 
 
-void
+void GLAPIENTRY
 _mesa_PixelTransferi( GLenum pname, GLint param )
 {
    _mesa_PixelTransferf( pname, (GLfloat) param );
@@ -877,6 +877,7 @@ _mesa_transform_rgba(const GLcontext *ctx, GLuint n, GLfloat rgba[][4])
 
 /*
  * Apply a color table lookup to an array of colors.
+ * XXX merge with _swrast_texture_table_lookup in s_texture.c
  */
 void
 _mesa_lookup_rgba(const struct gl_color_table *table,
@@ -888,7 +889,7 @@ _mesa_lookup_rgba(const struct gl_color_table *table,
    switch (table->Format) {
       case GL_INTENSITY:
          /* replace RGBA with I */
-         if (!table->FloatTable) {
+         if (table->Type != GL_FLOAT) {
             const GLint max = table->Size - 1;
             const GLfloat scale = (GLfloat) max;
             const GLchan *lut = (const GLchan *) table->Table;
@@ -915,7 +916,7 @@ _mesa_lookup_rgba(const struct gl_color_table *table,
          break;
       case GL_LUMINANCE:
          /* replace RGB with L */
-         if (!table->FloatTable) {
+         if (table->Type != GL_FLOAT) {
             const GLint max = table->Size - 1;
             const GLfloat scale = (GLfloat) max;
             const GLchan *lut = (const GLchan *) table->Table;
@@ -940,7 +941,7 @@ _mesa_lookup_rgba(const struct gl_color_table *table,
          break;
       case GL_ALPHA:
          /* replace A with A */
-         if (!table->FloatTable) {
+         if (table->Type != GL_FLOAT) {
             const GLint max = table->Size - 1;
             const GLfloat scale = (GLfloat) max;
             const GLchan *lut = (const GLchan *) table->Table;
@@ -963,7 +964,7 @@ _mesa_lookup_rgba(const struct gl_color_table *table,
          break;
       case GL_LUMINANCE_ALPHA:
          /* replace RGBA with LLLA */
-         if (!table->FloatTable) {
+         if (table->Type != GL_FLOAT) {
             const GLint max = table->Size - 1;
             const GLfloat scale = (GLfloat) max;
             const GLchan *lut = (const GLchan *) table->Table;
@@ -1000,7 +1001,7 @@ _mesa_lookup_rgba(const struct gl_color_table *table,
          break;
       case GL_RGB:
          /* replace RGB with RGB */
-         if (!table->FloatTable) {
+         if (table->Type != GL_FLOAT) {
             const GLint max = table->Size - 1;
             const GLfloat scale = (GLfloat) max;
             const GLchan *lut = (const GLchan *) table->Table;
@@ -1037,7 +1038,7 @@ _mesa_lookup_rgba(const struct gl_color_table *table,
          break;
       case GL_RGBA:
          /* replace RGBA with RGBA */
-         if (!table->FloatTable) {
+         if (table->Type != GL_FLOAT) {
             const GLint max = table->Size - 1;
             const GLfloat scale = (GLfloat) max;
             const GLchan *lut = (const GLchan *) table->Table;
@@ -1489,6 +1490,9 @@ void _mesa_init_pixel( GLcontext * ctx )
    }
    ASSIGN_4V(ctx->Pixel.PostConvolutionScale, 1.0, 1.0, 1.0, 1.0);
    ASSIGN_4V(ctx->Pixel.PostConvolutionBias, 0.0, 0.0, 0.0, 0.0);
+   /* GL_SGI_texture_color_table */
+   ASSIGN_4V(ctx->Pixel.TextureColorTableScale, 1.0, 1.0, 1.0, 1.0);
+   ASSIGN_4V(ctx->Pixel.TextureColorTableBias, 0.0, 0.0, 0.0, 0.0);
 
    /* Pixel transfer */
    ctx->Pack.Alignment = 4;
@@ -1499,6 +1503,8 @@ void _mesa_init_pixel( GLcontext * ctx )
    ctx->Pack.SkipImages = 0;
    ctx->Pack.SwapBytes = GL_FALSE;
    ctx->Pack.LsbFirst = GL_FALSE;
+   ctx->Pack.ClientStorage = GL_FALSE;
+   ctx->Pack.Invert = GL_FALSE;
    ctx->Unpack.Alignment = 4;
    ctx->Unpack.RowLength = 0;
    ctx->Unpack.ImageHeight = 0;
@@ -1507,6 +1513,8 @@ void _mesa_init_pixel( GLcontext * ctx )
    ctx->Unpack.SkipImages = 0;
    ctx->Unpack.SwapBytes = GL_FALSE;
    ctx->Unpack.LsbFirst = GL_FALSE;
+   ctx->Unpack.ClientStorage = GL_FALSE;
+   ctx->Unpack.Invert = GL_FALSE;
 
    if (ctx->Visual.doubleBufferMode) {
       ctx->Pixel.ReadBuffer = GL_BACK;