[vlc-commits] freetype: copy the output colorspace in the region colorspace

Steve Lhomme git at videolan.org
Fri Apr 13 13:01:20 CEST 2018


vlc/vlc-3.0 | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Apr 13 12:33:54 2018 +0200| [47cd37093b079010ff1b6c0f1d14b7e5b4f3c011] | committer: Hugo Beauzée-Luyssen

freetype: copy the output colorspace in the region colorspace

(cherry picked from commit 1f008d2913663a301020900000157b46b4c36371)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=47cd37093b079010ff1b6c0f1d14b7e5b4f3c011
---

 modules/text_renderer/freetype/freetype.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/modules/text_renderer/freetype/freetype.c b/modules/text_renderer/freetype/freetype.c
index 2595ef3872..53cf99cd18 100644
--- a/modules/text_renderer/freetype/freetype.c
+++ b/modules/text_renderer/freetype/freetype.c
@@ -451,6 +451,10 @@ static int RenderYUVP( filter_t *p_filter, subpicture_region_t *p_region,
     const unsigned regionnum = p_region->fmt.i_sar_num;
     const unsigned regionden = p_region->fmt.i_sar_den;
     fmt.i_sar_num = fmt.i_sar_den = 1;
+    fmt.transfer  = p_region->fmt.transfer;
+    fmt.primaries = p_region->fmt.primaries;
+    fmt.space     = p_region->fmt.space;
+    fmt.mastering = p_region->fmt.mastering;
 
     assert( !p_region->p_picture );
     p_region->p_picture = picture_NewFromFormat( &fmt );
@@ -834,6 +838,7 @@ static inline int RenderAXYZ( filter_t *p_filter,
                               FT_BBox *p_paddedtextbbox,
                               FT_BBox *p_textbbox,
                               vlc_fourcc_t i_chroma,
+                              const video_format_t *fmt_out,
                               void (*ExtractComponents)( uint32_t, uint8_t *, uint8_t *, uint8_t * ),
                               void (*FillPicture)( picture_t *p_picture, int, int, int, int ),
                               void (*BlendPixel)(picture_t *, int, int, int, int, int, int, int) )
@@ -848,6 +853,10 @@ static inline int RenderAXYZ( filter_t *p_filter,
     const unsigned regionnum = p_region->fmt.i_sar_num;
     const unsigned regionden = p_region->fmt.i_sar_den;
     fmt.i_sar_num = fmt.i_sar_den = 1;
+    fmt.transfer  = fmt_out->transfer;
+    fmt.primaries = fmt_out->primaries;
+    fmt.space     = fmt_out->space;
+    fmt.mastering = fmt_out->mastering;
 
     picture_t *p_picture = p_region->p_picture = picture_NewFromFormat( &fmt );
     if( !p_region->p_picture )
@@ -1256,6 +1265,7 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
                 rv = RenderAXYZ( p_filter, p_region_out, p_lines,
                                  &regionbbox, &paddedbbox, &bbox,
                                  VLC_CODEC_YUVA,
+                                 &p_region_out->fmt,
                                  YUVFromRGB,
                                  FillYUVAPicture,
                                  BlendYUVAPixel );
@@ -1263,6 +1273,7 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
                 rv = RenderAXYZ( p_filter, p_region_out, p_lines,
                                  &regionbbox, &paddedbbox, &bbox,
                                  VLC_CODEC_RGBA,
+                                 &p_region_out->fmt,
                                  RGBFromRGB,
                                  FillRGBAPicture,
                                  BlendRGBAPixel );
@@ -1270,6 +1281,7 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
                 rv = RenderAXYZ( p_filter, p_region_out, p_lines,
                                  &regionbbox, &paddedbbox, &bbox,
                                  VLC_CODEC_ARGB,
+                                 &p_region_out->fmt,
                                  RGBFromRGB,
                                  FillARGBPicture,
                                  BlendARGBPixel );



More information about the vlc-commits mailing list