[vlc-devel] [PATCH] freetype: reorder code so that i_max_face_height is set before use

Steve Lhomme robux4 at ycbcr.xyz
Sat Feb 17 10:16:03 CET 2018


CID #1465341
---
 modules/text_renderer/freetype/freetype.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/text_renderer/freetype/freetype.c b/modules/text_renderer/freetype/freetype.c
index bf76d49b0c..d8e678d01b 100644
--- a/modules/text_renderer/freetype/freetype.c
+++ b/modules/text_renderer/freetype/freetype.c
@@ -1231,15 +1231,15 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region_out,
 
     uint8_t i_background_opacity = var_InheritInteger( p_filter, "freetype-background-opacity" );
     i_background_opacity = VLC_CLIP( i_background_opacity, 0, 255 );
+    text_block.i_max_width = i_max_width;
+    text_block.i_max_height = i_max_height;
+    rv = LayoutTextBlock( p_filter, &text_block, &text_block.p_laid, &bbox, &i_max_face_height );
+
     int i_margin = (i_background_opacity > 0 && !p_region_in->b_gridmode) ? i_max_face_height / 4 : 0;
 
     if( (unsigned)i_margin * 2 >= i_max_width || (unsigned)i_margin * 2 >= i_max_height )
         i_margin = 0;
 
-    text_block.i_max_width = i_max_width;
-    text_block.i_max_height = i_max_height;
-    rv = LayoutTextBlock( p_filter, &text_block, &text_block.p_laid, &bbox, &i_max_face_height );
-
     /* Don't attempt to render text that couldn't be layed out
      * properly. */
     if( !rv && text_block.i_count > 0 && bbox.xMin < bbox.xMax && bbox.yMin < bbox.yMax )
-- 
2.14.2



More information about the vlc-devel mailing list