[vlc-commits] commit: Made SpuRegionPlace() code a bit more obvious. (Laurent Aimar )

git at videolan.org git at videolan.org
Sun Jan 9 22:44:21 CET 2011


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Dec 18 12:11:04 2010 +0100| [a40c82c8fb838777b0530553ad62665c4b8bd9cd] | committer: Laurent Aimar 

Made SpuRegionPlace() code a bit more obvious.

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

 src/video_output/vout_subpictures.c |   59 ++++++++++++++++-------------------
 1 files changed, 27 insertions(+), 32 deletions(-)

diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 4ae651e..1b47346 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -530,45 +530,40 @@ static void SpuRegionPlace( int *pi_x, int *pi_y,
                             const subpicture_t *p_subpic,
                             const subpicture_region_t *p_region )
 {
-    const int i_delta_x = p_region->i_x;
-    const int i_delta_y = p_region->i_y;
-    int i_x, i_y;
-
     assert( p_region->i_x != INT_MAX && p_region->i_y != INT_MAX );
-    if( p_region->i_align & SUBPICTURE_ALIGN_TOP )
-    {
-        i_y = i_delta_y;
-    }
-    else if( p_region->i_align & SUBPICTURE_ALIGN_BOTTOM )
-    {
-        i_y = p_subpic->i_original_picture_height - p_region->fmt.i_height - i_delta_y;
-    }
-    else
-    {
-        i_y = p_subpic->i_original_picture_height / 2 - p_region->fmt.i_height / 2;
-    }
-
-    if( p_region->i_align & SUBPICTURE_ALIGN_LEFT )
-    {
-        i_x = i_delta_x;
-    }
-    else if( p_region->i_align & SUBPICTURE_ALIGN_RIGHT )
+    if( p_subpic->b_absolute )
     {
-        i_x = p_subpic->i_original_picture_width - p_region->fmt.i_width - i_delta_x;
+        *pi_x = p_region->i_x;
+        *pi_y = p_region->i_y;
     }
     else
     {
-        i_x = p_subpic->i_original_picture_width / 2 - p_region->fmt.i_width / 2;
-    }
+        if( p_region->i_align & SUBPICTURE_ALIGN_TOP )
+        {
+            *pi_y = p_region->i_y;
+        }
+        else if( p_region->i_align & SUBPICTURE_ALIGN_BOTTOM )
+        {
+            *pi_y = p_subpic->i_original_picture_height - p_region->fmt.i_height - p_region->i_y;
+        }
+        else
+        {
+            *pi_y = p_subpic->i_original_picture_height / 2 - p_region->fmt.i_height / 2;
+        }
 
-    if( p_subpic->b_absolute )
-    {
-        i_x = i_delta_x;
-        i_y = i_delta_y;
+        if( p_region->i_align & SUBPICTURE_ALIGN_LEFT )
+        {
+            *pi_x = p_region->i_x;
+        }
+        else if( p_region->i_align & SUBPICTURE_ALIGN_RIGHT )
+        {
+            *pi_x = p_subpic->i_original_picture_width - p_region->fmt.i_width - p_region->i_x;
+        }
+        else
+        {
+            *pi_x = p_subpic->i_original_picture_width / 2 - p_region->fmt.i_width / 2;
+        }
     }
-
-    *pi_x = i_x;
-    *pi_y = i_y;
 }
 
 /**



More information about the vlc-commits mailing list