i965: take the secondary color into account when drawing
authorXiang, Haihao <haihao.xiang@intel.com>
Tue, 11 Sep 2007 08:57:07 +0000 (16:57 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Tue, 11 Sep 2007 08:57:07 +0000 (16:57 +0800)
bitmap. fix#10688

src/mesa/drivers/dri/i965/intel_pixel_bitmap.c

index 23f381fe9175b118d369a34bc3bcd82e20b7864a..79c1fee9c07f013c9010cf6a7b1e798aa2a83abc 100644 (file)
@@ -168,7 +168,8 @@ do_blit_bitmap( GLcontext *ctx,
 {
    struct intel_context *intel = intel_context(ctx);
    struct intel_region *dst = intel_drawbuf_region(intel);
-   
+   GLfloat tmpColor[4];
+
    union {
       GLuint ui;
       GLubyte ub[4];
@@ -183,10 +184,16 @@ do_blit_bitmap( GLcontext *ctx,
         return GL_TRUE;        /* even though this is an error, we're done */
    }
 
-   UNCLAMPED_FLOAT_TO_CHAN(color.ub[0], ctx->Current.RasterColor[2]);
-   UNCLAMPED_FLOAT_TO_CHAN(color.ub[1], ctx->Current.RasterColor[1]);
-   UNCLAMPED_FLOAT_TO_CHAN(color.ub[2], ctx->Current.RasterColor[0]);
-   UNCLAMPED_FLOAT_TO_CHAN(color.ub[3], ctx->Current.RasterColor[3]);
+   COPY_4V(tmpColor, ctx->Current.RasterColor);
+
+   if (NEED_SECONDARY_COLOR(ctx)) {
+       ADD_3V(tmpColor, tmpColor, ctx->Current.RasterSecondaryColor);
+   }
+
+   UNCLAMPED_FLOAT_TO_CHAN(color.ub[0], tmpColor[2]);
+   UNCLAMPED_FLOAT_TO_CHAN(color.ub[1], tmpColor[1]);
+   UNCLAMPED_FLOAT_TO_CHAN(color.ub[2], tmpColor[0]);
+   UNCLAMPED_FLOAT_TO_CHAN(color.ub[3], tmpColor[3]);
 
    /* Does zoom apply to bitmaps?
     */