summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2003-07-11 16:33:43 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2003-07-11 16:33:43 +0000
commit44c699949ac09459771304a8aec8f2fc622057fb (patch)
tree80e839961b8886958bd0f6cb6e6a012e5bb9546c /src/mesa/drivers
parent356959952c93b64b5b6227c4fc2b3c4e9e08d6a1 (diff)
DOS updates from Daniel Borca
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dos/video.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/mesa/drivers/dos/video.c b/src/mesa/drivers/dos/video.c
index 6c0f56f629..35c643b4c9 100644
--- a/src/mesa/drivers/dos/video.c
+++ b/src/mesa/drivers/dos/video.c
@@ -58,9 +58,9 @@ int vl_current_offset, vl_current_delta;
/* These lookup tables are used to extract RGB values in [0,255]
* from 15/16-bit pixel values.
*/
-static unsigned char pix15r[0x10000];
-static unsigned char pix15g[0x10000];
-static unsigned char pix15b[0x10000];
+static unsigned char pix15r[0x8000];
+static unsigned char pix15g[0x8000];
+static unsigned char pix15b[0x8000];
static unsigned char pix16r[0x10000];
static unsigned char pix16g[0x10000];
static unsigned char pix16b[0x10000];
@@ -226,6 +226,7 @@ static void v_getrgba15 (unsigned int offset, unsigned char rgba[4])
{
word32 c = ((word16 *)vl_current_read_buffer)[offset];
#if HUGE_LOOKUP
+ c &= 0x7fff;
rgba[0] = pix15r[c];
rgba[1] = pix15g[c];
rgba[2] = pix15b[c];
@@ -378,18 +379,20 @@ void v_init_pixeltables (void)
for (pixel = 0; pixel <= 0xffff; pixel++) {
unsigned int r, g, b;
- /* 15bit */
- r = (pixel & 0x7c00) >> 8;
- g = (pixel & 0x03E0) >> 3;
- b = (pixel & 0x001F) << 2;
+ if (pixel <= 0x7fff) {
+ /* 15bit */
+ r = (pixel & 0x7c00) >> 8;
+ g = (pixel & 0x03E0) >> 3;
+ b = (pixel & 0x001F) << 2;
- r = (unsigned int)(((double)r * 255. / 0x7c) + 0.5);
- g = (unsigned int)(((double)g * 255. / 0x7c) + 0.5);
- b = (unsigned int)(((double)b * 255. / 0x7c) + 0.5);
+ r = (unsigned int)(((double)r * 255. / 0x7c) + 0.5);
+ g = (unsigned int)(((double)g * 255. / 0x7c) + 0.5);
+ b = (unsigned int)(((double)b * 255. / 0x7c) + 0.5);
- pix15r[pixel] = r;
- pix15g[pixel] = g;
- pix15b[pixel] = b;
+ pix15r[pixel] = r;
+ pix15g[pixel] = g;
+ pix15b[pixel] = b;
+ }
/* 16bit */
r = (pixel & 0xF800) >> 8;