Fix color sum bug 10688.
authorBrian <brian@yutani.localnet.net>
Sat, 21 Apr 2007 21:58:37 +0000 (15:58 -0600)
committerBrian <brian@yutani.localnet.net>
Sat, 21 Apr 2007 21:58:37 +0000 (15:58 -0600)
src/mesa/swrast/s_bitmap.c
src/mesa/swrast/s_copypix.c
src/mesa/swrast/s_drawpix.c
src/mesa/swrast/s_span.c

index 59c42e524f0b112e665de8cb16b0314aae7be544..4c237052457855e25662e4e44f80228da0799c59 100644 (file)
@@ -85,8 +85,7 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
    INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_XY);
 
    _swrast_span_default_color(ctx, &span);
-   if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
-      _swrast_span_default_secondary_color(ctx, &span);
+   _swrast_span_default_secondary_color(ctx, &span);
    if (ctx->Depth.Test)
       _swrast_span_default_z(ctx, &span);
    if (swrast->_FogEnabled)
index dbbfc58c6fdfa3a57ebdb2267d4524907914e880..012839cb88aa1ac9714e2f052bf97f677717dd96 100644 (file)
@@ -109,8 +109,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
       _swrast_span_default_z(ctx, &span);
    if (swrast->_FogEnabled)
       _swrast_span_default_fog(ctx, &span);
-   if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
-      _swrast_span_default_secondary_color(ctx, &span);
+   _swrast_span_default_secondary_color(ctx, &span);
 
    /* allocate space for GLfloat image */
    tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
@@ -245,8 +244,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
       _swrast_span_default_z(ctx, &span);
    if (swrast->_FogEnabled)
       _swrast_span_default_fog(ctx, &span);
-   if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
-      _swrast_span_default_secondary_color(ctx, &span);
+   _swrast_span_default_secondary_color(ctx, &span);
 
    if (overlapping) {
       tmpImage = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat) * 4);
@@ -492,8 +490,7 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
    }
 
    _swrast_span_default_color(ctx, &span);
-   if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
-      _swrast_span_default_secondary_color(ctx, &span);
+   _swrast_span_default_secondary_color(ctx, &span);
    if (swrast->_FogEnabled)
       _swrast_span_default_fog(ctx, &span);
 
index 70b57b917c9f704bb48b69f9cc026effff7f5889..cd5b7bc2935be6fe2f8f031a73aa3a230382ef30 100644 (file)
@@ -71,8 +71,7 @@ fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y,
    }
 
    INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
-   if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
-      _swrast_span_default_secondary_color(ctx, &span);
+   _swrast_span_default_secondary_color(ctx, &span);
    if (ctx->Depth.Test)
       _swrast_span_default_z(ctx, &span);
    if (swrast->_FogEnabled)
@@ -443,8 +442,7 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
    INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z);
 
    _swrast_span_default_color(ctx, &span);
-   if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
-      _swrast_span_default_secondary_color(ctx, &span);
+   _swrast_span_default_secondary_color(ctx, &span);
    if (swrast->_FogEnabled)
       _swrast_span_default_fog(ctx, &span);
    if (ctx->Texture._EnabledCoordUnits)
@@ -565,8 +563,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
       return;
 
    INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
-   if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
-      _swrast_span_default_secondary_color(ctx, &span);
+   _swrast_span_default_secondary_color(ctx, &span);
    if (ctx->Depth.Test)
       _swrast_span_default_z(ctx, &span);
    if (swrast->_FogEnabled)
index f3b7998618662ba5827f362b239fcca0f1db4769..0b17791567aed28acb0ad8069e9be51eac6774c1 100644 (file)
@@ -130,10 +130,15 @@ _swrast_span_default_color( GLcontext *ctx, SWspan *span )
 }
 
 
+/**
+ * Set the span's secondary color info to the current raster position's
+ * secondary color, when needed (lighting enabled or colorsum enabled).
+ */
 void
 _swrast_span_default_secondary_color(GLcontext *ctx, SWspan *span)
 {
-   if (ctx->Visual.rgbMode) {
+   if (ctx->Visual.rgbMode && (ctx->Light.Enabled || ctx->Fog.ColorSumEnabled))
+   {
       GLchan r, g, b, a;
       UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterSecondaryColor[0]);
       UNCLAMPED_FLOAT_TO_CHAN(g, ctx->Current.RasterSecondaryColor[1]);