1 diff -Naur libs-org/libtuxtxt/libtuxtxt.c libs/libtuxtxt/libtuxtxt.c
2 --- libs-org/libtuxtxt/libtuxtxt.c 2010-03-06 10:51:52.000000000 +0100
3 +++ libs/libtuxtxt/libtuxtxt.c 2010-03-06 10:55:25.000000000 +0100
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 + * ported to 20090130 *
15 + * by the PLi team (pieterg) *
17 ******************************************************************************/
20 diff -Naur libs-org/libtuxtxt/tuxtxt_common.h libs/libtuxtxt/tuxtxt_common.h
21 --- libs-org/libtuxtxt/tuxtxt_common.h 2010-03-06 10:51:52.000000000 +0100
22 +++ libs/libtuxtxt/tuxtxt_common.h 2010-03-06 10:56:26.000000000 +0100
24 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
27 +/* 32bit colortable */
28 +unsigned char bgra[][4] = {
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\xFF", "\0\0\0\xFF",
35 +"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
36 +"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xFF",
37 +"\0\0\0\xFF", "\0\0\0\xFF", "\0\0\0\xC0", "\0\0\0\x00",
40 tuxtxt_cache_struct tuxtxt_cache;
41 static pthread_mutex_t tuxtxt_cache_lock = PTHREAD_MUTEX_INITIALIZER;
42 int tuxtxt_get_zipsize(int p,int sp)
43 @@ -3294,14 +3307,21 @@
44 void tuxtxt_FillRect(unsigned char *lfb, int xres, int x, int y, int w, int h, int color)
47 - unsigned char *p = lfb + x + y * xres;
48 + unsigned char *p = lfb + x*4 + y * xres;
49 + unsigned char linebuf[w*4];
54 + for (xtmp=0; xtmp<w; xtmp++)
55 + memcpy(linebuf+xtmp*4,bgra[color],4);
59 - memset(p, color, w);
60 + memcpy(p,linebuf,w*4);
66 void tuxtxt_RenderDRCS(int xres,
68 unsigned char fgcolor, unsigned char bgcolor)
70 if (d == NULL) return;
72 + int bit, x, y, ltmp;
73 unsigned char *ay = ax + 13; /* array[0..10] of y-offsets for each pixel */
75 for (y = 0; y < 10; y++) /* 10*2 bytes a 6 pixels per char definition */
76 @@ -3335,9 +3355,21 @@
77 for (i = 0; i < h; i++)
80 - memset(d + ax[x], f1, ax[x+1] - ax[x]);
82 +// memset(d + ax[x], f1, ax[x+1] - ax[x]);
83 + for (ltmp=0 ; ltmp < (ax[x+1]-ax[x]); ltmp++)
85 + memcpy(d + ax[x]*4 +ltmp*4,bgra[f1],4);
88 if (ax[x+7] > ax[x+6])
89 - memset(d + ax[x+6], f2, ax[x+7] - ax[x+6]); /* 2nd byte 6 pixels to the right */
91 +// memset(d + ax[x+6], f2, ax[x+7] - ax[x+6]); /* 2nd byte 6 pixels to the right */
92 + for (ltmp=0 ; ltmp < (ax[x+7]-ax[x+6]); ltmp++)
94 + memcpy(d + ax[x+6]*4 +ltmp*4,bgra[f2],4);
100 @@ -3350,20 +3382,26 @@
101 void tuxtxt_DrawVLine(unsigned char *lfb, int xres, int x, int y, int l, int color)
104 - unsigned char *p = lfb + x + y * xres;
105 + unsigned char *p = lfb + 4*x + y * xres;
110 + memcpy(p,bgra[color],4);
115 void tuxtxt_DrawHLine(unsigned char* lfb,int xres,int x, int y, int l, int color)
120 - memset(lfb + x + y * xres, color, l);
122 + for (ltmp=0; ltmp < l; ltmp++)
124 + memcpy(lfb + x*4 + ltmp*4 + y * xres, bgra[color], 4);
129 void tuxtxt_FillRectMosaicSeparated(unsigned char *lfb, int xres,int x, int y, int w, int h, int fgcolor, int bgcolor, int set)
130 @@ -3378,48 +3416,54 @@
132 void tuxtxt_FillTrapez(unsigned char *lfb, int xres,int x0, int y0, int l0, int xoffset1, int h, int l1, int color)
134 - unsigned char *p = lfb + x0 + y0 * xres;
135 + unsigned char *p = lfb + x0*4 + y0 * xres;
140 for (yoffset = 0; yoffset < h; yoffset++)
142 l = l0 + ((l1-l0) * yoffset + h/2) / h;
143 xoffset = (xoffset1 * yoffset + h/2) / h;
145 - memset(p + xoffset, color, l);
147 + for (ltmp=0; ltmp < l; ltmp++)
149 + memcpy(p + xoffset*4 +ltmp*4, bgra[color], 4);
155 void tuxtxt_FlipHorz(unsigned char *lfb, int xres,int x, int y, int w, int h)
157 - unsigned char buf[w];
158 - unsigned char *p = lfb + x + y * xres;
159 + unsigned char buf[w*4];
160 + unsigned char *p = lfb + x*4 + y * xres;
163 for (h1 = 0 ; h1 < h ; h1++)
167 for (w1 = 0 ; w1 < w ; w1++)
169 - *(p+w1) = buf[w-(w1+1)];
170 + memcpy(p+w1*4,buf+((w-w1)*4)-4,4);
175 void tuxtxt_FlipVert(unsigned char *lfb, int xres,int x, int y, int w, int h)
177 - unsigned char buf[w];
178 - unsigned char *p = lfb + x + y * xres, *p1, *p2;
179 + unsigned char buf[w*4];
180 + unsigned char *p = lfb + x*4 + y * xres, *p1, *p2;
183 for (h1 = 0 ; h1 < h/2 ; h1++)
186 p2 = (p+(h-(h1+1))*xres);
190 + memcpy(buf,p1,w*4);
192 + memcpy(p2,buf,w*4);
196 @@ -3683,7 +3727,7 @@
200 - unsigned char* p = lfb + *pPosX + PosY* xres;
201 + unsigned char* p = lfb + (*pPosX)*4 + PosY* xres;
202 for (y=0; y<fontheight;y++)
204 for (f=0; f<factor; f++)
205 @@ -3691,7 +3735,7 @@
206 for (x=0; x<curfontwidth*xfactor;x++)
208 c = (y&4 ? (x/3)&1 :((x+3)/3)&1);
209 - *(p+x) = (c ? fgcolor : bgcolor);
210 + memcpy((p+x*4),bgra[(c ? fgcolor : bgcolor)],4);
214 @@ -3729,7 +3773,7 @@
216 axdrcs[12] = curfontwidth; /* adjust last x-offset according to position, FIXME: double width */
217 tuxtxt_RenderDRCS(xres,p,
218 - lfb + *pPosX + PosY * xres,
219 + lfb + (*pPosX)*4 + PosY * xres,
220 axdrcs, fgcolor, bgcolor);
223 @@ -3996,12 +4040,12 @@
224 void tuxtxt_FillBorder(tstRenderInfo* renderinfo, int color)
226 int ys = renderinfo->var_screeninfo.yres-renderinfo->var_screeninfo.yoffset;
227 - tuxtxt_FillRect(renderinfo->lfb,renderinfo->var_screeninfo.xres,0 , ys ,renderinfo->StartX ,renderinfo->var_screeninfo.yres ,color);
228 - tuxtxt_FillRect(renderinfo->lfb,renderinfo->var_screeninfo.xres,renderinfo->StartX, ys ,renderinfo->displaywidth,renderinfo->StartY ,color);
229 - tuxtxt_FillRect(renderinfo->lfb,renderinfo->var_screeninfo.xres,renderinfo->StartX, ys+renderinfo->StartY+25*renderinfo->fontheight,renderinfo->displaywidth,renderinfo->var_screeninfo.yres-(renderinfo->StartY+25*renderinfo->fontheight),color);
230 + tuxtxt_FillRect(renderinfo->lfb,renderinfo->fix_screeninfo.line_length,0 , ys ,renderinfo->StartX ,renderinfo->var_screeninfo.yres ,color);
231 + tuxtxt_FillRect(renderinfo->lfb,renderinfo->fix_screeninfo.line_length,renderinfo->StartX, ys ,renderinfo->displaywidth,renderinfo->StartY ,color);
232 + tuxtxt_FillRect(renderinfo->lfb,renderinfo->fix_screeninfo.line_length,renderinfo->StartX, ys+renderinfo->StartY+25*renderinfo->fontheight,renderinfo->displaywidth,renderinfo->var_screeninfo.yres-(renderinfo->StartY+25*renderinfo->fontheight),color);
234 if (renderinfo->screenmode == 0 )
235 - tuxtxt_FillRect(renderinfo->lfb,renderinfo->var_screeninfo.xres,renderinfo->StartX+renderinfo->displaywidth, ys,renderinfo->var_screeninfo.xres-(renderinfo->StartX+renderinfo->displaywidth),renderinfo->var_screeninfo.yres ,color);
236 + tuxtxt_FillRect(renderinfo->lfb,renderinfo->fix_screeninfo.line_length,renderinfo->StartX+renderinfo->displaywidth, ys,renderinfo->var_screeninfo.xres-(renderinfo->StartX+renderinfo->displaywidth),renderinfo->var_screeninfo.yres ,color);
240 @@ -4037,12 +4081,12 @@
242 void tuxtxt_ClearBB(tstRenderInfo* renderinfo,int color)
244 - memset(renderinfo->lfb + (renderinfo->var_screeninfo.yres-renderinfo->var_screeninfo.yoffset )*renderinfo->var_screeninfo.xres, color, renderinfo->var_screeninfo.xres*renderinfo->var_screeninfo.yres);
245 + tuxtxt_FillRect(renderinfo->lfb,renderinfo->fix_screeninfo.line_length,0, renderinfo->var_screeninfo.yres - renderinfo->var_screeninfo.yoffset, renderinfo->var_screeninfo.xres, renderinfo->var_screeninfo.yres, color);
248 void tuxtxt_ClearFB(tstRenderInfo* renderinfo,int color)
250 - memset(renderinfo->lfb + renderinfo->var_screeninfo.xres*renderinfo->var_screeninfo.yoffset, color, renderinfo->var_screeninfo.xres*renderinfo->var_screeninfo.yres);
251 + tuxtxt_FillRect(renderinfo->lfb,renderinfo->fix_screeninfo.line_length,0, renderinfo->var_screeninfo.yoffset, renderinfo->var_screeninfo.xres, renderinfo->var_screeninfo.yres, color);
254 int tuxtxt_GetCurFontWidth(tstRenderInfo* renderinfo)
255 @@ -4079,7 +4123,7 @@
256 renderinfo->PosX += t;
257 int curfontwidth2 = tuxtxt_GetCurFontWidth(renderinfo);
258 renderinfo->PosX -= t;
259 - int alphachar = tuxtxt_RenderChar(renderinfo->lfb+(yoffset+renderinfo->StartY)*renderinfo->var_screeninfo.xres, renderinfo->var_screeninfo.xres,Char, &renderinfo->PosX, renderinfo->PosY-renderinfo->StartY, Attribute, zoom, curfontwidth, curfontwidth2, renderinfo->fontheight, renderinfo->transpmode,renderinfo->axdrcs, renderinfo->ascender);
260 + int alphachar = tuxtxt_RenderChar(renderinfo->lfb+(yoffset+renderinfo->StartY)*renderinfo->fix_screeninfo.line_length, renderinfo->fix_screeninfo.line_length, Char, &renderinfo->PosX, renderinfo->PosY-renderinfo->StartY, Attribute, zoom, curfontwidth, curfontwidth2, renderinfo->fontheight, renderinfo->transpmode,renderinfo->axdrcs, renderinfo->ascender);
261 if (alphachar <= 0) return;
263 if (zoom && Attribute->doubleh)
264 @@ -4112,7 +4156,7 @@
266 printf("TuxTxt <FT_Get_Char_Index for Char %x \"%c\" failed\n", alphachar, alphachar);
268 - tuxtxt_FillRect(renderinfo->lfb,renderinfo->var_screeninfo.xres,renderinfo->PosX, renderinfo->PosY + yoffset, curfontwidth, factor*renderinfo->fontheight, bgcolor);
269 + tuxtxt_FillRect(renderinfo->lfb,renderinfo->fix_screeninfo.line_length,renderinfo->PosX, renderinfo->PosY + yoffset, curfontwidth, factor*renderinfo->fontheight, bgcolor);
270 renderinfo->PosX += curfontwidth;
273 @@ -4127,7 +4171,7 @@
274 printf("TuxTxt <FTC_SBitCache_Lookup: 0x%x> c%x a%x g%x w%d h%d x%d y%d\n",
275 error, alphachar, Attribute, glyph, curfontwidth, renderinfo->fontheight, renderinfo->PosX, renderinfo->PosY);
277 - tuxtxt_FillRect(renderinfo->lfb,renderinfo->var_screeninfo.xres,renderinfo->PosX, renderinfo->PosY + yoffset, curfontwidth, renderinfo->fontheight, bgcolor);
278 + tuxtxt_FillRect(renderinfo->lfb,renderinfo->fix_screeninfo.line_length,renderinfo->PosX, renderinfo->PosY + yoffset, curfontwidth, renderinfo->fontheight, bgcolor);
279 renderinfo->PosX += curfontwidth;
282 @@ -4188,13 +4232,13 @@
286 - tuxtxt_FillRect(renderinfo->lfb,renderinfo->var_screeninfo.xres,renderinfo->PosX, renderinfo->PosY + yoffset, curfontwidth, Row, bgcolor); /* fill upper margin */
287 + tuxtxt_FillRect(renderinfo->lfb,renderinfo->fix_screeninfo.line_length,renderinfo->PosX, renderinfo->PosY + yoffset, curfontwidth, Row, bgcolor); /* fill upper margin */
289 if (renderinfo->ascender - renderinfo->sbit->top + renderinfo->TTFShiftY + he > renderinfo->fontheight)
290 he = renderinfo->fontheight - renderinfo->ascender + renderinfo->sbit->top - renderinfo->TTFShiftY; /* limit char height to defined/calculated fontheight */
291 if (he < 0) he = renderinfo->fontheight;
293 - p = renderinfo->lfb + renderinfo->PosX + (yoffset + renderinfo->PosY + Row) * renderinfo->var_screeninfo.xres; /* running pointer into framebuffer */
294 + p = renderinfo->lfb + renderinfo->PosX*4 + (yoffset + renderinfo->PosY + Row) * renderinfo->fix_screeninfo.line_length; /* running pointer into framebuffer */
295 for (Row = he; Row; Row--) /* row counts up, but down may be a little faster :) */
297 int pixtodo = (renderinfo->usettf ? renderinfo->sbit->width : curfontwidth);
298 @@ -4203,8 +4247,8 @@
299 for (Bit = xfactor * (renderinfo->sbit->left + renderinfo->TTFShiftX); Bit > 0; Bit--) /* fill left margin */
301 for (f = factor-1; f >= 0; f--)
302 - *(p + f*renderinfo->var_screeninfo.xres) = bgcolor;
304 + memcpy((p + f*renderinfo->fix_screeninfo.line_length),bgra[bgcolor],4);/*bgcolor*/
306 if (!renderinfo->usettf)
309 @@ -4224,14 +4268,14 @@
312 for (f = factor-1; f >= 0; f--)
313 - *(p + f*renderinfo->var_screeninfo.xres) = color;
315 + memcpy((p + f*renderinfo->fix_screeninfo.line_length),bgra[color],4);
318 if (xfactor > 1) /* double width */
320 for (f = factor-1; f >= 0; f--)
321 - *(p + f*renderinfo->var_screeninfo.xres) = color;
323 + memcpy((p + f*renderinfo->fix_screeninfo.line_length),bgra[color],4);
325 if (!renderinfo->usettf)
328 @@ -4242,17 +4286,17 @@
329 Bit > 0; Bit--) /* fill rest of char width */
331 for (f = factor-1; f >= 0; f--)
332 - *(p + f*renderinfo->var_screeninfo.xres) = bgcolor;
334 + memcpy((p + f*renderinfo->fix_screeninfo.line_length),bgra[bgcolor],4);
338 - p = pstart + factor*renderinfo->var_screeninfo.xres;
339 + p = pstart + factor*renderinfo->fix_screeninfo.line_length;
342 Row = renderinfo->ascender - renderinfo->sbit->top + he + renderinfo->TTFShiftY;
343 - tuxtxt_FillRect(renderinfo->lfb,renderinfo->var_screeninfo.xres,renderinfo->PosX, renderinfo->PosY + yoffset + Row*factor, curfontwidth, (renderinfo->fontheight - Row) * factor, bgcolor); /* fill lower margin */
344 + tuxtxt_FillRect(renderinfo->lfb,renderinfo->fix_screeninfo.line_length,renderinfo->PosX, renderinfo->PosY + yoffset + Row*factor, curfontwidth, (renderinfo->fontheight - Row) * factor, bgcolor); /* fill lower margin */
345 if (Attribute->underline)
346 - tuxtxt_FillRect(renderinfo->lfb,renderinfo->var_screeninfo.xres,renderinfo->PosX, renderinfo->PosY + yoffset + (renderinfo->fontheight-2)* factor, curfontwidth,2*factor, fgcolor); /* underline char */
347 + tuxtxt_FillRect(renderinfo->lfb,renderinfo->fix_screeninfo.line_length,renderinfo->PosX, renderinfo->PosY + yoffset + (renderinfo->fontheight-2)* factor, curfontwidth,2*factor, fgcolor); /* underline char */
349 renderinfo->PosX += curfontwidth;
350 renderinfo->TTFShiftY = backupTTFshiftY; // restore TTFShiftY
351 @@ -4300,9 +4344,8 @@
353 void tuxtxt_SwitchScreenMode(tstRenderInfo* renderinfo,int newscreenmode)
355 -#if HAVE_DVB_API_VERSION >= 3
356 struct v4l2_format format;
359 /* reset transparency mode */
360 if (renderinfo->transpmode)
361 renderinfo->transpmode = 0;
362 @@ -4370,42 +4413,53 @@
364 tuxtxt_setfontwidth(renderinfo,fw);
366 -#if HAVE_DVB_API_VERSION < 3
367 - avia_pig_hide(renderinfo->pig);
368 - avia_pig_set_pos(renderinfo->pig, tx, ty);
369 - avia_pig_set_size(renderinfo->pig, tw, th);
370 - avia_pig_set_stack(renderinfo->pig, 2);
371 - avia_pig_show(renderinfo->pig);
374 - ioctl(renderinfo->pig, VIDIOC_OVERLAY, &sm);
376 - ioctl(renderinfo->pig, VIDIOC_G_FMT, &format);
377 - format.type = V4L2_BUF_TYPE_VIDEO_OVERLAY;
378 - format.fmt.win.w.left = tx;
379 - format.fmt.win.w.top = ty;
380 - format.fmt.win.w.width = tw;
381 - format.fmt.win.w.height = th;
382 - ioctl(renderinfo->pig, VIDIOC_S_FMT, &format);
383 - ioctl(renderinfo->pig, VIDIOC_OVERLAY, &sm);
385 - ioctl(renderinfo->avs, AVSIOSSCARTPIN8, &fncmodes[renderinfo->screen_mode2]);
386 - ioctl(renderinfo->saa, SAAIOSWSS, &saamodes[renderinfo->screen_mode2]);
387 + // Video picture scale/pos for e2
389 + for (i=0; i<4; ++i)
391 + char *targets[]={"left", "top", "width", "height"};
392 + char filename[128];
393 + snprintf(filename, 128, "/proc/stb/vmpeg/%d/dst_%s", 0, targets[i]);
394 + FILE *f = fopen(filename, "w");
400 + case 0: val = tx; break;
401 + case 1: val = ty; break;
402 + case 2: val = tw; break;
403 + case 3: val = th; break;
405 + fprintf(f, "%08x\n", val);
409 + writeproc("/proc/stb/avs/0/sb", fncmodes[renderinfo->screen_mode2]);
410 + writeproc("/proc/stb/denc/0/wss", saamodes[renderinfo->screen_mode2]);
414 -#if HAVE_DVB_API_VERSION < 3
415 - avia_pig_hide(renderinfo->pig);
417 - ioctl(renderinfo->pig, VIDIOC_OVERLAY, &renderinfo->screenmode);
419 + // Video picture scale/pos for e2
421 + for (i=0; i<4; ++i)
423 + char *targets[]={"left", "top", "width", "height"};
424 + char filename[128];
425 + snprintf(filename, 128, "/proc/stb/vmpeg/%d/dst_%s", 0, targets[i]);
426 + FILE *f = fopen(filename, "w");
429 + fprintf(f, "%08x\n", 0);
433 tuxtxt_setfontwidth(renderinfo,renderinfo->fontwidth_normal);
434 renderinfo->displaywidth= (renderinfo->ex-renderinfo->sx);
435 renderinfo->StartX = renderinfo->sx; //+ (ex-sx - 40*fontwidth) / 2; /* center screen */
437 - ioctl(renderinfo->avs, AVSIOSSCARTPIN8, &fncmodes[renderinfo->screen_mode1]);
438 - ioctl(renderinfo->saa, SAAIOSWSS, &saamodes[renderinfo->screen_mode1]);
439 + writeproc("/proc/stb/avs/0/sb", fncmodes[renderinfo->screen_mode1]);
440 + writeproc("/proc/stb/denc/0/wss", saamodes[renderinfo->screen_mode1]);
444 @@ -4431,7 +4485,7 @@
445 if (renderinfo->boxed)
447 renderinfo->PosX = renderinfo->StartX + column*width;
448 - tuxtxt_FillRect(renderinfo->lfb,renderinfo->var_screeninfo.xres,renderinfo->PosX, renderinfo->PosY+yoffset, renderinfo->displaywidth, renderinfo->fontheight, tuxtxt_color_transp);
449 + tuxtxt_FillRect(renderinfo->lfb,renderinfo->fix_screeninfo.line_length,renderinfo->PosX, renderinfo->PosY+yoffset, renderinfo->displaywidth, renderinfo->fontheight, tuxtxt_color_transp);
453 @@ -4442,7 +4496,7 @@
455 if (l > 9) /* smaller font, if no space for one half space at front and end */
456 tuxtxt_setfontwidth(renderinfo,oldfontwidth * 10 / (l+1));
457 - tuxtxt_FillRect(renderinfo->lfb,renderinfo->var_screeninfo.xres,renderinfo->PosX, renderinfo->PosY+yoffset, width+(renderinfo->displaywidth%4), renderinfo->fontheight, tuxtxt_atrtable[ATR_L250 + column].bg);
458 + tuxtxt_FillRect(renderinfo->lfb,renderinfo->fix_screeninfo.line_length,renderinfo->PosX, renderinfo->PosY+yoffset, width+(renderinfo->displaywidth%4), renderinfo->fontheight, tuxtxt_atrtable[ATR_L250 + column].bg);
459 renderinfo->PosX += ((width) - (l*renderinfo->fontwidth+l*renderinfo->fontwidth/abx))/2; /* center */
460 for (p = tuxtxt_cache.adip[linkpage]; *p; p++)
461 tuxtxt_RenderCharBB(renderinfo,*p, &tuxtxt_atrtable[ATR_L250 + column]);
462 @@ -4451,7 +4505,7 @@
463 else /* display number */
465 renderinfo->PosX = renderinfo->StartX + column*width;
466 - tuxtxt_FillRect(renderinfo->lfb,renderinfo->var_screeninfo.xres,renderinfo->PosX, renderinfo->PosY+yoffset, renderinfo->displaywidth+renderinfo->sx-renderinfo->PosX, renderinfo->fontheight, tuxtxt_atrtable[ATR_L250 + column].bg);
467 + tuxtxt_FillRect(renderinfo->lfb,renderinfo->fix_screeninfo.line_length,renderinfo->PosX, renderinfo->PosY+yoffset, renderinfo->displaywidth+renderinfo->sx-renderinfo->PosX, renderinfo->fontheight, tuxtxt_atrtable[ATR_L250 + column].bg);
468 if (linkpage < tuxtxt_cache.page)
471 @@ -4620,7 +4674,7 @@
472 void tuxtxt_CopyBB2FB(tstRenderInfo* renderinfo)
474 unsigned char *src, *dst, *topsrc;
475 - int fillcolor, i, screenwidth;
476 + int fillcolor, i, screenwidth, swtmp;
479 if (!renderinfo->pagecatching)
480 @@ -4636,8 +4690,8 @@
481 if (ioctl(renderinfo->fb, FBIOPAN_DISPLAY, &renderinfo->var_screeninfo) == -1)
482 perror("TuxTxt <FBIOPAN_DISPLAY>");
484 - if (renderinfo->StartX > 0 && *renderinfo->lfb != *(renderinfo->lfb + renderinfo->var_screeninfo.xres * renderinfo->var_screeninfo.yres)) /* adapt background of backbuffer if changed */
485 - tuxtxt_FillBorder(renderinfo,*(renderinfo->lfb + renderinfo->var_screeninfo.xres * renderinfo->var_screeninfo.yoffset));
486 + if (renderinfo->StartX > 0 && *renderinfo->lfb != *(renderinfo->lfb + renderinfo->fix_screeninfo.line_length * renderinfo->var_screeninfo.yres)) /* adapt background of backbuffer if changed */
487 + tuxtxt_FillBorder(renderinfo,*(renderinfo->lfb + renderinfo->fix_screeninfo.line_length * renderinfo->var_screeninfo.yoffset));
488 // ClearBB(*(lfb + renderinfo->var_screeninfo.xres * renderinfo->var_screeninfo.yoffset));
490 if (renderinfo->clearbbcolor >= 0)
491 @@ -4648,18 +4702,18 @@
495 - src = dst = topsrc = renderinfo->lfb + renderinfo->StartY*renderinfo->var_screeninfo.xres;
496 + src = dst = topsrc = renderinfo->lfb + renderinfo->StartY*renderinfo->fix_screeninfo.line_length;
499 if (renderinfo->var_screeninfo.yoffset)
500 - dst += renderinfo->var_screeninfo.xres * renderinfo->var_screeninfo.yres;
501 + dst += renderinfo->fix_screeninfo.line_length * renderinfo->var_screeninfo.yres;
504 - src += renderinfo->var_screeninfo.xres * renderinfo->var_screeninfo.yres;
505 - topsrc += renderinfo->var_screeninfo.xres * renderinfo->var_screeninfo.yres;
506 + src += renderinfo->fix_screeninfo.line_length * renderinfo->var_screeninfo.yres;
507 + topsrc += renderinfo->fix_screeninfo.line_length * renderinfo->var_screeninfo.yres;
509 if (!renderinfo->pagecatching )
510 - memcpy(dst+(24*renderinfo->fontheight)*renderinfo->var_screeninfo.xres, src + (24*renderinfo->fontheight)*renderinfo->var_screeninfo.xres, renderinfo->var_screeninfo.xres*renderinfo->fontheight); /* copy line25 in normal height */
511 + memcpy(dst+(24*renderinfo->fontheight)*renderinfo->fix_screeninfo.line_length, src + (24*renderinfo->fontheight)*renderinfo->fix_screeninfo.line_length, renderinfo->fix_screeninfo.line_length*renderinfo->fontheight); /* copy line25 in normal height */
513 if (renderinfo->transpmode)
514 fillcolor = tuxtxt_color_transp;
515 @@ -4667,94 +4721,81 @@
516 fillcolor = tuxtxt_cache.FullScrColor;
518 if (renderinfo->zoommode == 2)
519 - src += 12*renderinfo->fontheight*renderinfo->var_screeninfo.xres;
520 + src += 12*renderinfo->fontheight*renderinfo->fix_screeninfo.line_length;
522 if (renderinfo->screenmode == 1) /* copy topmenu in normal height (since PIG also keeps dimensions) */
524 unsigned char *topdst = dst;
526 - screenwidth = TV43STARTX;
527 + screenwidth = (TV43STARTX) * 4;
529 topsrc += screenwidth;
530 topdst += screenwidth;
531 for (i=0; i < 24*renderinfo->fontheight; i++)
533 memcpy(topdst, topsrc,renderinfo->ex-screenwidth);
534 - topdst += renderinfo->var_screeninfo.xres;
535 - topsrc += renderinfo->var_screeninfo.xres;
536 + topdst += renderinfo->fix_screeninfo.line_length;
537 + topsrc += renderinfo->fix_screeninfo.line_length;
540 else if (renderinfo->screenmode == 2)
541 - screenwidth = TV169FULLSTARTX;
542 + screenwidth = (TV169FULLSTARTX) * 4;
544 - screenwidth = renderinfo->var_screeninfo.xres;
545 + screenwidth = renderinfo->fix_screeninfo.line_length;
547 for (i = renderinfo->StartY; i>0;i--)
549 - memset(dst - i*renderinfo->var_screeninfo.xres, fillcolor, screenwidth);
550 + for (swtmp=0; swtmp<screenwidth/4; swtmp++)
552 + memcpy(dst - i*renderinfo->fix_screeninfo.line_length+swtmp*4, bgra[fillcolor], 4);
556 for (i = 12*renderinfo->fontheight; i; i--)
558 memcpy(dst, src, screenwidth);
559 - dst += renderinfo->var_screeninfo.xres;
560 + dst += renderinfo->fix_screeninfo.line_length;
561 memcpy(dst, src, screenwidth);
562 - dst += renderinfo->var_screeninfo.xres;
563 - src += renderinfo->var_screeninfo.xres;
564 + dst += renderinfo->fix_screeninfo.line_length;
565 + src += renderinfo->fix_screeninfo.line_length;
568 // if (!pagecatching )
569 // memcpy(dst, lfb + (StartY+24*fontheight)*renderinfo->var_screeninfo.xres, renderinfo->var_screeninfo.xres*fontheight); /* copy line25 in normal height */
570 - for (i = renderinfo->var_screeninfo.yres - renderinfo->StartY - 25*renderinfo->fontheight; i >= 0;i--)
572 - memset(dst + renderinfo->var_screeninfo.xres*(renderinfo->fontheight+i), fillcolor, screenwidth);
574 + dst -= renderinfo->fix_screeninfo.line_length;
576 + unsigned char linebuf[screenwidth];
577 + for (swtmp=0; swtmp < screenwidth/4;swtmp++)
578 + memcpy(linebuf+swtmp*4, bgra[fillcolor], 4);
579 + for (i = renderinfo->var_screeninfo.yres - renderinfo->StartY - 25 * renderinfo->fontheight; i >= 0;i--)
580 + memcpy(dst + renderinfo->fix_screeninfo.line_length*(renderinfo->fontheight+i), linebuf, screenwidth);
583 void tuxtxt_setcolors(tstRenderInfo* renderinfo,unsigned short *pcolormap, int offset, int number)
585 - struct fb_cmap colormap_0 = {0, tuxtxt_color_SIZECOLTABLE, renderinfo->rd0, renderinfo->gn0, renderinfo->bl0, renderinfo->tr0};
588 int j = offset; /* index in global color table */
590 - unsigned short t = renderinfo->tr0[tuxtxt_color_transp2];
591 - renderinfo->tr0[tuxtxt_color_transp2] = (renderinfo->trans_mode+7)<<11 | 0x7FF;
592 -#ifndef HAVE_DREAMBOX_HARDWARE
593 - /* "correct" semi-transparent for Nokia (GTX only allows 2(?) levels of transparency) */
594 - if (tuxbox_get_vendor() == TUXBOX_VENDOR_NOKIA)
595 - renderinfo->tr0[tuxtxt_color_transp2] = 0xFFFF;
597 - if (t != renderinfo->tr0[tuxtxt_color_transp2]) changed = 1;
598 + trans_tmp=25-renderinfo->trans_mode;
600 + bgra[tuxtxt_color_transp2][3]=((trans_tmp+7)<<11 | 0x7FF)>>8;
602 for (i = 0; i < number; i++)
604 - int r = (pcolormap[i] << 12) & 0xf000;
605 - int g = (pcolormap[i] << 8) & 0xf000;
606 - int b = (pcolormap[i] << 4) & 0xf000;
608 + int r = (pcolormap[i] << 12 & 0xF000) >> 8;
609 + int g = (pcolormap[i] << 8 & 0xF000) >> 8;
610 + int b = (pcolormap[i] << 4 & 0xF000) >> 8;
612 r = (r * (0x3f+(renderinfo->color_mode<<3))) >> 8;
613 g = (g * (0x3f+(renderinfo->color_mode<<3))) >> 8;
614 b = (b * (0x3f+(renderinfo->color_mode<<3))) >> 8;
615 - if (renderinfo->rd0[j] != r)
617 - renderinfo->rd0[j] = r;
620 - if (renderinfo->gn0[j] != g)
622 - renderinfo->gn0[j] = g;
625 - if (renderinfo->bl0[j] != b)
627 - renderinfo->bl0[j] = b;
638 - if (ioctl(renderinfo->fb, FBIOPUTCMAP, &colormap_0) == -1)
639 - perror("TuxTxt <FBIOPUTCMAP>");
642 /******************************************************************************
643 @@ -4968,11 +5009,11 @@
645 for (row = 0; row < DRCSROWS; row++)
646 for (col = 0; col < DRCSCOLS; col++)
647 - tuxtxt_RenderDRCS(renderinfo->var_screeninfo.xres,
648 + tuxtxt_RenderDRCS(renderinfo->fix_screeninfo.line_length,
649 renderinfo->page_char + 20 * (DRCSCOLS * row + col + 2),
651 - + (renderinfo->StartY + renderinfo->fontheight + DRCSYSPC * row + renderinfo->var_screeninfo.yres - renderinfo->var_screeninfo.yoffset) * renderinfo->var_screeninfo.xres
652 - + renderinfo->StartX + DRCSXSPC * col,
653 + + (renderinfo->StartY + renderinfo->fontheight + DRCSYSPC * row + renderinfo->var_screeninfo.yres - renderinfo->var_screeninfo.yoffset) * renderinfo->fix_screeninfo.line_length
654 + + (renderinfo->StartX + DRCSXSPC * col)*4,
655 ax, tuxtxt_color_white, tuxtxt_color_black);
657 memset(renderinfo->page_char + 40, 0xff, 24*40); /* don't render any char below row 0 */
658 @@ -5062,13 +5103,13 @@
659 renderinfo->pageinfo = p;
660 renderinfo->boxed = p->boxed;
662 + if (tuxtxt_cache.colortable) /* as late as possible to shorten the time the old page is displayed with the new colors */
663 + tuxtxt_setcolors(renderinfo,tuxtxt_cache.colortable, 16, 16); /* set colors for CLUTs 2+3 */
664 if (renderinfo->boxed || renderinfo->transpmode)
665 // tuxtxt_cache.FullScrColor = tuxtxt_color_transp;
666 tuxtxt_FillBorder(renderinfo,tuxtxt_color_transp);
668 tuxtxt_FillBorder(renderinfo,tuxtxt_cache.FullScrColor);
669 - if (tuxtxt_cache.colortable) /* as late as possible to shorten the time the old page is displayed with the new colors */
670 - tuxtxt_setcolors(renderinfo,tuxtxt_cache.colortable, 16, 16); /* set colors for CLUTs 2+3 */
674 @@ -5408,39 +5449,6 @@
675 renderinfo->page_atrb[i].doublew = 0;
676 renderinfo->page_atrb[i].IgnoreAtBlackBgSubst = 0;
681 - if ((renderinfo->avs = open(AVS, O_RDWR)) == -1)
683 - perror("TuxTxt <open AVS>");
684 - FTC_Manager_Done(renderinfo->manager);
685 - FT_Done_FreeType(renderinfo->library);
689 - ioctl(renderinfo->avs, AVSIOGSCARTPIN8, &renderinfo->fnc_old);
690 - ioctl(renderinfo->avs, AVSIOSSCARTPIN8, &fncmodes[renderinfo->screen_mode1]);
692 - if ((renderinfo->saa = open(SAA, O_RDWR)) == -1)
694 - perror("TuxTxt <open SAA>");
695 - FTC_Manager_Done(renderinfo->manager);
696 - FT_Done_FreeType(renderinfo->library);
700 - ioctl(renderinfo->saa, SAAIOGWSS, &renderinfo->saa_old);
701 - ioctl(renderinfo->saa, SAAIOSWSS, &saamodes[renderinfo->screen_mode1]);
704 - if ((renderinfo->pig = open(PIG, O_RDWR)) == -1)
706 - perror("TuxTxt <open PIG>");
707 - FTC_Manager_Done(renderinfo->manager);
708 - FT_Done_FreeType(renderinfo->library);
713 /******************************************************************************
714 @@ -5489,7 +5497,7 @@
715 FT_Done_FreeType(renderinfo->library);
716 renderinfo->manager = 0;
717 renderinfo->library = 0;
718 - tuxtxt_ClearFB(renderinfo,renderinfo->previousbackcolor);
719 + memset(renderinfo->lfb, 0, renderinfo->fix_screeninfo.smem_len);
720 /* unmap framebuffer */
721 munmap(renderinfo->lfb, renderinfo->fix_screeninfo.smem_len);
722 printf("[TTX] Rendering ended\n");
723 diff -Naur libs-org/libtuxtxt/tuxtxt_def.h libs/libtuxtxt/tuxtxt_def.h
724 --- libs-org/libtuxtxt/tuxtxt_def.h 2010-03-06 10:51:52.000000000 +0100
725 +++ libs/libtuxtxt/tuxtxt_def.h 2010-03-06 10:55:25.000000000 +0100
727 #define hold_mosaic 0x1E
728 #define release_mosaic 0x1F
730 -const int fncmodes[] = {AVS_FNCOUT_EXT43, AVS_FNCOUT_EXT169};
731 -const int saamodes[] = {SAA_WSS_43F, SAA_WSS_169F};
732 +extern unsigned char bgra[][4];
734 +const char * fncmodes[] = {"12", "6"};
735 +const char * saamodes[] = {"4:3_full_format", "16:9_full_format"};
737 typedef enum /* object type */