1 diff -ru libs.org/libtuxtxt/libtuxtxt.c libs/libtuxtxt/libtuxtxt.c
2 --- libs.org/libtuxtxt/libtuxtxt.c 2008-05-21 09:25:30.000000000 +0200
3 +++ libs/libtuxtxt/libtuxtxt.c 2008-05-22 09:42:18.000000000 +0200
5 * Info entnommen aus videotext-0.6.19991029, *
6 * Copyright (c) 1994-96 Martin Buck <martin-2.buck@student.uni-ulm.de> *
8 + * ported 2006 to Dreambox 7025 / 32Bit framebuffer *
9 + * by Seddi <seddi@i-have-a-dreambox.com> *
11 + * ported 32Bit framebuffer to Tuxtxt v1.99 (2008) *
12 + * by the PLi team (Sat-Turner) *
14 ******************************************************************************/
17 diff -ru libs.org/libtuxtxt/tuxtxt_common.h libs/libtuxtxt/tuxtxt_common.h
18 --- libs.org/libtuxtxt/tuxtxt_common.h 2008-08-13 19:53:47.000000000 +0200
19 +++ libs/libtuxtxt/tuxtxt_common.h 2008-05-31 13:44:57.000000000 +0200
21 aG3_70, aG3_71, aG3_72, aG3_73, aG3_74, aG3_75, aG3_76, aG3_77, aG3_78, aG3_79, aG3_7a, aG3_7b, aG3_7c, aG3_7d, aG3_7e
24 +/* 32bit colortable */
25 +unsigned char bgra[][4] = {
26 +"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
27 +"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
28 +"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
29 +"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
30 +"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
31 +"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
32 +"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
33 +"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
34 +"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xC0", "\0\0\0\x00",
37 tuxtxt_cache_struct tuxtxt_cache;
38 static pthread_mutex_t tuxtxt_cache_lock = PTHREAD_MUTEX_INITIALIZER;
39 int tuxtxt_get_zipsize(int p,int sp)
40 @@ -2782,12 +2795,16 @@
41 void tuxtxt_FillRect(unsigned char *lfb, int xres, int x, int y, int w, int h, int color)
44 - unsigned char *p = lfb + x + y * xres;
45 + unsigned char *p = lfb + x*4 + y * xres;
51 - memset(p, color, w);
52 + for (xtmp=0; xtmp<w; xtmp++)
54 + memcpy(p+xtmp*4,bgra[color],4);
60 unsigned char fgcolor, unsigned char bgcolor)
62 if (d == NULL) return;
64 + int bit, x, y, ltmp;
65 unsigned char *ay = ax + 13; /* array[0..10] of y-offsets for each pixel */
67 for (y = 0; y < 10; y++) /* 10*2 bytes a 6 pixels per char definition */
68 @@ -2823,9 +2840,21 @@
69 for (i = 0; i < h; i++)
72 - memset(d + ax[x], f1, ax[x+1] - ax[x]);
74 +// memset(d + ax[x], f1, ax[x+1] - ax[x]);
75 + for (ltmp=0 ; ltmp < (ax[x+1]-ax[x]); ltmp++)
77 + memcpy(d + ax[x]*4 +ltmp*4,bgra[f1],4);
80 if (ax[x+7] > ax[x+6])
81 - memset(d + ax[x+6], f2, ax[x+7] - ax[x+6]); /* 2nd byte 6 pixels to the right */
83 +// memset(d + ax[x+6], f2, ax[x+7] - ax[x+6]); /* 2nd byte 6 pixels to the right */
84 + for (ltmp=0 ; ltmp < (ax[x+7]-ax[x+6]); ltmp++)
86 + memcpy(d + ax[x+6]*4 +ltmp*4,bgra[f2],4);
92 @@ -2838,20 +2867,26 @@
93 void tuxtxt_DrawVLine(unsigned char *lfb, int xres, int x, int y, int l, int color)
96 - unsigned char *p = lfb + x + y * xres;
97 + unsigned char *p = lfb + 4*x + y * xres;
102 + memcpy(p,bgra[color],4);
107 void tuxtxt_DrawHLine(unsigned char* lfb,int xres,int x, int y, int l, int color)
112 - memset(lfb + x + y * xres, color, l);
114 + for (ltmp=0; ltmp < l; ltmp++)
116 + memcpy(lfb + x*4 + ltmp*4 + y * xres, bgra[color], 4);
121 void tuxtxt_FillRectMosaicSeparated(unsigned char *lfb, int xres,int x, int y, int w, int h, int fgcolor, int bgcolor, int set)
122 @@ -2866,48 +2901,54 @@
124 void tuxtxt_FillTrapez(unsigned char *lfb, int xres,int x0, int y0, int l0, int xoffset1, int h, int l1, int color)
126 - unsigned char *p = lfb + x0 + y0 * xres;
127 + unsigned char *p = lfb + x0*4 + y0 * xres;
132 for (yoffset = 0; yoffset < h; yoffset++)
134 l = l0 + ((l1-l0) * yoffset + h/2) / h;
135 xoffset = (xoffset1 * yoffset + h/2) / h;
137 - memset(p + xoffset, color, l);
139 + for (ltmp=0; ltmp < l; ltmp++)
141 + memcpy(p + xoffset*4 +ltmp*4, bgra[color], 4);
147 void tuxtxt_FlipHorz(unsigned char *lfb, int xres,int x, int y, int w, int h)
149 - unsigned char buf[w];
150 - unsigned char *p = lfb + x + y * xres;
151 + unsigned char buf[w*4];
152 + unsigned char *p = lfb + x*4 + y * xres;
155 for (h1 = 0 ; h1 < h ; h1++)
159 for (w1 = 0 ; w1 < w ; w1++)
161 - *(p+w1) = buf[w-(w1+1)];
162 + memcpy(p+w1*4,buf+((w-w1)*4)-4,4);
167 void tuxtxt_FlipVert(unsigned char *lfb, int xres,int x, int y, int w, int h)
169 - unsigned char buf[w];
170 - unsigned char *p = lfb + x + y * xres, *p1, *p2;
171 + unsigned char buf[w*4];
172 + unsigned char *p = lfb + x*4 + y * xres, *p1, *p2;
175 for (h1 = 0 ; h1 < h/2 ; h1++)
178 p2 = (p+(h-(h1+1))*xres);
182 + memcpy(buf,p1,w*4);
184 + memcpy(p2,buf,w*4);
188 @@ -3163,7 +3204,7 @@
192 - unsigned char* p = lfb + *pPosX + PosY* xres;
193 + unsigned char* p = lfb + (*pPosX)*4 + PosY* xres;
194 for (y=0; y<fontheight;y++)
196 for (f=0; f<factor; f++)
197 @@ -3171,7 +3212,7 @@
198 for (x=0; x<curfontwidth*xfactor;x++)
200 c = (y&4 ? (x/3)&1 :((x+3)/3)&1);
201 - *(p+x) = (c ? fgcolor : bgcolor);
202 + memcpy((p+x*4),bgra[(c ? fgcolor : bgcolor)],4);
206 @@ -3209,7 +3250,7 @@
208 axdrcs[12] = curfontwidth; /* adjust last x-offset according to position, FIXME: double width */
209 tuxtxt_RenderDRCS(xres,p,
210 - lfb + *pPosX + PosY * xres,
211 + lfb + (*pPosX)*4 + PosY * xres,
212 axdrcs, fgcolor, bgcolor);