add TD framebuffer support to tuxtxt

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@966 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: 5636a92fad
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2010-12-25 (Sat, 25 Dec 2010)



------------------
This commit was generated by Migit
This commit is contained in:
Stefan Seyfried
2010-12-25 17:55:05 +00:00
parent 158de895af
commit 4750b3b5f3
2 changed files with 43 additions and 4 deletions

View File

@@ -34,6 +34,7 @@ static int cfg_national_subset;
void FillRect(int x, int y, int w, int h, int color) void FillRect(int x, int y, int w, int h, int color)
{ {
unsigned char *p = lfb + x*4 + y * fix_screeninfo.line_length; 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]; unsigned int col = bgra[color][3] << 24 | bgra[color][2] << 16 | bgra[color][1] << 8 | bgra[color][0];
if (w > 0) if (w > 0)
for (int count = 0; count < h; count++) { 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; *(dest0++) = col;
p += fix_screeninfo.line_length; 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) 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) void setcolors(unsigned short *pcolormap, int offset, int number)
{ {
int i,trans_tmp; int i,trans_tmp;
@@ -279,7 +303,7 @@ void setcolors(unsigned short *pcolormap, int offset, int number)
trans_tmp=25-trans_mode; 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++) 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; g = (g * (0x3f+(color_mode<<3))) >> 8;
b = (b * (0x3f+(color_mode<<3))) >> 8; b = (b * (0x3f+(color_mode<<3))) >> 8;
bgra[j][2]=r; bgra[j][_R]=r;
bgra[j][1]=g; bgra[j][_G]=g;
bgra[j][0]=b; bgra[j][_B]=b;
j++; j++;
} }

View File

@@ -1216,6 +1216,7 @@ const unsigned short defaultcolors[] = /* 0x0bgr */
0x420, 0x210, 0x420, 0x000, 0x000 0x420, 0x210, 0x420, 0x000, 0x000
}; };
#if !HAVE_TRIPLEDRAGON
/* 32bit colortable */ /* 32bit colortable */
unsigned char bgra[][5] = { 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",
@@ -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\xFF", "\0\0\0\xFF",
"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xC0", "\0\0\0\x00", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xC0", "\0\0\0\x00",
"\0\0\0\x33" }; "\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 */ /* 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 }; 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 };