summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/pixel.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-11-09 16:30:50 +0000
committerBrian Paul <[email protected]>2005-11-09 16:30:50 +0000
commita8717180d9805de3bf1ca30eff5487575fcfb384 (patch)
tree2d05b0de5082c397acd208587c7c766df05ef557 /src/mesa/main/pixel.c
parentcfca72cfb19367d824a3254b40566b3fc01723ea (diff)
Bug 4996.
Replace use of FLOAT_TO_USHORT with either CLAMPED_FLOAT_TO_USHORT or UNCLAMPED_FLOAT_TO_USHORT. Same should be done for UBYTE, UINT, etc.
Diffstat (limited to 'src/mesa/main/pixel.c')
-rw-r--r--src/mesa/main/pixel.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c
index b6b2fc516a0..14eca650b1f 100644
--- a/src/mesa/main/pixel.c
+++ b/src/mesa/main/pixel.c
@@ -795,52 +795,52 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values )
switch (map) {
case GL_PIXEL_MAP_I_TO_I:
for (i = 0; i < mapsize; i++) {
- values[i] = FLOAT_TO_USHORT(ctx->Pixel.MapItoI[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) ctx->Pixel.MapStoS[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++) {
- values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoR[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++) {
- values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoG[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++) {
- values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoB[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++) {
- values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapItoA[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++) {
- values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapRtoR[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++) {
- values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapGtoG[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++) {
- values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapBtoB[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++) {
- values[i] = FLOAT_TO_USHORT( ctx->Pixel.MapAtoA[i] );
+ CLAMPED_FLOAT_TO_USHORT(values[i] , ctx->Pixel.MapAtoA[i] );
}
break;
default: