Add _swrast_span_default_secondary_color() for use with glBitmap, glDrawPixels, etc.
Secondary color wasn't getting added to post-texture color when drawing bitmaps, images. See bug 10409.
This commit is contained in:
@@ -85,6 +85,8 @@ _swrast_Bitmap( GLcontext *ctx, GLint px, GLint py,
|
|||||||
INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_XY);
|
INIT_SPAN(span, GL_BITMAP, width, 0, SPAN_XY);
|
||||||
|
|
||||||
_swrast_span_default_color(ctx, &span);
|
_swrast_span_default_color(ctx, &span);
|
||||||
|
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
|
||||||
|
_swrast_span_default_secondary_color(ctx, &span);
|
||||||
if (ctx->Depth.Test)
|
if (ctx->Depth.Test)
|
||||||
_swrast_span_default_z(ctx, &span);
|
_swrast_span_default_z(ctx, &span);
|
||||||
if (swrast->_FogEnabled)
|
if (swrast->_FogEnabled)
|
||||||
|
@@ -109,7 +109,8 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||||||
_swrast_span_default_z(ctx, &span);
|
_swrast_span_default_z(ctx, &span);
|
||||||
if (swrast->_FogEnabled)
|
if (swrast->_FogEnabled)
|
||||||
_swrast_span_default_fog(ctx, &span);
|
_swrast_span_default_fog(ctx, &span);
|
||||||
|
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
|
||||||
|
_swrast_span_default_secondary_color(ctx, &span);
|
||||||
|
|
||||||
/* allocate space for GLfloat image */
|
/* allocate space for GLfloat image */
|
||||||
tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
|
tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
|
||||||
@@ -244,6 +245,8 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
|
|||||||
_swrast_span_default_z(ctx, &span);
|
_swrast_span_default_z(ctx, &span);
|
||||||
if (swrast->_FogEnabled)
|
if (swrast->_FogEnabled)
|
||||||
_swrast_span_default_fog(ctx, &span);
|
_swrast_span_default_fog(ctx, &span);
|
||||||
|
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
|
||||||
|
_swrast_span_default_secondary_color(ctx, &span);
|
||||||
|
|
||||||
if (overlapping) {
|
if (overlapping) {
|
||||||
tmpImage = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat) * 4);
|
tmpImage = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat) * 4);
|
||||||
@@ -489,6 +492,8 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy,
|
|||||||
}
|
}
|
||||||
|
|
||||||
_swrast_span_default_color(ctx, &span);
|
_swrast_span_default_color(ctx, &span);
|
||||||
|
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
|
||||||
|
_swrast_span_default_secondary_color(ctx, &span);
|
||||||
if (swrast->_FogEnabled)
|
if (swrast->_FogEnabled)
|
||||||
_swrast_span_default_fog(ctx, &span);
|
_swrast_span_default_fog(ctx, &span);
|
||||||
|
|
||||||
|
@@ -71,6 +71,8 @@ fast_draw_rgba_pixels(GLcontext *ctx, GLint x, GLint y,
|
|||||||
}
|
}
|
||||||
|
|
||||||
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
|
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);
|
||||||
if (ctx->Depth.Test)
|
if (ctx->Depth.Test)
|
||||||
_swrast_span_default_z(ctx, &span);
|
_swrast_span_default_z(ctx, &span);
|
||||||
if (swrast->_FogEnabled)
|
if (swrast->_FogEnabled)
|
||||||
@@ -441,7 +443,8 @@ draw_depth_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||||||
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z);
|
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_Z);
|
||||||
|
|
||||||
_swrast_span_default_color(ctx, &span);
|
_swrast_span_default_color(ctx, &span);
|
||||||
|
if (ctx->Light.Model.ColorControl == GL_SEPARATE_SPECULAR_COLOR)
|
||||||
|
_swrast_span_default_secondary_color(ctx, &span);
|
||||||
if (swrast->_FogEnabled)
|
if (swrast->_FogEnabled)
|
||||||
_swrast_span_default_fog(ctx, &span);
|
_swrast_span_default_fog(ctx, &span);
|
||||||
if (ctx->Texture._EnabledCoordUnits)
|
if (ctx->Texture._EnabledCoordUnits)
|
||||||
@@ -562,6 +565,8 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
INIT_SPAN(span, GL_BITMAP, 0, 0, SPAN_RGBA);
|
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);
|
||||||
if (ctx->Depth.Test)
|
if (ctx->Depth.Test)
|
||||||
_swrast_span_default_z(ctx, &span);
|
_swrast_span_default_z(ctx, &span);
|
||||||
if (swrast->_FogEnabled)
|
if (swrast->_FogEnabled)
|
||||||
|
@@ -121,6 +121,35 @@ _swrast_span_default_color( GLcontext *ctx, SWspan *span )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
_swrast_span_default_secondary_color(GLcontext *ctx, SWspan *span)
|
||||||
|
{
|
||||||
|
if (ctx->Visual.rgbMode) {
|
||||||
|
GLchan r, g, b, a;
|
||||||
|
UNCLAMPED_FLOAT_TO_CHAN(r, ctx->Current.RasterSecondaryColor[0]);
|
||||||
|
UNCLAMPED_FLOAT_TO_CHAN(g, ctx->Current.RasterSecondaryColor[1]);
|
||||||
|
UNCLAMPED_FLOAT_TO_CHAN(b, ctx->Current.RasterSecondaryColor[2]);
|
||||||
|
UNCLAMPED_FLOAT_TO_CHAN(a, ctx->Current.RasterSecondaryColor[3]);
|
||||||
|
#if CHAN_TYPE == GL_FLOAT
|
||||||
|
span->specRed = r;
|
||||||
|
span->specGreen = g;
|
||||||
|
span->specBlue = b;
|
||||||
|
/8span->specAlpha = a;*/
|
||||||
|
#else
|
||||||
|
span->specRed = IntToFixed(r);
|
||||||
|
span->specGreen = IntToFixed(g);
|
||||||
|
span->specBlue = IntToFixed(b);
|
||||||
|
/*span->specAlpha = IntToFixed(a);*/
|
||||||
|
#endif
|
||||||
|
span->specRedStep = 0;
|
||||||
|
span->specGreenStep = 0;
|
||||||
|
span->specBlueStep = 0;
|
||||||
|
/*span->specAlphaStep = 0;*/
|
||||||
|
span->interpMask |= SPAN_SPEC;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init span's texcoord interpolation values to the RasterPos texcoords.
|
* Init span's texcoord interpolation values to the RasterPos texcoords.
|
||||||
* Used during setup for glDraw/CopyPixels.
|
* Used during setup for glDraw/CopyPixels.
|
||||||
|
@@ -222,6 +222,9 @@ _swrast_span_default_fog( GLcontext *ctx, SWspan *span );
|
|||||||
extern void
|
extern void
|
||||||
_swrast_span_default_color( GLcontext *ctx, SWspan *span );
|
_swrast_span_default_color( GLcontext *ctx, SWspan *span );
|
||||||
|
|
||||||
|
extern void
|
||||||
|
_swrast_span_default_secondary_color(GLcontext *ctx, SWspan *span);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
_swrast_span_default_texcoords( GLcontext *ctx, SWspan *span );
|
_swrast_span_default_texcoords( GLcontext *ctx, SWspan *span );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user