* 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"),
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:
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++) {
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));
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:
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]);
}
}
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;