Commit 353812ff authored by Francois Cartegnie's avatar Francois Cartegnie

freetype: change background rendering

background style was never applied when set to non text mode.
parent 9f43ceac
......@@ -424,10 +424,12 @@ static subpicture_t *Subtitle( decoder_t *p_dec, text_segment_t *p_segments, mti
region itself gets aligned, but the text inside it does not */
p_spu_sys->align = SUBPICTURE_ALIGN_LEAVETEXT;
p_spu_sys->p_segments = p_segments;
p_spu_sys->noregionbg = p_dec->p_sys->b_opaque;
p_spu_sys->noregionbg = true;
p_spu_sys->gridmode = true;
/* Set style defaults (will be added to segments if none set) */
p_spu_sys->p_default_style->i_style_flags |= STYLE_MONOSPACED;
if( p_dec->p_sys->b_opaque )
p_spu_sys->p_default_style->i_style_flags |= STYLE_BACKGROUND;
p_spu_sys->p_default_style->i_font_color = rgi_eia608_colors[EIA608_COLOR_DEFAULT];
p_spu_sys->p_default_style->f_font_relsize = 100 / EIA608_SCREEN_ROWS * 3/4;
p_spu_sys->p_default_style->i_features |= (STYLE_HAS_FONT_COLOR | STYLE_HAS_FLAGS);
......
......@@ -442,9 +442,19 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
subpicture_updater_sys_t *p_spu_sys = p_spu->updater.p_sys;
p_spu_sys->p_segments = text_segment_New( &p_text[offset] );
if( p_spu_sys->p_segments && b_opaque )
{
p_spu_sys->p_segments->style = text_style_Create( STYLE_NO_DEFAULTS );
if( p_spu_sys->p_segments->style )
{
/* Set text background */
p_spu_sys->p_segments->style->i_style_flags = STYLE_BACKGROUND;
p_spu_sys->p_segments->style->i_features |= STYLE_HAS_FLAGS;
}
}
p_spu_sys->align = i_align;
p_spu_sys->noregionbg = b_opaque;
p_spu_sys->noregionbg = true;
#ifdef ZVBI_DEBUG
msg_Info( p_dec, "page %x-%x(%d)\n\"%s\"", p_page.pgno, p_page.subno, i_total, &p_text[offset] );
......
......@@ -735,8 +735,10 @@ static inline void RenderBackground( subpicture_region_t *p_region,
p_line->p_character[i_seg_end].p_glyph->bitmap.width +
i_align_left - p_bbox->xMin;
uint8_t i_x, i_y, i_z;
const line_character_t *p_char = &p_line->p_character[i_char_index];
if( p_char->p_style->i_style_flags & STYLE_BACKGROUND )
{
uint8_t i_x, i_y, i_z;
ExtractComponents( p_char->b_in_karaoke ? p_char->p_style->i_karaoke_background_color :
p_char->p_style->i_background_color,
&i_x, &i_y, &i_z );
......@@ -752,6 +754,7 @@ static inline void RenderBackground( subpicture_region_t *p_region,
BlendPixel( p_picture, dx, dy, i_alpha, i_x, i_y, i_z, 0xff );
}
}
}
line_start = line_end;
i_char_index = i_seg_end + 1;
......@@ -796,8 +799,6 @@ static inline int RenderAXYZ( filter_t *p_filter,
if (p_region->b_noregionbg) {
/* Render the background just under the text */
FillPicture( p_picture, STYLE_ALPHA_TRANSPARENT, 0x00, 0x00, 0x00 );
RenderBackground(p_region, p_line_head, p_bbox, i_margin, p_picture, i_text_width,
ExtractComponents, BlendPixel);
} else {
/* Render background under entire subpicture block */
int i_background_color = var_InheritInteger( p_filter, "freetype-background-color" );
......@@ -805,6 +806,9 @@ static inline int RenderAXYZ( filter_t *p_filter,
ExtractComponents( i_background_color, &i_x, &i_y, &i_z );
FillPicture( p_picture, i_a, i_x, i_y, i_z );
}
/* Render text's background (from decoder) if any */
RenderBackground(p_region, p_line_head, p_bbox, i_margin, p_picture, i_text_width,
ExtractComponents, BlendPixel);
/* Render shadow then outline and then normal glyphs */
for( int g = 0; g < 3; g++ )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment