diff options
author | vangelis@google.com <vangelis@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-31 21:29:37 +0000 |
---|---|---|
committer | vangelis@google.com <vangelis@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-31 21:29:37 +0000 |
commit | 3771f9bcce1d418162656f6b802f86784c998353 (patch) | |
tree | 42978ef29b5509b5d6111fd50eeaf68b7126976d /o3d | |
parent | ccc9b402d3dc820737ae1a50dd4ef6d381af5591 (diff) | |
download | chromium_src-3771f9bcce1d418162656f6b802f86784c998353.zip chromium_src-3771f9bcce1d418162656f6b802f86784c998353.tar.gz chromium_src-3771f9bcce1d418162656f6b802f86784c998353.tar.bz2 |
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
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/core/win/d3d9/renderer_d3d9.cc | 22 |
1 files changed, 15 insertions, 7 deletions
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<const DisplayWindowWindows&>(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. |