diff options
author | Brian Paul <[email protected]> | 2000-05-24 14:03:04 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2000-05-24 14:03:04 +0000 |
commit | 98b88b3e70c079ce2b98221f7ef155af6417daf8 (patch) | |
tree | cd4a5da975b2dc3df9f4a28d8fbadecf857ef2c0 | |
parent | 478beace4758e35a61b5d5fb1aa5caed31376f18 (diff) |
replaced _mesa_base_tex_format() with base_colortab_format()
-rw-r--r-- | src/mesa/main/colortab.c | 64 |
1 files changed, 61 insertions, 3 deletions
diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index bab5e959d58..143d9e99d40 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -1,4 +1,4 @@ -/* $Id: colortab.c,v 1.17 2000/05/10 14:39:53 brianp Exp $ */ +/* $Id: colortab.c,v 1.18 2000/05/24 14:03:04 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -36,11 +36,69 @@ #include "mem.h" #include "mmath.h" #include "span.h" -#include "teximage.h" #endif +/* + * Given an internalFormat token passed to glColorTable, + * return the corresponding base format. + * Return -1 if invalid token. + */ +static GLint +base_colortab_format( GLenum format ) +{ + switch (format) { + case GL_ALPHA: + case GL_ALPHA4: + case GL_ALPHA8: + case GL_ALPHA12: + case GL_ALPHA16: + return GL_ALPHA; + case GL_LUMINANCE: + case GL_LUMINANCE4: + case GL_LUMINANCE8: + case GL_LUMINANCE12: + case GL_LUMINANCE16: + return GL_LUMINANCE; + case GL_LUMINANCE_ALPHA: + case GL_LUMINANCE4_ALPHA4: + case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE8_ALPHA8: + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: + return GL_LUMINANCE_ALPHA; + case GL_INTENSITY: + case GL_INTENSITY4: + case GL_INTENSITY8: + case GL_INTENSITY12: + case GL_INTENSITY16: + return GL_INTENSITY; + case GL_RGB: + case GL_R3_G3_B2: + case GL_RGB4: + case GL_RGB5: + case GL_RGB8: + case GL_RGB10: + case GL_RGB12: + case GL_RGB16: + return GL_RGB; + case GL_RGBA: + case GL_RGBA2: + case GL_RGBA4: + case GL_RGB5_A1: + case GL_RGBA8: + case GL_RGB10_A2: + case GL_RGBA12: + case GL_RGBA16: + return GL_RGBA; + default: + return -1; /* error */ + } +} + + void _mesa_init_colortable( struct gl_color_table *p ) { @@ -248,7 +306,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, return; } - baseFormat = _mesa_base_tex_format(internalFormat); + baseFormat = base_colortab_format(internalFormat); if (baseFormat < 0 || baseFormat == GL_COLOR_INDEX) { gl_error(ctx, GL_INVALID_ENUM, "glColorTable(internalFormat)"); return; |