Commit d1c32963 by twiz@chromium.org

Correct usage of GetVersion() windows calls. Review: http://codereview.appspot.com/4579049

git-svn-id: https://angleproject.googlecode.com/svn/trunk@688 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 5601ea0d
......@@ -22,6 +22,23 @@
namespace egl
{
namespace
{
const int versionWindowsVista = MAKEWORD(0x00, 0x06);
const int versionWindows7 = MAKEWORD(0x01, 0x06);
// Return the version of the operating system in a format suitable for ordering
// comparison.
int getComparableOSVersion()
{
DWORD version = GetVersion();
int majorVersion = LOBYTE(LOWORD(version));
int minorVersion = HIBYTE(LOWORD(version));
return MAKEWORD(minorVersion, majorVersion);
}
}
Surface::Surface(Display *display, const Config *config, HWND window)
: mDisplay(display), mConfig(config), mWindow(window)
{
......@@ -78,7 +95,7 @@ bool Surface::initialize()
// Modify present parameters for this window, if we are composited,
// to minimize the amount of queuing done by DWM between our calls to
// present and the actual screen.
if (mWindow && (LOWORD(GetVersion()) >= 0x60)) {
if (mWindow && (getComparableOSVersion() >= versionWindowsVista)) {
BOOL isComposited;
HRESULT result = DwmIsCompositionEnabled(&isComposited);
if (SUCCEEDED(result) && isComposited) {
......@@ -165,7 +182,7 @@ bool Surface::resetSwapChain(int backbufferWidth, int backbufferHeight)
D3DPRESENT_PARAMETERS presentParameters = {0};
HRESULT result;
bool useFlipEx = (LOWORD(GetVersion()) >= 0x61) && mDisplay->isD3d9ExDevice();
bool useFlipEx = (getComparableOSVersion() >= versionWindows7) && mDisplay->isD3d9ExDevice();
// FlipEx causes unseemly stretching when resizing windows AND when one
// draws outside of the WM_PAINT callback. While this is seldom a problem in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment