mirror of
https://github.com/videolan/vlc.git
synced 2024-11-27 03:47:46 +08:00
text_style: turn the colors into uint32_t
They are stored as XRGB with the alpha component separately (ie not ARGB). A lot of code is already writing uint32_t values in these fields.
This commit is contained in:
parent
25da40b9a3
commit
5974d7abd0
@ -47,23 +47,22 @@ typedef struct
|
||||
/* Font style */
|
||||
float f_font_relsize; /**< The font size in video height % */
|
||||
int i_font_size; /**< The font size in pixels */
|
||||
int i_font_color; /**< The color of the text 0xRRGGBB
|
||||
(native endianness) */
|
||||
uint32_t i_font_color; /**< The color of the text in XRGB */
|
||||
uint8_t i_font_alpha; /**< The transparency of the text.*/
|
||||
int i_spacing; /**< The spaceing between glyphs in pixels */
|
||||
|
||||
/* Outline */
|
||||
int i_outline_color; /**< The color of the outline 0xRRGGBB */
|
||||
uint32_t i_outline_color; /**< The color of the outline in XRGB */
|
||||
uint8_t i_outline_alpha; /**< The transparency of the outline */
|
||||
int i_outline_width; /**< The width of the outline in pixels */
|
||||
|
||||
/* Shadow */
|
||||
int i_shadow_color; /**< The color of the shadow 0xRRGGBB */
|
||||
uint32_t i_shadow_color; /**< The color of the shadow in XRGB */
|
||||
uint8_t i_shadow_alpha; /**< The transparency of the shadow. */
|
||||
int i_shadow_width; /**< The width of the shadow in pixels */
|
||||
|
||||
/* Background */
|
||||
int i_background_color;/**< The color of the background 0xRRGGBB */
|
||||
uint32_t i_background_color;/**< The color of the background in XRGB */
|
||||
uint8_t i_background_alpha;/**< The transparency of the background */
|
||||
|
||||
/* Line breaking */
|
||||
|
@ -169,7 +169,7 @@ static const struct {
|
||||
|
||||
#define EIA608_COLOR_DEFAULT EIA608_COLOR_WHITE
|
||||
|
||||
static const int rgi_eia608_colors[] = {
|
||||
static const uint32_t rgi_eia608_colors[] = {
|
||||
0xffffff, // white
|
||||
0x00ff00, // green
|
||||
0x0000ff, // blue
|
||||
|
@ -639,9 +639,9 @@ static int ConvertFromVLCFlags( const text_style_t *p_style )
|
||||
|
||||
static uint32_t ConvertFromVLCColor( const text_style_t *p_style )
|
||||
{
|
||||
uint32_t rgba = 0;
|
||||
uint32_t rgba;
|
||||
if( p_style->i_features & STYLE_HAS_FONT_COLOR )
|
||||
rgba = ((uint32_t)p_style->i_font_color) << 8;
|
||||
rgba = p_style->i_font_color << 8;
|
||||
else
|
||||
rgba = 0xFFFFFF00U;
|
||||
if( p_style->i_features & STYLE_HAS_FONT_ALPHA )
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "css_style.h"
|
||||
|
||||
static void Color( vlc_css_term_t term,
|
||||
int *color, uint8_t *alpha,
|
||||
uint32_t *color, uint8_t *alpha,
|
||||
uint16_t *feat, int cflag, int aflag )
|
||||
{
|
||||
if( term.type == TYPE_FUNCTION )
|
||||
@ -38,9 +38,9 @@ static void Color( vlc_css_term_t term,
|
||||
if( ( !strcmp( term.psz, "rgb" ) && term.function->i_count == 3 ) ||
|
||||
( !strcmp( term.psz, "rgba" ) && term.function->i_count == 4 ) )
|
||||
{
|
||||
*color = (((int)term.function->seq[0].term.val) << 16) |
|
||||
(((int)term.function->seq[1].term.val) << 8) |
|
||||
((int)term.function->seq[2].term.val);
|
||||
*color = (((uint32_t)term.function->seq[0].term.val) << 16) |
|
||||
(((uint32_t)term.function->seq[1].term.val) << 8) |
|
||||
((uint32_t)term.function->seq[2].term.val);
|
||||
*feat |= cflag;
|
||||
if( term.psz[3] != 0 ) /* rgba */
|
||||
{
|
||||
|
@ -383,15 +383,15 @@ static int unparse_GetTextAlpha( const commandparams_t *p_results,
|
||||
static int unparse_GetTextColor( const commandparams_t *p_results,
|
||||
buffer_t *p_output )
|
||||
{
|
||||
int ret = BufferPrintf( p_output, " %d", (p_results->fontstyle.i_font_color & 0xff0000)>>16 );
|
||||
int ret = BufferPrintf( p_output, " %"PRIu32, (p_results->fontstyle.i_font_color & 0xff0000)>>16 );
|
||||
if( ret != VLC_SUCCESS )
|
||||
return ret;
|
||||
|
||||
ret = BufferPrintf( p_output, " %d", (p_results->fontstyle.i_font_color & 0x00ff00)>>8 );
|
||||
ret = BufferPrintf( p_output, " %"PRIu32, (p_results->fontstyle.i_font_color & 0x00ff00)>>8 );
|
||||
if( ret != VLC_SUCCESS )
|
||||
return ret;
|
||||
|
||||
ret = BufferPrintf( p_output, " %d", (p_results->fontstyle.i_font_color & 0x0000ff) );
|
||||
ret = BufferPrintf( p_output, " %"PRIu32, (p_results->fontstyle.i_font_color & 0x0000ff) );
|
||||
if( ret != VLC_SUCCESS )
|
||||
return ret;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user