summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2004-03-24 17:17:25 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2004-03-24 17:17:25 +0000
commit844585be4c392d7e06a8954e56c3756cafa74a39 (patch)
tree9d7ef04b82d557901dd59c70ae9a3374314a0d5a
parente1e439c51239f8129e678e437d7afb999232db8a (diff)
use Driver.WriteMonoRGBAPixels() when possible (Dan Schikore)
-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 13248fdc7c..d164ad961a 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],