tuxtxt: convert to int-pointer arithmetic, work with all framebuffers

This converts the drawing code from byte-pointer to fb_pixel_t-pointer
arithmetic, making the calculations more obvious and probably more
efficient.
Additionally, the color tables are now generated in a way that it should
work regardless of the frame buffer color format. Allows to remove a few
hardware specific #ifdefs.
This commit is contained in:
Stefan Seyfried
2017-02-15 00:31:26 +01:00
committed by M. Liebmann
parent 5612baaff7
commit c977c98217
2 changed files with 93 additions and 140 deletions

View File

@@ -247,10 +247,11 @@ const char *ObjectType[] =
#define NoServicesFound 3
/* framebuffer stuff */
static unsigned char *lfb = 0;
static unsigned char *lbb = 0;
static fb_pixel_t *lfb = 0;
static fb_pixel_t *lbb = 0;
struct fb_var_screeninfo var_screeninfo;
struct fb_fix_screeninfo fix_screeninfo;
int stride;
/* freetype stuff */
FT_Library library;
@@ -1248,33 +1249,8 @@ 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",
"\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" };
#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
/* filled in setcolors() */
fb_pixel_t bgra[SIZECOLTABLE];
/* 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 };