--- uae/src/gfxutil.c 2018/04/24 16:41:57 1.1.1.4 +++ uae/src/gfxutil.c 2018/04/24 17:14:06 1.1.1.9 @@ -11,12 +11,11 @@ #include "config.h" #include "options.h" -#include "threaddep/penguin.h" +#include "threaddep/thread.h" #include "memory.h" #include "custom.h" #include "keyboard.h" #include "xwin.h" -#include "keybuf.h" #define RED 0 #define GRN 1 @@ -77,6 +76,13 @@ unsigned long doMask256 (int p, int bits return val; } +static unsigned int doColor (int i, int bits, int shift) +{ + int shift2; + if(bits >= 8) shift2 = 0; else shift2 = 8 - bits; + return (i >> shift2) << shift; +} + void alloc_colors64k (int rw, int gw, int bw, int rs, int gs, int bs) { int i; @@ -86,6 +92,12 @@ void alloc_colors64k (int rw, int gw, in int b = i & 0xF; xcolors[i] = doMask(r, rw, rs) | doMask(g, gw, gs) | doMask(b, bw, bs); } + /* create AGA color tables */ + for(i = 0; i < 256; i++) { + xredcolors[i] = doColor(i, rw, rs); + xgreencolors[i] = doColor(i, gw, gs); + xbluecolors[i] = doColor(i, bw, bs); + } } static int allocated[4096]; @@ -101,7 +113,7 @@ void alloc_colors256 (allocfunc_type all { int nb_cols[3]; /* r,g,b */ int maxcol = newmaxcol == 0 ? 256 : newmaxcol; - int i,j,k,l,t; + int i,j,k,l; xcolnr *map; @@ -348,7 +360,7 @@ void setup_dither (int bits, allocfunc_t } } } -/* fprintf(stderr, "%d color(s) lost\n",maxcol - l);*/ +/* write_log ("%d color(s) lost\n",maxcol - l);*/ /* * for each component compute the mapping