[vlc-commits] vout:win32: only mark the output size changed when it actually changed
Steve Lhomme
git at videolan.org
Mon Apr 1 12:03:47 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Mar 22 14:29:24 2019 +0100| [9b5ef387e7e44fb3ca8b62bed20759411c872e7a] | committer: Steve Lhomme
vout:win32: only mark the output size changed when it actually changed
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9b5ef387e7e44fb3ca8b62bed20759411c872e7a
---
modules/video_output/win32/common.c | 21 ++++++++++++++-------
modules/video_output/win32/common.h | 3 +--
modules/video_output/win32/direct3d9.c | 4 ++--
3 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/modules/video_output/win32/common.c b/modules/video_output/win32/common.c
index 2cb205a049..37991e31b6 100644
--- a/modules/video_output/win32/common.c
+++ b/modules/video_output/win32/common.c
@@ -53,7 +53,13 @@ static bool GetRect(const vout_display_sys_win32_t *sys, RECT *out)
return false;
return GetClientRect(sys->hwnd, out);
}
-#endif
+#else /* VLC_WINSTORE_APP */
+static inline BOOL EqualRect(const RECT *r1, const RECT *r2)
+{
+ return r1->left == r2->left && r1->right == r2->right &&
+ r1->top == r2->top && r1->bottom == r2->bottom;
+}
+#endif /* VLC_WINSTORE_APP */
/* */
int CommonInit(vout_display_t *vd, vout_display_sys_win32_t *sys, bool b_windowless, const vout_display_cfg_t *vdcfg)
@@ -62,7 +68,7 @@ int CommonInit(vout_display_t *vd, vout_display_sys_win32_t *sys, bool b_windowl
sys->hvideownd = NULL;
sys->hparent = NULL;
sys->hfswnd = NULL;
- sys->changes = 0;
+ sys->rect_dest_changed = false;
sys->b_windowless = b_windowless;
sys->is_first_placement = true;
sys->is_on_top = false;
@@ -203,6 +209,7 @@ void UpdateRects(vout_display_t *vd, vout_display_sys_win32_t *sys, bool is_forc
#endif
#define rect_dest sys->rect_dest
+ RECT before_rect_dest = rect_dest;
/* Destination image position and dimensions */
#if (defined(MODULE_NAME_IS_direct3d9) || defined(MODULE_NAME_IS_direct3d11)) && !VLC_WINSTORE_APP
rect_dest.left = 0;
@@ -216,6 +223,10 @@ void UpdateRects(vout_display_t *vd, vout_display_sys_win32_t *sys, bool is_forc
rect_dest.bottom = rect_dest.top + place.height;
#endif
+ /* Signal the change in size/position */
+ if (!EqualRect(&before_rect_dest, &rect_dest))
+ sys->rect_dest_changed |= true;
+
#ifndef NDEBUG
msg_Dbg(vd, "DirectXUpdateRects source"
" offset: %i,%i visible: %ix%i decoded: %ix%i",
@@ -227,15 +238,11 @@ void UpdateRects(vout_display_t *vd, vout_display_sys_win32_t *sys, bool is_forc
rect_dest.left, rect_dest.top,
rect_dest.right, rect_dest.bottom);
#endif
+#undef rect_dest
#if !VLC_WINSTORE_APP
CommonChangeThumbnailClip(VLC_OBJECT(vd), sys, true);
#endif
-
- /* Signal the change in size/position */
- sys->changes |= DX_POSITION_CHANGE;
-
-#undef rect_dest
}
#if !VLC_WINSTORE_APP
diff --git a/modules/video_output/win32/common.h b/modules/video_output/win32/common.h
index a052d55737..485e6fe674 100644
--- a/modules/video_output/win32/common.h
+++ b/modules/video_output/win32/common.h
@@ -60,7 +60,7 @@ typedef struct vout_display_sys_win32_t
HINSTANCE dxgidebug_dll;
# endif
- unsigned changes; /* changes made to the video display */
+ bool rect_dest_changed;
/* Misc */
bool is_first_placement;
@@ -93,4 +93,3 @@ void UpdateRects (vout_display_t *, vout_display_sys_win32_t *, bool is_forced);
* Constants
*****************************************************************************/
#define IDM_TOGGLE_ON_TOP WM_USER + 1
-#define DX_POSITION_CHANGE 0x1000
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 4674d3732d..26b6b6b2d6 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -939,7 +939,7 @@ static void Manage (vout_display_t *vd)
UpdateDesktopMode(vd);
/* Position Change */
- if (sys->sys.changes & DX_POSITION_CHANGE) {
+ if (sys->sys.rect_dest_changed) {
#if 0 /* need that when bicubic filter is available */
RECT rect;
UINT width, height;
@@ -957,7 +957,7 @@ static void Manage (vout_display_t *vd)
}
#endif
sys->clear_scene = true;
- sys->sys.changes &= ~DX_POSITION_CHANGE;
+ sys->sys.rect_dest_changed = false;
}
}
More information about the vlc-commits
mailing list