From 3771f9bcce1d418162656f6b802f86784c998353 Mon Sep 17 00:00:00 2001 From: "vangelis@google.com" Date: Mon, 31 Aug 2009 21:29:37 +0000 Subject: Switching DISPLAY_MODE_DEFAULT to create to a non-full-screen window at the current display resolution. This makes switching in and out of full screen smoother. A followup CL will allow the application code to specify the max backbuffer size to get cheaper (from the GPU/pixel shader perspective) full screen rendering. Review URL: http://codereview.chromium.org/177007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24940 0039d316-1c4b-4281-b951-d872f2087c98 --- o3d/core/win/d3d9/renderer_d3d9.cc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'o3d') diff --git a/o3d/core/win/d3d9/renderer_d3d9.cc b/o3d/core/win/d3d9/renderer_d3d9.cc index 708f23f..1089723 100644 --- a/o3d/core/win/d3d9/renderer_d3d9.cc +++ b/o3d/core/win/d3d9/renderer_d3d9.cc @@ -1330,14 +1330,22 @@ bool RendererD3D9::SetFullscreen(bool fullscreen, static_cast(display); HWND window = platform_display.hwnd(); int refresh_rate = 0; + bool windowed = true; if (fullscreen) { - // Look up the refresh rate. - DisplayMode mode; - if (!GetDisplayMode(mode_id, &mode)) { - LOG(ERROR) << "Failed to GetDisplayMode"; - return false; + // If fullscreen is requested but the mode is set to + // DISPLAY_MODE_DEFAULT then create a non-full-screen window at the + // current display resolution. If any other mode is chosen then the + // windows will change mode and create a true full-screen window. + if (mode_id != DISPLAY_MODE_DEFAULT) { + // Look up the refresh rate. + DisplayMode mode; + if (!GetDisplayMode(mode_id, &mode)) { + LOG(ERROR) << "Failed to GetDisplayMode"; + return false; + } + refresh_rate = mode.refresh_rate(); + windowed = false; } - refresh_rate = mode.refresh_rate(); showing_fullscreen_message_ = true; fullscreen_message_timer_.GetElapsedTimeAndReset(); // Reset the timer. } else { @@ -1345,7 +1353,7 @@ bool RendererD3D9::SetFullscreen(bool fullscreen, } d3d_present_parameters_.FullScreen_RefreshRateInHz = refresh_rate; d3d_present_parameters_.hDeviceWindow = window; - d3d_present_parameters_.Windowed = !fullscreen; + d3d_present_parameters_.Windowed = windowed; // Check if the window size is zero. Some drivers will fail because of // that so we'll force a small size in that case. -- cgit v1.1