aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Fedchin <anightik@gmail.com>2018-12-10 15:07:37 +0300
committerAnton Fedchin <anightik@gmail.com>2018-12-12 15:36:16 +0300
commit60e871a0a89e3158a60e08dc3c2d5531d7969977 (patch)
tree237eaf45c55c9e237553b15523d9b3539ed612e1
parentb788e0864a49574a37832640a0959bb901d928e6 (diff)
[win32] fix wrong output size in case when system doesn't inform windowing about desktop size change in true fullscreen.
this should fix #14735
-rw-r--r--xbmc/rendering/dx/DeviceResources.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/xbmc/rendering/dx/DeviceResources.cpp b/xbmc/rendering/dx/DeviceResources.cpp
index 669c5e7682..e68b68f4f7 100644
--- a/xbmc/rendering/dx/DeviceResources.cpp
+++ b/xbmc/rendering/dx/DeviceResources.cpp
@@ -195,13 +195,14 @@ bool DX::DeviceResources::SetFullScreen(bool fullscreen, RESOLUTION_INFO& res)
critical_section::scoped_lock lock(m_criticalSection);
- CLog::LogF(LOGDEBUG, "switching to/from fullscreen (%f x %f)", m_outputSize.Width,
- m_outputSize.Height);
-
BOOL bFullScreen;
- bool recreate = m_stereoEnabled != (CServiceBroker::GetWinSystem()->GetGfxContext().GetStereoMode() == RENDER_STEREO_MODE_HARDWAREBASED);
-
m_swapChain->GetFullscreenState(&bFullScreen, nullptr);
+
+ CLog::LogF(LOGDEBUG, "switching from %s(%.0f x %.0f) to %s(%d x %d)",
+ bFullScreen ? "fullscreen " : "", m_outputSize.Width, m_outputSize.Height,
+ fullscreen ? "fullscreen " : "", res.iWidth, res.iHeight);
+
+ bool recreate = m_stereoEnabled != (CServiceBroker::GetWinSystem()->GetGfxContext().GetStereoMode() == RENDER_STEREO_MODE_HARDWAREBASED);
if (!!bFullScreen && !fullscreen)
{
CLog::LogF(LOGDEBUG, "switching to windowed");
@@ -257,7 +258,15 @@ bool DX::DeviceResources::SetFullScreen(bool fullscreen, RESOLUTION_INFO& res)
recreate |= SUCCEEDED(m_swapChain->SetFullscreenState(true, pOutput.Get()));
m_swapChain->GetFullscreenState(&bFullScreen, nullptr);
}
- recreate |= SUCCEEDED(m_swapChain->ResizeTarget(&currentMode));
+ bool resized = SUCCEEDED(m_swapChain->ResizeTarget(&currentMode));
+ if (resized)
+ {
+ // some system doesn't inform windowing about desktop size changes
+ // so we have to change output size before resizing buffers
+ m_outputSize.Width = static_cast<float>(currentMode.Width);
+ m_outputSize.Height = static_cast<float>(currentMode.Height);
+ }
+ recreate |= resized;
}
}
if (!bFullScreen)