summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/softpipe/sp_region.c
diff options
context:
space:
mode:
authorBrian <[email protected]>2007-08-01 16:15:30 -0600
committerBrian <[email protected]>2007-08-01 16:15:30 -0600
commit1b0e92b91a66c0188a870fb3ed6c20a8466b6ae9 (patch)
tree5402d89871b317a2d3da6eda94159fc3257ec9c5 /src/mesa/pipe/softpipe/sp_region.c
parent1ecc648398a51f734ef1e3b729595f41cedf29f9 (diff)
implement masking in sp_region_fill()
Diffstat (limited to 'src/mesa/pipe/softpipe/sp_region.c')
-rw-r--r--src/mesa/pipe/softpipe/sp_region.c59
1 files changed, 48 insertions, 11 deletions
diff --git a/src/mesa/pipe/softpipe/sp_region.c b/src/mesa/pipe/softpipe/sp_region.c
index 34fbcce8ca2..1dbd1609e37 100644
--- a/src/mesa/pipe/softpipe/sp_region.c
+++ b/src/mesa/pipe/softpipe/sp_region.c
@@ -112,29 +112,66 @@ sp_region_fill(struct pipe_context *pipe,
case 1:
{
GLubyte *row = get_pointer(dst, dstx, dsty);
- for (i = 0; i < height; i++) {
- memset(row, value, width);
- row += dst->pitch;
+ if ((mask & 0xff) == 0xff) {
+ /* no masking */
+ for (i = 0; i < height; i++) {
+ memset(row, value, width);
+ row += dst->pitch;
+ }
+ }
+ else {
+ value &= mask;
+ mask = ~mask;
+ for (i = 0; i < height; i++) {
+ for (j = 0; j < width; j++) {
+ row[j] = (row[j] & mask) | value;
+ }
+ row += dst->pitch;
+ }
}
}
break;
case 2:
{
GLushort *row = (GLushort *) get_pointer(dst, dstx, dsty);
- for (i = 0; i < height; i++) {
- for (j = 0; j < width; j++)
- row[j] = value;
- row += dst->pitch;
+ if ((mask & 0xffff) == 0xffff) {
+ /* no masking */
+ for (i = 0; i < height; i++) {
+ for (j = 0; j < width; j++)
+ row[j] = value;
+ row += dst->pitch;
+ }
+ }
+ else {
+ value &= mask;
+ mask = ~mask;
+ for (i = 0; i < height; i++) {
+ for (j = 0; j < width; j++)
+ row[j] = (row[j] & mask) | value;
+ row += dst->pitch;
+ }
}
}
break;
case 4:
{
GLuint *row = (GLuint *) get_pointer(dst, dstx, dsty);
- for (i = 0; i < height; i++) {
- for (j = 0; j < width; j++)
- row[j] = value;
- row += dst->pitch;
+ if (mask == 0xffffffff) {
+ /* no masking */
+ for (i = 0; i < height; i++) {
+ for (j = 0; j < width; j++)
+ row[j] = value;
+ row += dst->pitch;
+ }
+ }
+ else {
+ value &= mask;
+ mask = ~mask;
+ for (i = 0; i < height; i++) {
+ for (j = 0; j < width; j++)
+ row[j] = (row[j] & mask) | value;
+ row += dst->pitch;
+ }
}
}
break;