summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/image.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2001-07-14 17:53:04 +0000
committerBrian Paul <[email protected]>2001-07-14 17:53:04 +0000
commit96385fa15569e25cd0977e678c0ff3bdab6ef316 (patch)
tree64906f361d7fca6abb6cdd96b50439ccbce945d6 /src/mesa/main/image.c
parent274fc30d31803a1c73d7d05e041e71e6b683229e (diff)
more work on float colors (still not finished)
Diffstat (limited to 'src/mesa/main/image.c')
-rw-r--r--src/mesa/main/image.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 376234285b0..d99d908509f 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1,4 +1,4 @@
-/* $Id: image.c,v 1.62 2001/06/13 14:55:25 brianp Exp $ */
+/* $Id: image.c,v 1.63 2001/07/14 17:53:04 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -790,6 +790,11 @@ _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
+/*
+ * Used to pack an array [][4] of RGBA GLchan colors as specified
+ * by the dstFormat, dstType and dstPacking. Used by glReadPixels,
+ * glGetConvolutionFilter(), etc.
+ */
void
_mesa_pack_float_rgba_span( GLcontext *ctx,
GLuint n, CONST GLfloat rgbaIn[][4],
@@ -886,7 +891,11 @@ _mesa_pack_float_rgba_span( GLcontext *ctx,
if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) {
for (i = 0; i < n; i++) {
GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
+#if CHAN_TYPE == GL_FLOAT
+ luminance[i] = sum;
+#else
luminance[i] = CLAMP(sum, 0.0F, 1.0F);
+#endif
}
}
@@ -2666,6 +2675,7 @@ _mesa_unpack_chan_color_span( GLcontext *ctx,
}
/* clamp to [0,1] */
+#if CHAN_TYPE != GL_FLOAT
{
GLuint i;
for (i = 0; i < n; i++) {
@@ -2675,6 +2685,7 @@ _mesa_unpack_chan_color_span( GLcontext *ctx,
rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F);
}
}
+#endif
/* Now determine which color channels we need to produce.
* And determine the dest index (offset) within each color tuple.
@@ -2941,6 +2952,7 @@ _mesa_unpack_float_color_span( GLcontext *ctx,
}
/* clamp to [0,1] */
+#if CHAN_TYPE != GL_FLOAT
if (clamp) {
GLuint i;
for (i = 0; i < n; i++) {
@@ -2950,6 +2962,7 @@ _mesa_unpack_float_color_span( GLcontext *ctx,
rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F);
}
}
+#endif
/* Now determine which color channels we need to produce.
* And determine the dest index (offset) within each color tuple.