summaryrefslogtreecommitdiff
authorKe Gong <ke.gong@amlogic.com>2017-05-18 05:44:38 (GMT)
committer Ke Gong <ke.gong@amlogic.com>2017-05-18 05:44:38 (GMT)
commiteec357f7f1b26d8dd6130ffcb7031b0c166a9de1 (patch)
tree7e38f3e6369cd4c57124fa59e3931bc1fe1b74bc
parent2144be6cac2b0fa856e35f9e1a73dec39804d4ec (diff)
downloadlibzvbi-eec357f7f1b26d8dd6130ffcb7031b0c166a9de1.zip
libzvbi-eec357f7f1b26d8dd6130ffcb7031b0c166a9de1.tar.gz
libzvbi-eec357f7f1b26d8dd6130ffcb7031b0c166a9de1.tar.bz2
PD#144420: tt: add black background subtitle mode
Change-Id: I079248755a7421571194e9f978ef25dadab6f09a
Diffstat
-rw-r--r--src/exp-gfx.c65
1 files changed, 56 insertions, 9 deletions
diff --git a/src/exp-gfx.c b/src/exp-gfx.c
index c8ff3d5..4232dda 100644
--- a/src/exp-gfx.c
+++ b/src/exp-gfx.c
@@ -674,6 +674,8 @@ vbi_draw_vt_page_region(vbi_page *pg,
ac = &pg->text[row * pg->columns + column];
for (count = width; count > 0; count--, ac++) {
+ int transparent;
+
if ((ac->conceal & conceal) || (ac->flash & off))
unicode = 0x0020;
else
@@ -682,6 +684,53 @@ vbi_draw_vt_page_region(vbi_page *pg,
if (subtitle && (row == 0))
unicode = 0x0020;
+ if (!subtitle) {
+ transparent = 0;
+ } else if (subtitle == 1) {
+ if (vbi_is_drcs(unicode) || unicode==0x0020)
+ transparent = 1;
+ else
+ transparent = 0;
+ } else {
+ if (row == 0) {
+ transparent = 1;
+ } else if (vbi_is_drcs(unicode) || unicode==0x0020) {
+ vbi_char *tc;
+ int n, uc;
+ int left, right;
+
+ left = right = 0;
+
+ for (n = count + 1, tc = ac - 1; n <= width; tc --, n ++) {
+ if ((tc->conceal & conceal) || (tc->flash & off))
+ uc = 0x0020;
+ else
+ uc = tc->unicode;
+
+ if(!vbi_is_drcs(uc) && uc!=0x0020) {
+ left = 1;
+ break;
+ }
+ }
+
+ for (n = count - 1, tc = ac + 1; n > 0; tc ++, n --) {
+ if ((tc->conceal & conceal) || (tc->flash & off))
+ uc = 0x0020;
+ else
+ uc = tc->unicode;
+
+ if(!vbi_is_drcs(uc) && uc!=0x0020) {
+ right = 1;
+ break;
+ }
+ }
+
+ transparent = !(left & right);
+ } else {
+ transparent = 0;
+ }
+ }
+
if (canvas_type == 1) {
pen.pal8[0] = ac->background;
pen.pal8[1] = ac->foreground;
@@ -689,15 +738,13 @@ vbi_draw_vt_page_region(vbi_page *pg,
pen.rgba[0] = pg->color_map[ac->background];
pen.rgba[1] = pg->color_map[ac->foreground];
- if(subtitle){
- if(vbi_is_drcs(unicode) || unicode==0x0020) {
- pen.rgba[0] &= 0x00FFFFFF;
- pen.rgba[1] &= 0x00FFFFFF;
- }else{
- pen.rgba[0] &= 0x00FFFFFF;
- //pen.rgba[0] |= 0x80000000;
- }
- }
+ if (transparent) {
+ pen.rgba[0] = 0x00FFFFFF;
+ pen.rgba[1] = 0x00FFFFFF;
+ }
+
+ if (subtitle == 1)
+ pen.rgba[0] = 0x00FFFFFF;
}
switch (ac->size) {