summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/swrast/s_span.c40
1 files changed, 29 insertions, 11 deletions
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index 13248fdc7cd..d164ad961ad 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
- * Version: 5.1
+ * Version: 6.1
*
- * Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -1118,14 +1118,32 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span)
/* write pixels */
if (span->arrayMask & SPAN_XY) {
/* array of pixel coords */
- /* XXX test for mono color */
- (*swrast->Driver.WriteRGBAPixels)(ctx, span->end, span->array->x,
- span->array->y, (const GLchan (*)[4]) span->array->rgba, span->array->mask);
- if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
- _swrast_write_alpha_pixels(ctx, span->end,
- span->array->x, span->array->y,
- (const GLchan (*)[4]) span->array->rgba,
- span->array->mask);
+ if (monoColor) {
+ /* all pixels have same color */
+ GLchan color[4];
+ color[RCOMP] = FixedToChan(span->red);
+ color[GCOMP] = FixedToChan(span->green);
+ color[BCOMP] = FixedToChan(span->blue);
+ color[ACOMP] = FixedToChan(span->alpha);
+ (*swrast->Driver.WriteMonoRGBAPixels)(ctx, span->end,
+ span->array->x, span->array->y, color, span->array->mask);
+ if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
+ _swrast_write_mono_alpha_pixels(ctx, span->end,
+ span->array->x, span->array->y,
+ color[ACOMP], span->array->mask);
+ }
+ }
+ else {
+ (*swrast->Driver.WriteRGBAPixels)(ctx, span->end,
+ span->array->x, span->array->y,
+ (const GLchan (*)[4]) span->array->rgba,
+ span->array->mask);
+ if (SWRAST_CONTEXT(ctx)->_RasterMask & ALPHABUF_BIT) {
+ _swrast_write_alpha_pixels(ctx, span->end,
+ span->array->x, span->array->y,
+ (const GLchan (*)[4]) span->array->rgba,
+ span->array->mask);
+ }
}
}
else {
@@ -1138,7 +1156,7 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span)
color[BCOMP] = FixedToChan(span->blue);
color[ACOMP] = FixedToChan(span->alpha);
(*swrast->Driver.WriteMonoRGBASpan)(ctx, span->end, span->x,
- span->y, color, span->array->mask);
+ span->y, color, span->array->mask);
if (swrast->_RasterMask & ALPHABUF_BIT) {
_swrast_write_mono_alpha_span(ctx, span->end, span->x, span->y,
color[ACOMP],