[vlc-commits] text_renderer: test flags only using their defined values

Francois Cartegnie git at videolan.org
Mon Jun 26 12:40:43 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Jun 25 17:15:10 2017 +0200| [a53b2f4ed93a934ee4631312325f46c968f14874] | committer: Francois Cartegnie

text_renderer: test flags only using their defined values

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

 modules/text_renderer/freetype/freetype.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/modules/text_renderer/freetype/freetype.c b/modules/text_renderer/freetype/freetype.c
index b688391cdd..01532000c7 100644
--- a/modules/text_renderer/freetype/freetype.c
+++ b/modules/text_renderer/freetype/freetype.c
@@ -864,14 +864,13 @@ static inline int RenderAXYZ( filter_t *p_filter,
         for( line_desc_t *p_line = p_line_head; p_line != NULL; p_line = p_line->p_next )
         {
             int i_align_left = i_margin;
-            if( p_line->i_width < i_text_width )
+            if( p_line->i_width < i_text_width &&
+               (p_region->i_align & (SUBPICTURE_ALIGN_LEAVETEXT|SUBPICTURE_ALIGN_LEFT)) == 0 )
             {
                 /* Left offset to take into account alignment */
-                if( (p_region->i_align & 0x3) == SUBPICTURE_ALIGN_RIGHT )
+                if( p_region->i_align & SUBPICTURE_ALIGN_RIGHT )
                     i_align_left += ( i_text_width - p_line->i_width );
-                else if( (p_region->i_align & 0x10) == SUBPICTURE_ALIGN_LEAVETEXT)
-                    i_align_left = i_margin; /* Keep it the way it is */
-                else if( (p_region->i_align & 0x3) != SUBPICTURE_ALIGN_LEFT )
+                else /* center */
                     i_align_left += ( i_text_width - p_line->i_width ) / 2;
             }
             int i_align_top = i_margin;



More information about the vlc-commits mailing list