This commit is contained in:
Brian Ferguson
2014-02-12 14:42:02 -07:00
parent eced3a6978
commit 67aeaf5392
21 changed files with 23 additions and 83 deletions

View File

@ -20,7 +20,6 @@
#include "Canvas.h"
#include "CanvasD2D.h"
#include "CanvasGDIP.h"
#include "../Platform.h"
namespace Gfx {
@ -41,7 +40,7 @@ Canvas* Canvas::Create(Renderer renderer)
{
return new CanvasGDIP();
}
else if (renderer == Renderer::D2D && Platform::IsAtLeastWin7())
else if (renderer == Renderer::D2D && IsWindows7OrGreater())
{
if (CanvasD2D::Initialize())
{

View File

@ -17,7 +17,6 @@
*/
#include "StdAfx.h"
#include "../Platform.h"
#include "CanvasD2D.h"
#include "TextFormatD2D.h"
#include "Util/DWriteFontCollectionLoader.h"
@ -69,7 +68,7 @@ bool CanvasD2D::Initialize()
++c_Instances;
if (c_Instances == 1)
{
if (!Platform::IsAtLeastWin7()) return false;
if (!IsWindows7OrGreater()) return false;
D2D1_FACTORY_OPTIONS fo = {};
#ifdef _DEBUG

View File

@ -21,41 +21,6 @@
namespace Platform {
Version GetVersion()
{
static Version s_Version = ([]()
{
OSVERSIONINFOEX osvi = {sizeof(OSVERSIONINFOEX)};
if (GetVersionEx((OSVERSIONINFO*)&osvi))
{
switch (osvi.dwMajorVersion)
{
case 5:
// Not checking for osvi.dwMinorVersion >= 1 because Rainmeter won't run on pre-XP.
return Version::WinXP;
case 6:
switch (osvi.dwMinorVersion)
{
case 0:
return Version::WinVista; // Vista, Server 2008
case 1:
return Version::Win7; // 7, Server 2008R2
default:
return Version::Win8; // 8, Server 2012
}
break;
}
}
return Version::Win8; // newer OS
})();
return s_Version;
}
LPCWSTR GetPlatformName()
{
OSVERSIONINFOEX osvi = { sizeof(OSVERSIONINFOEX) };

View File

@ -23,28 +23,9 @@ namespace Platform {
typedef BOOL(WINAPI * LPFN_ISWOW64PROCESS)(HANDLE hProcess, PBOOL Wow64Process);
enum Version
{
WinXP,
WinVista,
Win7,
Win8
};
Version GetVersion();
LPCWSTR GetPlatformName();
bool GetPlatformBit(bool& is64Bit);
#define RM_PLATFORM_DECLARE_HELPERS(ver) \
inline bool IsAtMost ## ver() { return GetVersion() <= ver; } \
inline bool Is ## ver() { return GetVersion() == ver; } \
inline bool IsAtLeast ## ver() { return GetVersion() >= ver; } \
RM_PLATFORM_DECLARE_HELPERS(WinXP)
RM_PLATFORM_DECLARE_HELPERS(WinVista)
RM_PLATFORM_DECLARE_HELPERS(Win7)
RM_PLATFORM_DECLARE_HELPERS(Win8)
} // namespace Platform
#endif

View File

@ -36,6 +36,7 @@
#include <Uxtheme.h>
#include <wincodec.h>
#include <wrl/client.h>
#include <VersionHelpers.h>
#include <assert.h>
#include <math.h>