Skip to content

Commit

Permalink
Add UseD2D option to Rainmeter.ini (defaults to 0)
Browse files Browse the repository at this point in the history
  • Loading branch information
poiru committed Mar 25, 2013
1 parent ef1cf22 commit 0994fad
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Library/MeterWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
#include "TintedImage.h"
#include "MeasureScript.h"
#include "../Version.h"
#include "../Common/Gfx/CanvasGDIP.h"
#include "../Common/Gfx/CanvasD2D.h"
#include "../Common/Gfx/CanvasGDIP.h"

using namespace Gdiplus;

Expand Down Expand Up @@ -143,7 +143,7 @@ CMeterWindow::CMeterWindow(const std::wstring& folderPath, const std::wstring& f
m_FontCollection(),
m_ToolTipHidden(false)
{
m_Canvas = Platform::IsAtLeastWinVista() ?
m_Canvas = (Platform::IsAtLeastWinVista() && Rainmeter->CanUseD2D()) ?
(Gfx::Canvas*)new Gfx::CanvasD2D() : (Gfx::Canvas*)new Gfx::CanvasGDIP();

if (!c_DwmInstance && Platform::IsAtLeastWinVista())
Expand Down
3 changes: 3 additions & 0 deletions Library/Rainmeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ void CRainmeter::Bang_Log(std::vector<std::wstring>& args)
*/
CRainmeter::CRainmeter() :
m_TrayWindow(),
m_UseD2D(false),
m_Debug(false),
m_DisableVersionCheck(false),
m_NewVersion(false),
Expand Down Expand Up @@ -2456,6 +2457,8 @@ void CRainmeter::ReadGeneralSettings(const std::wstring& iniFile)
CConfigParser parser;
parser.Initialize(iniFile, NULL, NULL);

m_UseD2D = 0!=parser.ReadInt(L"Rainmeter", L"UseD2D", 0);

// Read Logging settings
m_Logging = 0!=parser.ReadInt(L"Rainmeter", L"Logging", 0);
m_Debug = 0!=parser.ReadInt(L"Rainmeter", L"Debug", 0);
Expand Down
4 changes: 4 additions & 0 deletions Library/Rainmeter.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ class CRainmeter
HINSTANCE GetResourceInstance() { return m_ResourceInstance; }
LCID GetResourceLCID() { return m_ResourceLCID; }

bool CanUseD2D() const { return m_UseD2D; }

bool GetDebug() { return m_Debug; }

GlobalOptions& GetGlobalOptions() { return m_GlobalOptions; }
Expand Down Expand Up @@ -298,6 +300,8 @@ class CRainmeter
std::wstring m_TrayExecuteDR;
std::wstring m_TrayExecuteDM;

bool m_UseD2D;

bool m_Debug;

bool m_DisableVersionCheck;
Expand Down

0 comments on commit 0994fad

Please sign in to comment.