diff options
Diffstat (limited to 'src/mesa/drivers/svga/svgamesa16.c')
-rw-r--r-- | src/mesa/drivers/svga/svgamesa16.c | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/src/mesa/drivers/svga/svgamesa16.c b/src/mesa/drivers/svga/svgamesa16.c index 061f40a9b70..26a36c7d03a 100644 --- a/src/mesa/drivers/svga/svgamesa16.c +++ b/src/mesa/drivers/svga/svgamesa16.c @@ -1,8 +1,8 @@ -/* $Id: svgamesa16.c,v 1.3 2000/01/23 17:49:54 brianp Exp $ */ +/* $Id: svgamesa16.c,v 1.4 2000/01/25 00:03:02 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.2 + * Version: 3.3 * Copyright (C) 1995-2000 Brian Paul * * This library is free software; you can redistribute it and/or @@ -30,25 +30,23 @@ #ifdef SVGA #include "svgapix.h" +#include "svgamesa16.h" -GLshort * shortBuffer; -int __svga_drawpixel16(int x, int y, unsigned long c) +static void __svga_drawpixel16(int x, int y, unsigned long c) { unsigned long offset; - - shortBuffer=(void *)SVGABuffer.BackBuffer; + GLshort *shortBuffer=(void *)SVGABuffer.DrawBuffer; y = SVGAInfo->height-y-1; offset = y * SVGAInfo->width + x; shortBuffer[offset]=c; - return 0; } -unsigned long __svga_getpixel16(int x, int y) +static unsigned long __svga_getpixel16(int x, int y) { unsigned long offset; - shortBuffer=(void *)SVGABuffer.BackBuffer; + GLshort *shortBuffer=(void *)SVGABuffer.ReadBuffer; y = SVGAInfo->height-y-1; offset = y * SVGAInfo->width + x; return shortBuffer[offset]; @@ -74,18 +72,38 @@ GLbitfield __clear16( GLcontext *ctx, GLbitfield mask, GLboolean all, GLint x, GLint y, GLint width, GLint height ) { int i,j; - - if (mask & GL_COLOR_BUFFER_BIT) { - if (all) { - shortBuffer=(void *)SVGABuffer.BackBuffer; - for (i=0;i<SVGABuffer.BufferSize / 2;i++) shortBuffer[i]=SVGAMesa->clear_hicolor; - } else { - for (i=x;i<width;i++) - for (j=y;j<height;j++) - __svga_drawpixel16(i,j,SVGAMesa->clear_hicolor); - } - } - return mask & (~GL_COLOR_BUFFER_BIT); + + if (mask & DD_FRONT_LEFT_BIT) { + if (all) { + GLshort *shortBuffer=(void *)SVGABuffer.FrontBuffer; + for (i=0;i<SVGABuffer.BufferSize / 2;i++) + shortBuffer[i]=SVGAMesa->clear_hicolor; + } + else { + GLubyte *tmp = SVGABuffer.DrawBuffer; + SVGABuffer.DrawBuffer = SVGABuffer.FrontBuffer; + for (i=x;i<width;i++) + for (j=y;j<height;j++) + __svga_drawpixel16(i,j,SVGAMesa->clear_hicolor); + SVGABuffer.DrawBuffer = tmp; + } + } + if (mask & DD_BACK_LEFT_BIT) { + if (all) { + GLshort *shortBuffer=(void *)SVGABuffer.BackBuffer; + for (i=0;i<SVGABuffer.BufferSize / 2;i++) + shortBuffer[i]=SVGAMesa->clear_hicolor; + } + else { + GLubyte *tmp = SVGABuffer.DrawBuffer; + SVGABuffer.DrawBuffer = SVGABuffer.BackBuffer; + for (i=x;i<width;i++) + for (j=y;j<height;j++) + __svga_drawpixel16(i,j,SVGAMesa->clear_hicolor); + SVGABuffer.DrawBuffer = tmp; + } + } + return mask & (~(DD_FRONT_LEFT_BIT | DD_BACK_LEFT_BIT)); } void __write_rgba_span16( const GLcontext *ctx, GLuint n, GLint x, GLint y, |