From ebe4c893f8c0e80fe474743574a377d460b5f3e8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 16 Nov 2006 14:44:23 +0000 Subject: [PATCH] fix glDrawPixels(GL_COLOR_INDEX, GL_BITMAP) bug 9044 --- docs/relnotes-6.5.2.html | 1 + src/mesa/main/image.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/relnotes-6.5.2.html b/docs/relnotes-6.5.2.html index 1ba936413a8..f582c3c593b 100644 --- a/docs/relnotes-6.5.2.html +++ b/docs/relnotes-6.5.2.html @@ -66,6 +66,7 @@ copy texturing).
  • Fixed some fragment program bugs in Intel i915 DRI driver
  • Fixed glGetVertexAttribfvARB bug 8883
  • Implemented glGetUniform[fi]vARB() functions +
  • Fixed glDrawPixels(GL_COLOR_INDEX, GL_BITMAP) segfault (bug 9044) diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index 695aab5227f..6ff4089f0ea 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1168,7 +1168,7 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4], const GLint comps = _mesa_components_in_format(dstFormat); GLuint i; - if (dstType != GL_FLOAT) { + if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) { /* need to clamp to [0, 1] */ transferOps |= IMAGE_CLAMP_BIT; } @@ -1182,7 +1182,7 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4], if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) { /* compute luminance values */ - if (ctx->Color.ClampReadColor == GL_TRUE || dstType != GL_FLOAT) { + 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); @@ -4173,7 +4173,7 @@ _mesa_unpack_image( GLuint dimensions, if (width <= 0 || height <= 0 || depth <= 0) return NULL; /* generate error later */ - if (format == GL_BITMAP) { + if (type == GL_BITMAP) { bytesPerRow = (width + 7) >> 3; flipBytes = !unpack->LsbFirst; swap2 = swap4 = GL_FALSE; -- 2.30.2