diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index 5bb766aca..5d0351a31 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -34,6 +34,7 @@ static int cfg_national_subset; void FillRect(int x, int y, int w, int h, int color) { unsigned char *p = lfb + x*4 + y * fix_screeninfo.line_length; +#if !HAVE_TRIPLEDRAGON unsigned int col = bgra[color][3] << 24 | bgra[color][2] << 16 | bgra[color][1] << 8 | bgra[color][0]; if (w > 0) for (int count = 0; count < h; count++) { @@ -42,6 +43,18 @@ void FillRect(int x, int y, int w, int h, int color) *(dest0++) = col; p += fix_screeninfo.line_length; } +#else + int xtmp; + if (w > 0) + for ( ; h > 0 ; h--) + { + for (xtmp=0; xtmp<=w; xtmp++) + { + memcpy(p+xtmp*4,bgra[color],4); + } + p += fix_screeninfo.line_length; + } +#endif } void FillBorder(int color) @@ -272,6 +285,17 @@ void setfontwidth(int newwidth) } } +#if HAVE_TRIPLEDRAGON +#define _A 0 +#define _R 1 +#define _G 2 +#define _B 3 +#else +#define _A 3 +#define _R 2 +#define _G 1 +#define _B 0 +#endif void setcolors(unsigned short *pcolormap, int offset, int number) { int i,trans_tmp; @@ -279,7 +303,7 @@ void setcolors(unsigned short *pcolormap, int offset, int number) trans_tmp=25-trans_mode; - bgra[transp2][3]=((trans_tmp+7)<<11 | 0x7FF)>>8; + bgra[transp2][_A]=((trans_tmp+7)<<11 | 0x7FF)>>8; for (i = 0; i < number; i++) { @@ -291,9 +315,9 @@ void setcolors(unsigned short *pcolormap, int offset, int number) g = (g * (0x3f+(color_mode<<3))) >> 8; b = (b * (0x3f+(color_mode<<3))) >> 8; - bgra[j][2]=r; - bgra[j][1]=g; - bgra[j][0]=b; + bgra[j][_R]=r; + bgra[j][_G]=g; + bgra[j][_B]=b; j++; } diff --git a/lib/libtuxtxt/tuxtxt.h b/lib/libtuxtxt/tuxtxt.h index 5334f1680..0c7d606a0 100644 --- a/lib/libtuxtxt/tuxtxt.h +++ b/lib/libtuxtxt/tuxtxt.h @@ -1216,6 +1216,7 @@ const unsigned short defaultcolors[] = /* 0x0bgr */ 0x420, 0x210, 0x420, 0x000, 0x000 }; +#if !HAVE_TRIPLEDRAGON /* 32bit colortable */ unsigned char bgra[][5] = { "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", @@ -1228,6 +1229,20 @@ unsigned char bgra[][5] = { "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xC0", "\0\0\0\x00", "\0\0\0\x33" }; +#else +/* actually "ARGB" */ +unsigned char bgra[][5] = { +"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", +"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", +"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", +"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", +"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", +"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", +"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", +"\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", "\xFF\0\0\0", +"\xFF\0\0\0", "\xFF\0\0\0", "\xC0\0\0\0", "\x00\0\0\0", +"\x33\0\0\0" }; +#endif /* old 8bit color table */ unsigned short rd0[] = {0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0x00<<8, 0x00<<8, 0x00<<8, 0, 0 };