[vlc-commits] commit: Visual: Center the vuMeter. (Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Thu Apr 15 23:19:19 CEST 2010


vlc/vlc-1.1 | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Thu Apr 15 16:51:47 2010 +0200| [c911f727e042e1ea79d9ac2f6e3215dbbaa3d143] | committer: Jean-Baptiste Kempf 

Visual: Center the vuMeter.

Close #3534
(cherry picked from commit 93c4f0f8896172a390a3934f76265ca43523c515)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/visualization/visual/effects.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/modules/visualization/visual/effects.c b/modules/visualization/visual/effects.c
index 023f82f..a5726be 100644
--- a/modules/visualization/visual/effects.c
+++ b/modules/visualization/visual/effects.c
@@ -854,7 +854,6 @@ int vuMeter_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
                 const block_t * p_buffer , picture_t * p_picture)
 {
     VLC_UNUSED(p_aout);
-    int j;
     float i_value_l = 0;
     float i_value_r = 0;
 
@@ -911,21 +910,23 @@ int vuMeter_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
             i_value[1] = i_value[1] - 6;
     }
 
-    int x, y, k;
+    int x, y;
     float teta;
     float teta_grad;
 
-    for ( j = 0; j < 2; j++ )
+    int start_x = p_effect->i_width / 2 - 120; /* i_width.min = 532 (visual.c) */
+
+    for ( int j = 0; j < 2; j++ )
     {
         /* Draw the two scales */
-        k = 0;
+        int k = 0;
         teta_grad = GRAD_ANGLE_MIN;
         for ( teta = -M_PI_4; teta <= M_PI_4; teta = teta + 0.003 )
         {
             for ( unsigned i = 140; i <= 150; i++ )
             {
                 y = i * cos(teta) + 20;
-                x = i * sin(teta) + 150 + 240 * j;
+                x = i * sin(teta) + start_x + 240 * j;
                 /* Compute the last color for the gradation */
                 if (teta >= teta_grad + GRAD_INCR && teta_grad <= GRAD_ANGLE_MAX)
                 {
@@ -949,7 +950,7 @@ int vuMeter_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
         for ( int i = 0; i <= 150; i++ )
         {
             y = i * cos(teta) + 20;
-            x = i * sin(teta) + 150 + 240 * j;
+            x = i * sin(teta) + start_x + 240 * j;
             *(p_picture->p[0].p_pixels +
                     (p_picture->p[0].i_lines - y - 1 ) * p_picture->p[0].i_pitch
                     + x ) = 0xAD;
@@ -967,7 +968,7 @@ int vuMeter_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
             for ( int i = 0; i < 10; i++ )
             {
                 y = i * cos(teta) + 20;
-                x = i * sin(teta) + 150 + 240 * j;
+                x = i * sin(teta) + start_x + 240 * j;
                 *(p_picture->p[0].p_pixels +
                         (p_picture->p[0].i_lines - y - 1 ) * p_picture->p[0].i_pitch
                         + x ) = 0xFF;



More information about the vlc-commits mailing list