Skip to content

Commit ebc38cd

Browse files
committed
Небольшая доработка предыдущего коммита.
1 parent f0f6575 commit ebc38cd

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

Source/VideoRenderer.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "stdafx.h"
2222
#include <atomic>
23+
#include <optional>
2324
#include <evr.h> // for MR_VIDEO_ACCELERATION_SERVICE, because the <mfapi.h> does not contain it
2425
#include <Mferror.h>
2526
#include "Helper.h"
@@ -1107,6 +1108,8 @@ STDMETHODIMP CMpcVideoRenderer::SetWindowPosition(long Left, long Top, long Widt
11071108

11081109
CAutoLock cRendererLock(&m_RendererLock);
11091110

1111+
std::optional<bool> bFullScreenOpt;
1112+
11101113
if (!m_bIsD3DFullscreen) {
11111114
auto hMon = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST);
11121115
MONITORINFO mi = { mi.cbSize = sizeof(mi) };
@@ -1115,7 +1118,7 @@ STDMETHODIMP CMpcVideoRenderer::SetWindowPosition(long Left, long Top, long Widt
11151118
auto fullScreen = (m_windowRect.Width() == rcMonitor.Width() && m_windowRect.Height() == rcMonitor.Height());
11161119
if (m_Sets.bExclusiveFS || m_bExclusiveScreen) {
11171120
auto SwitchExclusiveScreen = [this] (bool set) {
1118-
DLog(L"CMpcVideoRenderer::SetWindowPosition() : Switch {} exclusive screen", set ? L"to" : L"from");
1121+
DLog(L"CMpcVideoRenderer::SetWindowPosition() : Switch {} Exclusive screen", set ? L"to" : L"from");
11191122
m_bExclusiveScreen = set;
11201123

11211124
if (m_hWnd) {
@@ -1135,15 +1138,9 @@ STDMETHODIMP CMpcVideoRenderer::SetWindowPosition(long Left, long Top, long Widt
11351138
}
11361139
} else {
11371140
if (!m_bFullScreen && fullScreen) {
1138-
DLog(L"Switch to FullScreen");
1139-
1140-
m_bFullScreen = true;
1141-
m_VideoProcessor->SwitchFullScreen(true);
1141+
bFullScreenOpt = true;
11421142
} else if (m_bFullScreen && !fullScreen) {
1143-
DLog(L"Switch from FullScreen");
1144-
1145-
m_bFullScreen = false;
1146-
m_VideoProcessor->SwitchFullScreen(false);
1143+
bFullScreenOpt = false;
11471144
}
11481145
}
11491146
}
@@ -1162,6 +1159,13 @@ STDMETHODIMP CMpcVideoRenderer::SetWindowPosition(long Left, long Top, long Widt
11621159

11631160
m_windowRect = windowRect;
11641161

1162+
if (bFullScreenOpt.has_value()) {
1163+
m_bFullScreen = *bFullScreenOpt;
1164+
DLog(L"CMpcVideoRenderer::SetWindowPosition() : Switch {} FullScreen", m_bFullScreen ? L"to" : L"from");
1165+
1166+
m_VideoProcessor->SwitchFullScreen(m_bFullScreen);
1167+
}
1168+
11651169
if (m_bForceRedrawing) {
11661170
Redraw();
11671171
}

0 commit comments

Comments
 (0)