[vlc-commits] display: remove useless continue

Rémi Denis-Courmont git at videolan.org
Sun May 20 19:52:20 CEST 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat May 19 17:28:23 2018 +0300| [1986d9dc423e8ab4bde354d98fc28eeb77d70c95] | committer: Rémi Denis-Courmont

display: remove useless continue

Fitting the window will ask for the window to change size (or do
nothing). Typically, the window will not synchronously change size.
But even if it did, it will queue an event to the video output thread
control queue, which only be processed after vout_ManageDisplay()
returns to the thread main loop.

So in any case, by the time the VoutDisplayFitWindow() call returns,
there will be nothing new for vout_ManageDisplay() to do. So there
are no points in looping.

With the continue statement removed, the window fitting block can be
moved out after the loop.

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

 src/video_output/display.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/src/video_output/display.c b/src/video_output/display.c
index 2bacebfc0e..65a6c98893 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -373,8 +373,6 @@ typedef struct {
     } mouse;
 
     atomic_bool reset_pictures;
-
-    bool fit_window;
 } vout_display_owner_sys_t;
 
 static int VoutDisplayCreateRender(vout_display_t *vd)
@@ -644,6 +642,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
     if (osys->is_splitter)
         SplitterManage(vd);
 
+    bool fit_window = false;
     bool reset_render = false;
     for (;;) {
 #if defined(_WIN32) || defined(__OS2__)
@@ -668,15 +667,8 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
 #endif
             !osys->ch_sar &&
             !osys->ch_crop &&
-            !osys->ch_viewpoint) {
-
-            if (osys->fit_window) {
-                VoutDisplayFitWindow(vd, false);
-                osys->fit_window = false;
-                continue;
-            }
+            !osys->ch_viewpoint)
             break;
-        }
 
         /* */
 #if defined(_WIN32) || defined(__OS2__)
@@ -709,7 +701,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
             }
 
             vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_ASPECT);
-            osys->fit_window = true;
+            fit_window = true;
             osys->sar.num = vd->source.i_sar_num;
             osys->sar.den = vd->source.i_sar_den;
             osys->ch_sar  = false;
@@ -756,7 +748,7 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
             video_format_Print(VLC_OBJECT(vd), "CROPPED", &vd->source);
             vout_display_Control(vd, VOUT_DISPLAY_CHANGE_SOURCE_CROP);
 
-            osys->fit_window = true;
+            fit_window = true;
             osys->crop.left   = left - osys->source.i_x_offset;
             osys->crop.top    = top  - osys->source.i_y_offset;
             /* FIXME for right/bottom we should keep the 'type' border vs window */
@@ -790,6 +782,10 @@ bool vout_ManageDisplay(vout_display_t *vd, bool allow_reset_pictures)
             reset_render = true;
         }
     }
+
+    if (fit_window)
+        VoutDisplayFitWindow(vd, false);
+
     if (reset_render)
         VoutDisplayResetRender(vd);
 
@@ -1011,7 +1007,6 @@ static vout_display_t *DisplayNew(vout_thread_t *vout,
     osys->wm_state = state->wm_state;
     osys->ch_wm_state = true;
 #endif
-    osys->fit_window = false;
 
     osys->source = *source;
     osys->crop.left   = 0;



More information about the vlc-commits mailing list