[vlc-commits] direct3d11: Fix resize detection

Hugo Beauzée-Luyssen git at videolan.org
Wed Jun 14 14:49:16 CEST 2017


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Wed Jun 14 11:34:00 2017 +0200| [b50f0f91721876a6086df057cedbd69c0ad40f1a] | committer: Hugo Beauzée-Luyssen

direct3d11: Fix resize detection

Fix #18394

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

 modules/video_output/win32/direct3d11.c | 51 +++++++++++++++++++++------------
 1 file changed, 33 insertions(+), 18 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index cc6e5aa734..6f4576b31f 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1053,8 +1053,34 @@ static void SetQuadVSProjection(vout_display_t *vd, d3d_quad_t *quad, const vlc_
 #undef RAD
 }
 
+static void UpdateSize(vout_display_t *vd)
+{
+    vout_display_sys_t *sys = vd->sys;
+#if defined(HAVE_ID3D11VIDEODECODER)
+    if( sys->context_lock != INVALID_HANDLE_VALUE )
+    {
+        WaitForSingleObjectEx( sys->context_lock, INFINITE, FALSE );
+    }
+#endif
+    msg_Dbg(vd, "Detected size change %dx%d", RECTWidth(sys->sys.rect_dest_clipped),
+            RECTHeight(sys->sys.rect_dest_clipped));
+
+    UpdateBackBuffer(vd);
+
+    UpdatePicQuadPosition(vd);
+#if defined(HAVE_ID3D11VIDEODECODER)
+    if( sys->context_lock != INVALID_HANDLE_VALUE )
+    {
+        ReleaseMutex( sys->context_lock );
+    }
+#endif
+}
+
 static int Control(vout_display_t *vd, int query, va_list args)
 {
+    vout_display_sys_t *sys = vd->sys;
+    RECT size_before = sys->sys.rect_dest_clipped;
+
     int res = CommonControl( vd, query, args );
 
     if (query == VOUT_DISPLAY_CHANGE_VIEWPOINT)
@@ -1067,6 +1093,12 @@ static int Control(vout_display_t *vd, int query, va_list args)
         }
     }
 
+    if (RECTWidth(size_before)  != RECTWidth(sys->sys.rect_dest_clipped) ||
+        RECTHeight(size_before) != RECTHeight(sys->sys.rect_dest_clipped))
+    {
+        UpdateSize(vd);
+    }
+
     return res;
 }
 
@@ -1080,24 +1112,7 @@ static void Manage(vout_display_t *vd)
     if (RECTWidth(size_before)  != RECTWidth(sys->sys.rect_dest_clipped) ||
         RECTHeight(size_before) != RECTHeight(sys->sys.rect_dest_clipped))
     {
-#if defined(HAVE_ID3D11VIDEODECODER)
-        if( sys->context_lock != INVALID_HANDLE_VALUE )
-        {
-            WaitForSingleObjectEx( sys->context_lock, INFINITE, FALSE );
-        }
-#endif
-        msg_Dbg(vd, "Manage detected size change %dx%d", RECTWidth(sys->sys.rect_dest_clipped),
-                RECTHeight(sys->sys.rect_dest_clipped));
-
-        UpdateBackBuffer(vd);
-
-        UpdatePicQuadPosition(vd);
-#if defined(HAVE_ID3D11VIDEODECODER)
-        if( sys->context_lock != INVALID_HANDLE_VALUE )
-        {
-            ReleaseMutex( sys->context_lock );
-        }
-#endif
+        UpdateSize(vd);
     }
 }
 



More information about the vlc-commits mailing list