Commit 9aa2f5ea authored by gbazin's avatar gbazin

* modules/misc/freetype.c, modules/video_filter/marq.c, time.c: a few fixes.

parent d7aff3cb
......@@ -209,7 +209,7 @@ static int Create( vlc_object_t *p_this )
var_Create( p_filter, "freetype-color",
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
var_Get( p_filter, "freetype-color", &val );
p_sys->i_font_color = __MIN( val.i_int, 0xFFFFFF );
p_sys->i_font_color = __MAX( __MIN( val.i_int, 0xFFFFFF ), 0 );
/* Look what method was requested */
var_Get( p_filter, "freetype-font", &val );
......@@ -359,8 +359,9 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
fmt.p_palette->palette[i][0] = i * i_y / 256;
fmt.p_palette->palette[i][1] = i_u;
fmt.p_palette->palette[i][2] = i_v;
fmt.p_palette->palette[i][3] = i + (255 - i) / 16;
fmt.p_palette->palette[i][3] =
i + (256 - i) * (256 / (255 - p_line->i_alpha)) / 16;
(int)fmt.p_palette->palette[i][3] * (255 - p_line->i_alpha) / 255;
}
fmt.p_palette->palette[0][3] = 0;
......@@ -459,13 +460,13 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
psz_string = p_region_in->psz_text;
if( !psz_string || !*psz_string ) return VLC_EGENERIC;
i_font_color = 0xFFFFFF;//p_region_in->i_text_color;
i_font_color = __MAX( __MIN( p_region_in->i_text_color, 0xFFFFFF ), 0 );
if( i_font_color == 0xFFFFFF ) i_font_color = p_sys->i_font_color;
i_font_alpha = p_region_in->i_text_alpha;
i_font_alpha = __MAX( __MIN( p_region_in->i_text_alpha, 255 ), 0 );
if( !i_font_alpha ) i_font_alpha = 255 - p_sys->i_font_opacity;
i_font_size = p_region_in->i_text_size;
i_font_size = __MAX( __MIN( p_region_in->i_text_size, 255 ), 0 );
if( !i_font_size ) i_font_size = p_sys->i_font_size;
i_red = ( i_font_color & 0x00FF0000 ) >> 16;
......
......@@ -83,7 +83,7 @@ struct filter_sys_t
#define TIMEOUT_LONGTEXT N_("Defines the time the marquee must remain " \
"displayed, in milliseconds. Default value is " \
"0 (remain forever).")
#define OPACITY_TEXT N_("Opacity, -1..255")
#define OPACITY_TEXT N_("Opacity, 0..255")
#define OPACITY_LONGTEXT N_("The opacity (inverse of transparency) of " \
"overlay text. 0 = transparent, 255 = totally opaque. " )
#define SIZE_TEXT N_("Font size, pixels")
......@@ -91,8 +91,8 @@ struct filter_sys_t
"with -1 = use freetype-fontsize" )
#define COLOR_TEXT N_("Text Default Color")
#define COLOR_LONGTEXT N_("The color of overlay text. 1 byte for each color, hexadecimal." \
"-1 = use freetype-color, #000000 = all colors off, " \
#define COLOR_LONGTEXT N_("The color of overlay text. 1 byte for each color, hexadecimal. " \
"#000000 = all colors off, " \
"0xFF0000 = just Red, 0xFFFFFF = all color on [White]" )
#define POS_TEXT N_("Marquee position")
......@@ -123,9 +123,9 @@ vlc_module_begin();
add_integer( "marq-position", 5, NULL, POS_TEXT, POS_LONGTEXT, VLC_TRUE );
/* 5 sets the default to top [1] left [4] */
change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
add_integer_with_range( "marq-opacity", 0, 0, 255, NULL,
add_integer_with_range( "marq-opacity", 255, 0, 255, NULL,
OPACITY_TEXT, OPACITY_LONGTEXT, VLC_FALSE );
add_integer( "marq-color", -1, NULL, COLOR_TEXT, COLOR_LONGTEXT, VLC_TRUE );
add_integer( "marq-color", 0xFFFFFF, NULL, COLOR_TEXT, COLOR_LONGTEXT, VLC_TRUE );
change_integer_list( pi_color_values, ppsz_color_descriptions, 0 );
add_integer( "marq-size", -1, NULL, SIZE_TEXT, SIZE_LONGTEXT, VLC_FALSE );
......@@ -277,7 +277,7 @@ static subpicture_t *Filter( filter_t *p_filter, mtime_t date )
p_spu->b_absolute = VLC_TRUE;
}
p_spu->p_region->i_text_color = p_sys->i_font_color;
p_spu->p_region->i_text_alpha = p_sys->i_font_opacity;
p_spu->p_region->i_text_alpha = 255 - p_sys->i_font_opacity;
p_spu->p_region->i_text_size = p_sys->i_font_size;
......
......@@ -80,8 +80,8 @@ struct filter_sys_t
"with -1 = use freetype-fontsize" )
#define COLOR_TEXT N_("Text Default Color")
#define COLOR_LONGTEXT N_("The color of overlay text. 1 byte for each color, hexadecimal." \
"-1 = use freetype-color, #000000 = all colors off, " \
#define COLOR_LONGTEXT N_("The color of overlay text. 1 byte for each color, hexadecimal. " \
"#000000 = all colors off, " \
"0xFF0000 = just Red, 0xFFFFFF = all color on [White]" )
#define POS_TEXT N_("Time position")
#define POS_LONGTEXT N_( \
......@@ -109,9 +109,9 @@ vlc_module_begin();
add_integer( "time-position", 9, NULL, POS_TEXT, POS_LONGTEXT, VLC_TRUE );
/* 9 sets the default to bottom-left, minimizing jitter */
change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 );
add_integer_with_range( "time-opacity", 0, 0, 255, NULL,
add_integer_with_range( "time-opacity", 255, 0, 255, NULL,
OPACITY_TEXT, OPACITY_LONGTEXT, VLC_FALSE );
add_integer( "time-color", -1, NULL, COLOR_TEXT, COLOR_LONGTEXT, VLC_TRUE );
add_integer( "time-color", 0xFFFFFF, NULL, COLOR_TEXT, COLOR_LONGTEXT, VLC_TRUE );
change_integer_list( pi_color_values, ppsz_color_descriptions, 0 );
add_integer( "time-size", -1, NULL, SIZE_TEXT, SIZE_LONGTEXT, VLC_FALSE );
set_description( _("Time display sub filter") );
......
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