]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Dark palette fix before other adjustments.
authorToni Wilen <twilen@winuae.net>
Wed, 10 Feb 2016 14:28:29 +0000 (16:28 +0200)
committerToni Wilen <twilen@winuae.net>
Wed, 10 Feb 2016 14:28:29 +0000 (16:28 +0200)
gfxutil.cpp

index a2593e1ce72d9817784b53ca2b8390cc127cfb0d..f2b861349fbc838a45140468e08890bd96dd2d74 100644 (file)
@@ -136,8 +136,7 @@ static int lf, hf;
 
 static void video_calc_gammatable (void)
 {
-       float bri, con, gam, gams[3], v;
-       uae_u32 vi;
+       float bri, con, gam, gams[3];
 
        bri = ((float)(currprefs.gfx_luminance)) * (128.0f / 1000.0f);
        con = ((float)(currprefs.gfx_contrast + 1000)) / 1000.0f;
@@ -151,23 +150,27 @@ static void video_calc_gammatable (void)
 
        for (int i = 0; i < (256 * 3); i++) {
                for (int j = 0; j < 3; j++) {
-                       v = video_gamma((float)(i - 256), gams[j], bri, con);
-
-                       vi = (uae_u32)v;
-
-                       if (currprefs.gfx_luminance == 0 && currprefs.gfx_contrast == 0 && currprefs.gfx_gamma == 0)
-                               vi = i & 0xff;
+                       int val = i - 256;
+                       float v;
 
                        if (currprefs.gfx_threebitcolors == 1) {
-                               vi *= 2;
+                               val *= 2;
                        } else if (currprefs.gfx_threebitcolors == 2) {
-                               vi = (vi + (vi & 7)) * 2;
+                               val = (val + (val & 7)) * 2;
+                       }
+
+                       if (currprefs.gfx_luminance == 0 && currprefs.gfx_contrast == 0 && currprefs.gfx_gamma == 0) {
+                               v = val;
+                       } else {
+                               v = video_gamma(val, gams[j], bri, con);
                        }
 
-                       if (vi > 255)
-                               vi = 255;
+                       if (v < 0.0)
+                               v = 0.0;
+                       if (v > 255.0)
+                               v = 255.0;
 
-                       gamma[i][j] = vi;
+                       gamma[i][j] = (uae_u32)v;
                }
        }
 }