summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2005-08-10 17:04:03 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2005-08-10 17:04:03 +0000
commit8c9cd63c89923e7c3cb751a1f24038c199d226d8 (patch)
treeb69f2f3e0600abf4a5b57ba357527ddad1645761 /src/mesa
parent63c9ebeaff0f238368b59cbe1cb6dc9bbf7cba7d (diff)
the PIXEL_MAP_I_TO_I table should be GLfloat, not GLint
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/mtypes.h2
-rw-r--r--src/mesa/main/pixel.c25
2 files changed, 14 insertions, 13 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 956fc9971e..a91c64e2fe 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -926,7 +926,7 @@ struct gl_pixel_attrib
GLint MapBtoBsize;
GLint MapAtoAsize;
GLint MapStoS[MAX_PIXEL_MAP_TABLE]; /**< Pixel map tables */
- GLint MapItoI[MAX_PIXEL_MAP_TABLE];
+ GLfloat MapItoI[MAX_PIXEL_MAP_TABLE];
GLfloat MapItoR[MAX_PIXEL_MAP_TABLE];
GLfloat MapItoG[MAX_PIXEL_MAP_TABLE];
GLfloat MapItoB[MAX_PIXEL_MAP_TABLE];
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index 6497813a82..e8912c7002 100644
--- a/src/mesa/main/pixel.c
+++ b/src/mesa/main/pixel.c
@@ -2,7 +2,7 @@
* Mesa 3-D graphics library
* Version: 6.3
*
- * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2005 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"),
@@ -264,13 +264,13 @@ pixelmap(GLcontext *ctx, GLenum map, GLsizei mapsize, const GLfloat *values)
case GL_PIXEL_MAP_S_TO_S:
ctx->Pixel.MapStoSsize = mapsize;
for (i = 0; i < mapsize; i++) {
- ctx->Pixel.MapStoS[i] = (GLint) values[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] = (GLint) values[i];
+ ctx->Pixel.MapItoI[i] = values[i];
}
break;
case GL_PIXEL_MAP_I_TO_R:
@@ -615,9 +615,7 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values )
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
- for (i = 0; i < mapsize; i++) {
- values[i] = (GLfloat) ctx->Pixel.MapItoI[i];
- }
+ MEMCPY(values, ctx->Pixel.MapItoI, mapsize * sizeof(GLfloat));
break;
case GL_PIXEL_MAP_S_TO_S:
for (i = 0; i < mapsize; i++) {
@@ -698,7 +696,9 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values )
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
- MEMCPY(values, ctx->Pixel.MapItoI, mapsize * sizeof(GLint));
+ 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));
@@ -795,7 +795,7 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values )
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
for (i = 0; i < mapsize; i++) {
- values[i] = (GLushort) ctx->Pixel.MapItoI[i];
+ values[i] = FLOAT_TO_USHORT(ctx->Pixel.MapItoI[i]);
}
break;
case GL_PIXEL_MAP_S_TO_S:
@@ -1680,10 +1680,11 @@ _mesa_shift_and_offset_ci( const GLcontext *ctx, GLuint n, GLuint indexes[] )
void
_mesa_map_ci( const GLcontext *ctx, GLuint n, GLuint index[] )
{
- GLuint mask = ctx->Pixel.MapItoIsize - 1;
+ const GLuint mask = ctx->Pixel.MapItoIsize - 1;
GLuint i;
- for (i=0;i<n;i++) {
- index[i] = ctx->Pixel.MapItoI[ index[i] & mask ];
+ for (i = 0; i < n; i++) {
+ const GLuint j = index[i] & mask;
+ index[i] = IROUND(ctx->Pixel.MapItoI[j]);
}
}
@@ -2009,7 +2010,7 @@ _mesa_init_pixel( GLcontext *ctx )
ctx->Pixel.MapBtoBsize = 1;
ctx->Pixel.MapAtoAsize = 1;
ctx->Pixel.MapStoS[0] = 0;
- ctx->Pixel.MapItoI[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;