From 7303c1c4dd220ea313c18c6601aeff5b79cb1f4c Mon Sep 17 00:00:00 2001 From: seife Date: Sat, 1 Jan 2011 14:02:21 +0000 Subject: [PATCH] tuxtxt: better usage of screen space for PIP mode for the PIP mode (text with toptext list on the right and small livetv picture at bottom right) the screen space was wasted by keeping the overall aspect ratio (text + toplist + PIP) 4:3. Change this to keep the text AR to 4:3, shifting it to the left and adding the toplist and PIP on the right to completely fill the 16:9 screen. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@986 e54a6e83-5905-42d5-8d5c-058d10e6a962 --- lib/libtuxtxt/tuxtxt.cpp | 67 ++++++++++++++++++++++++++++------------ lib/libtuxtxt/tuxtxt.h | 17 +++++----- 2 files changed, 57 insertions(+), 27 deletions(-) diff --git a/lib/libtuxtxt/tuxtxt.cpp b/lib/libtuxtxt/tuxtxt.cpp index 5d0351a31..166848985 100644 --- a/lib/libtuxtxt/tuxtxt.cpp +++ b/lib/libtuxtxt/tuxtxt.cpp @@ -1665,7 +1665,9 @@ int tuxtx_main(int _rc, int pid, int page) int w = CFrameBuffer::getInstance()->getScreenWidth(); int h = CFrameBuffer::getInstance()->getScreenHeight(); - int tx = (w - (h * 4 / 3)) / 2; + int tx = 0; + if (!screen_mode1) + tx = (w - (w * 3/4)) / 2; sx = x + tx; ex = x + w - tx; sy = y; @@ -2011,6 +2013,7 @@ int Init() national_subset_secondary = NAT_DEFAULT; fontwidth = 0; /* initialize at first setting */ + tv_pip_y = 0; /* calculate font dimensions */ displaywidth = (ex-sx); @@ -2018,7 +2021,7 @@ int Init() fontwidth_normal = (ex-sx) / 40; setfontwidth(fontwidth_normal); fontwidth_topmenumain = (TV43STARTX-sx) / 40; - fontwidth_topmenusmall = (ex- TOPMENUSTARTX) / TOPMENUCHARS; + fontwidth_topmenusmall = (TVENDX - TOPMENUSTARTX) / TOPMENUCHARS; //fontwidth_small = (TV169FULLSTARTX-sx) / 40; fontwidth_small = (CFrameBuffer::getInstance()->getScreenWidth()/2) / 40; ymosaic[0] = 0; /* y-offsets for 2*3 mosaic */ @@ -3935,14 +3938,33 @@ void SwitchScreenMode(int newscreenmode) if (screenmode==1) /* split with topmenu */ { + int x = CFrameBuffer::getInstance()->getScreenX(); + int w = CFrameBuffer::getInstance()->getScreenWidth(); + int h = CFrameBuffer::getInstance()->getScreenHeight(); fw = fontwidth_topmenumain; fh = fontheight; - displaywidth= (TV43STARTX -sx); + + tx = 0; /* split means we start at the left edge */ + sx = x; + /* width of the TTX display: + the TTX display shall appear with 4:3 aspect ratio + => width = h * 4/3 + => but the display might not have square pixels + ==> correction factor w/h / (16/9) for a 16:9 display + ===> width = h * 4/3 * w/h * 9/16; + = h * w / h * 4*9/3/16 + = w * 3 / 4 + */ + ex = x + w * 3/4; + + displaywidth = (ex - sx); + StartX = sx; //+ (((ex-sx) - (40*fw+2+tw)) / 2); /* center screen */ - tx = TV43STARTX; - ty = TV43STARTY; - tw = TV43WIDTH; - th = TV43HEIGHT; + tx = ex + 2; + tw = x + w - tx; + th = tw * h/w; /* hardcoded 16:9 PIP */ + ty = StartY + 25 * fontheight - th; + tv_pip_y = ty; } else /* 2: split with full height tv picture */ { @@ -3982,12 +4004,16 @@ void SwitchScreenMode(int newscreenmode) int x = CFrameBuffer::getInstance()->getScreenX(); int w = CFrameBuffer::getInstance()->getScreenWidth(); - int h = CFrameBuffer::getInstance()->getScreenHeight(); - - int tx = (w - (h * 4 / 3)) / 2; + //int h = CFrameBuffer::getInstance()->getScreenHeight(); + int tx = 0; + /* see comment above on the TTX window dimensions */ + if (!screen_mode1) + tx = (w - (w * 3/4)) / 2; sx = x + tx; ex = x + w - tx; + /* if screen_mode1 changed, then recalculate fontwidth */ + fontwidth_normal = (ex-sx) / 40; setfontwidth(fontwidth_normal); displaywidth= (ex-sx); StartX = sx; //+ (ex-sx - 40*fontwidth) / 2; /* center screen */ @@ -5176,15 +5202,18 @@ void RenderPage() fontwidth_normal = (ex-sx) / (40-nofirst); setfontwidth(fontwidth_normal); fontwidth_topmenumain = (TV43STARTX-sx) / (40-nofirst); - fontwidth_topmenusmall = (ex- TOPMENUSTARTX) / TOPMENUCHARS; + fontwidth_topmenusmall = (TVENDX - TOPMENUSTARTX) / TOPMENUCHARS; //fontwidth_small = (TV169FULLSTARTX-sx) / (40-nofirst); fontwidth_small = (CFrameBuffer::getInstance()->getScreenWidth()/2) / (40-nofirst); switch(screenmode) { - case 0: setfontwidth(fontwidth_normal) ; displaywidth= (ex -sx);break; - case 1: setfontwidth(fontwidth_topmenumain); displaywidth= (TV43STARTX -sx);break; - //case 2: setfontwidth(fontwidth_small) ; displaywidth= (TV169FULLSTARTX-sx);break; - case 2: setfontwidth(fontwidth_small) ; displaywidth= (CFrameBuffer::getInstance()->getScreenWidth()/2);break; + case 0: + case 1: setfontwidth(fontwidth_normal); + displaywidth = ex - sx; + break; + case 2: setfontwidth(fontwidth_small); + displaywidth = CFrameBuffer::getInstance()->getScreenWidth() / 2; + break; } if (transpmode || (boxed && !screenmode)) { @@ -5454,21 +5483,21 @@ void CreateLine25() #endif prev10done = next10done = next100done = 0; - while (PosY <= (TOPMENUENDY-fontheight)) + while (PosY <= (tv_pip_y - fontheight)) { attr = 0; attrcol = &atrtable[ATR_WB]; - if (!next100done && (PosY > (TOPMENUENDY - 2*fontheight))) /* last line */ + if (!next100done && (PosY > (tv_pip_y - 2*fontheight))) /* last line */ { attrcol = &atrtable[ATR_L253]; current = next_100; } - else if (!next10done && (PosY > (TOPMENUENDY - 3*fontheight))) /* line before */ + else if (!next10done && (PosY > (tv_pip_y - 3*fontheight))) /* line before */ { attrcol = &atrtable[ATR_L252]; current = next_10; } - else if (!prev10done && (PosY > (TOPMENUENDY - 4*fontheight))) /* line before */ + else if (!prev10done && (PosY > (tv_pip_y - 4*fontheight))) /* line before */ { attrcol = &atrtable[ATR_L251]; current = prev_10; diff --git a/lib/libtuxtxt/tuxtxt.h b/lib/libtuxtxt/tuxtxt.h index 0c7d606a0..e70b2e507 100644 --- a/lib/libtuxtxt/tuxtxt.h +++ b/lib/libtuxtxt/tuxtxt.h @@ -81,14 +81,15 @@ int TTFWidthFactor16, TTFHeightFactor16, TTFShiftX, TTFShiftY; /* parameters for int fontheight, fontwidth, fontwidth_normal, fontwidth_small, fontwidth_topmenumain, fontwidth_topmenusmall, ascender; int ymosaic[4]; int displaywidth; +int tv_pip_y; #define fontwidth_small_lcd 8 -#define TV43STARTX (ex - 146) //(StartX + 2 + (40-nofirst)*fontwidth_topmenumain + (40*fontwidth_topmenumain/abx)) -#define TVENDX ex -#define TVENDY (StartY + 25*fontheight) -#define TV43WIDTH 144 /* 120 */ -#define TV43HEIGHT 116 /* 96 */ -#define TV43STARTY (TVENDY - TV43HEIGHT) +#define TV43STARTX (ex) +#define TVENDX (CFrameBuffer::getInstance()->getScreenX() + CFrameBuffer::getInstance()->getScreenWidth()) //ex +// #define TVENDY (StartY + 25*fontheight) +// #define TV43WIDTH (TVENDX - TV43STARTX) +// #define TV43HEIGHT (TV43WIDTH *9/16) +// #define TV43STARTY (TVENDY - TV43HEIGHT) //#define TV169FULLSTARTX (sx+ 8*40) //(sx +(ex +1 - sx)/2) #define TV169FULLSTARTX (CFrameBuffer::getInstance()->getScreenX() + CFrameBuffer::getInstance()->getScreenWidth()/2) @@ -98,11 +99,11 @@ int displaywidth; #define TV169FULLHEIGHT (ey - sy) #define TOPMENUSTARTX TV43STARTX+2 -#define TOPMENUENDX TVENDX +//#define TOPMENUENDX TVENDX #define TOPMENUSTARTY StartY #define TOPMENUENDY TV43STARTY -#define TOPMENULINEWIDTH ((TOPMENUENDX-TOPMENU43STARTX+fontwidth_topmenusmall-1)/fontwidth_topmenusmall) +//#define TOPMENULINEWIDTH ((TOPMENUENDX-TOPMENU43STARTX+fontwidth_topmenusmall-1)/fontwidth_topmenusmall) #define TOPMENUINDENTBLK 0 #define TOPMENUINDENTGRP 1 #define TOPMENUINDENTDEF 2