mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Remove Platform version helpers and use <VersionHelpers.h> per http://msdn.microsoft.com/en-us/library/windows/desktop/dn424972%28v=vs.85%29.aspx
This commit is contained in:
@ -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())
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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) };
|
||||
|
@ -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
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <Uxtheme.h>
|
||||
#include <wincodec.h>
|
||||
#include <wrl/client.h>
|
||||
#include <VersionHelpers.h>
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
|
Reference in New Issue
Block a user