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];
}
}
}
#define IMAGE_HISTOGRAM_BIT 0x200
#define IMAGE_MIN_MAX_BIT 0x400
#define IMAGE_CLAMP_BIT 0x800 /* extra */
-#define IMAGE_RED_TO_LUMINANCE 0x1000
/** Pixel Transfer ops up to convolution */
}
_mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba,
format, type, dest,
- &ctx->Pack, IMAGE_RED_TO_LUMINANCE);
+ &ctx->Pack, 0x0 /*image xfer ops*/);
} /* format */
} /* row */
} /* img */