[vlc-commits] [Git][videolan/vlc][master] 2 commits: freetype: rename xxxFromRGB to xxxFromXRGB
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Sat Oct 7 12:57:01 UTC 2023
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
25da40b9 by Steve Lhomme at 2023-10-07T12:18:05+00:00
freetype: rename xxxFromRGB to xxxFromXRGB
This is the type of uin32_t that is expected to be passed.
- - - - -
5974d7ab by Steve Lhomme at 2023-10-07T12:18:05+00: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.
- - - - -
8 changed files:
- include/vlc_text_style.h
- modules/codec/cc.c
- modules/codec/substx3g.c
- modules/codec/webvtt/css_style.c
- modules/spu/dynamicoverlay/dynamicoverlay_commands.c
- modules/text_renderer/freetype/blend/rgb.h
- modules/text_renderer/freetype/blend/yuv.h
- modules/text_renderer/freetype/freetype.c
Changes:
=====================================
include/vlc_text_style.h
=====================================
@@ -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 */
=====================================
modules/codec/cc.c
=====================================
@@ -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
=====================================
modules/codec/substx3g.c
=====================================
@@ -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 )
=====================================
modules/codec/webvtt/css_style.c
=====================================
@@ -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 */
{
=====================================
modules/spu/dynamicoverlay/dynamicoverlay_commands.c
=====================================
@@ -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;
=====================================
modules/text_renderer/freetype/blend/rgb.h
=====================================
@@ -19,8 +19,8 @@
*****************************************************************************/
#include "blend.h"
-static void RGBFromRGB( uint32_t i_argb,
- uint8_t *pi_r, uint8_t *pi_g, uint8_t *pi_b )
+static void RGBFromXRGB( uint32_t i_argb,
+ uint8_t *pi_r, uint8_t *pi_g, uint8_t *pi_b )
{
*pi_r = ( i_argb & 0x00ff0000 ) >> 16;
*pi_g = ( i_argb & 0x0000ff00 ) >> 8;
=====================================
modules/text_renderer/freetype/blend/yuv.h
=====================================
@@ -19,8 +19,8 @@
*****************************************************************************/
#include "blend.h"
-static void YUVFromRGB( uint32_t i_argb,
- uint8_t *pi_y, uint8_t *pi_u, uint8_t *pi_v )
+static void YUVFromXRGB( uint32_t i_argb,
+ uint8_t *pi_y, uint8_t *pi_u, uint8_t *pi_v )
{
int i_red = ( i_argb & 0x00ff0000 ) >> 16;
int i_green = ( i_argb & 0x0000ff00 ) >> 8;
=====================================
modules/text_renderer/freetype/freetype.c
=====================================
@@ -385,7 +385,7 @@ static int RenderYUVP( filter_t *p_filter, subpicture_region_t *p_region,
/* Calculate text color components
* Only use the first color */
const int i_alpha = p_line->p_character[0].p_style->i_font_alpha;
- YUVFromRGB( p_line->p_character[0].p_style->i_font_color, &i_y, &i_u, &i_v );
+ YUVFromXRGB( p_line->p_character[0].p_style->i_font_color, &i_y, &i_u, &i_v );
/* Build palette */
fmt.p_palette->i_entries = 16;
@@ -1132,13 +1132,13 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
const ft_drawing_functions drawfuncs[] =
{
- [DRAW_YUVA] = { .extract = YUVFromRGB,
+ [DRAW_YUVA] = { .extract = YUVFromXRGB,
.fill = FillYUVAPicture,
.blend = BlendGlyphToYUVA },
- [DRAW_RGBA] = { .extract = RGBFromRGB,
+ [DRAW_RGBA] = { .extract = RGBFromXRGB,
.fill = FillRGBAPicture,
.blend = BlendGlyphToRGBA },
- [DRAW_ARGB] = { .extract = RGBFromRGB,
+ [DRAW_ARGB] = { .extract = RGBFromXRGB,
.fill = FillARGBPicture,
.blend = BlendGlyphToARGB },
};
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/47af51ec5838c721f62affd649530838d238eb2d...5974d7abd012694f0e306e41c3de5a150d95ea00
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/47af51ec5838c721f62affd649530838d238eb2d...5974d7abd012694f0e306e41c3de5a150d95ea00
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list