summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/image.c
diff options
context:
space:
mode:
authorNian Wu <[email protected]>2007-03-21 17:00:32 +0800
committerNian Wu <[email protected]>2007-03-21 17:00:32 +0800
commit8ba06464ac8de726390899e790e15b40df08001e (patch)
tree8427cef9e66f329166b7cf366e09fa99e060f896 /src/mesa/main/image.c
parent76444d042c841aa4e060db46c0668c17da97a1f6 (diff)
parent4b5d6c0435acd84c13e0db3785758fed0bc48fe1 (diff)
Merge git://proxy01.pd.intel.com:9419/git/mesa/mesa into crestline
Diffstat (limited to 'src/mesa/main/image.c')
-rw-r--r--src/mesa/main/image.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index 44729b74196..394a7c65cdf 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -1211,24 +1211,15 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4],
if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) {
/* compute luminance values */
- if (transferOps & IMAGE_RED_TO_LUMINANCE) {
- /* Luminance = Red (glGetTexImage) */
+ if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) {
for (i = 0; i < n; i++) {
- luminance[i] = rgba[i][RCOMP];
+ GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
+ luminance[i] = CLAMP(sum, 0.0F, 1.0F);
}
}
else {
- /* Luminance = Red + Green + Blue (glReadPixels) */
- if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) {
- for (i = 0; i < n; i++) {
- GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
- luminance[i] = CLAMP(sum, 0.0F, 1.0F);
- }
- }
- else {
- for (i = 0; i < n; i++) {
- luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
- }
+ for (i = 0; i < n; i++) {
+ luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP];
}
}
}