aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkraxel <kraxel>2004-08-17 11:47:30 +0000
committerkraxel <kraxel>2004-08-17 11:47:30 +0000
commit91800dfd87198cd318c4648f66b9429b995aa468 (patch)
tree597c2629fa042bf2b14d41ed66df17eabe806fb6
parentc66ecd4b649f1c20f312bea5b3d8592ef91c5759 (diff)
downloadfbida-91800dfd87198cd318c4648f66b9429b995aa468.tar.gz
- 16 bpp direct color fix for fbi (bug found by Ville Syrjälä).
-rw-r--r--fb-gui.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/fb-gui.c b/fb-gui.c
index f0d78f3..be2eeb8 100644
--- a/fb-gui.c
+++ b/fb-gui.c
@@ -40,12 +40,21 @@ static unsigned short calc_gamma(int n, int max)
}
static void
-linear_palette(int bit)
+linear_palette(int r, int g, int b)
{
- int i, size = 256 >> (8 - bit);
+ int i, size;
+ size = 256 >> (8 - r);
for (i = 0; i < size; i++)
- p_red[i] = p_green[i] = p_blue[i] = calc_gamma(i,size);
+ p_red[i] = calc_gamma(i,size);
+
+ size = 256 >> (8 - g);
+ for (i = 0; i < size; i++)
+ p_green[i] = calc_gamma(i,size);
+
+ size = 256 >> (8 - b);
+ for (i = 0; i < size; i++)
+ p_blue[i] = calc_gamma(i,size);
}
static void
@@ -222,21 +231,23 @@ void shadow_init(void)
break;
case 15:
case 16:
- if (fb_fix.visual == FB_VISUAL_DIRECTCOLOR)
- linear_palette(5);
if (fb_var.green.length == 5) {
shadow_lut_init(15);
+ if (fb_fix.visual == FB_VISUAL_DIRECTCOLOR)
+ linear_palette(5,5,5);
} else {
shadow_lut_init(16);
+ if (fb_fix.visual == FB_VISUAL_DIRECTCOLOR)
+ linear_palette(5,6,5);
}
break;
case 24:
if (fb_fix.visual == FB_VISUAL_DIRECTCOLOR)
- linear_palette(8);
+ linear_palette(8,8,8);
break;
case 32:
if (fb_fix.visual == FB_VISUAL_DIRECTCOLOR)
- linear_palette(8);
+ linear_palette(8,8,8);
shadow_lut_init(24);
break;
default: