Add UseD2D option to Rainmeter.ini (defaults to 0)

This commit is contained in:
Birunthan Mohanathas 2013-03-25 18:00:53 +02:00
parent ef1cf223a7
commit 0994fad7e9
3 changed files with 9 additions and 2 deletions

View File

@ -36,8 +36,8 @@
#include "TintedImage.h" #include "TintedImage.h"
#include "MeasureScript.h" #include "MeasureScript.h"
#include "../Version.h" #include "../Version.h"
#include "../Common/Gfx/CanvasGDIP.h"
#include "../Common/Gfx/CanvasD2D.h" #include "../Common/Gfx/CanvasD2D.h"
#include "../Common/Gfx/CanvasGDIP.h"
using namespace Gdiplus; using namespace Gdiplus;
@ -143,7 +143,7 @@ CMeterWindow::CMeterWindow(const std::wstring& folderPath, const std::wstring& f
m_FontCollection(), m_FontCollection(),
m_ToolTipHidden(false) m_ToolTipHidden(false)
{ {
m_Canvas = Platform::IsAtLeastWinVista() ? m_Canvas = (Platform::IsAtLeastWinVista() && Rainmeter->CanUseD2D()) ?
(Gfx::Canvas*)new Gfx::CanvasD2D() : (Gfx::Canvas*)new Gfx::CanvasGDIP(); (Gfx::Canvas*)new Gfx::CanvasD2D() : (Gfx::Canvas*)new Gfx::CanvasGDIP();
if (!c_DwmInstance && Platform::IsAtLeastWinVista()) if (!c_DwmInstance && Platform::IsAtLeastWinVista())

View File

@ -688,6 +688,7 @@ void CRainmeter::Bang_Log(std::vector<std::wstring>& args)
*/ */
CRainmeter::CRainmeter() : CRainmeter::CRainmeter() :
m_TrayWindow(), m_TrayWindow(),
m_UseD2D(false),
m_Debug(false), m_Debug(false),
m_DisableVersionCheck(false), m_DisableVersionCheck(false),
m_NewVersion(false), m_NewVersion(false),
@ -2456,6 +2457,8 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
CConfigParser parser; CConfigParser parser;
parser.Initialize(iniFile, NULL, NULL); parser.Initialize(iniFile, NULL, NULL);
m_UseD2D = 0!=parser.ReadInt(L"Rainmeter", L"UseD2D", 0);
// Read Logging settings // Read Logging settings
m_Logging = 0!=parser.ReadInt(L"Rainmeter", L"Logging", 0); m_Logging = 0!=parser.ReadInt(L"Rainmeter", L"Logging", 0);
m_Debug = 0!=parser.ReadInt(L"Rainmeter", L"Debug", 0); m_Debug = 0!=parser.ReadInt(L"Rainmeter", L"Debug", 0);

View File

@ -167,6 +167,8 @@ public:
HINSTANCE GetResourceInstance() { return m_ResourceInstance; } HINSTANCE GetResourceInstance() { return m_ResourceInstance; }
LCID GetResourceLCID() { return m_ResourceLCID; } LCID GetResourceLCID() { return m_ResourceLCID; }
bool CanUseD2D() const { return m_UseD2D; }
bool GetDebug() { return m_Debug; } bool GetDebug() { return m_Debug; }
GlobalOptions& GetGlobalOptions() { return m_GlobalOptions; } GlobalOptions& GetGlobalOptions() { return m_GlobalOptions; }
@ -298,6 +300,8 @@ private:
std::wstring m_TrayExecuteDR; std::wstring m_TrayExecuteDR;
std::wstring m_TrayExecuteDM; std::wstring m_TrayExecuteDM;
bool m_UseD2D;
bool m_Debug; bool m_Debug;
bool m_DisableVersionCheck; bool m_DisableVersionCheck;