From 21d9c0698f8e9d25bcdbb36a85b8e04ac304b8e6 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sun, 29 Sep 2013 17:57:21 +0300 Subject: [PATCH] Gfx: Additional changes to d003db6 --- Common/Gfx/CanvasD2D.cpp | 3 ++- Common/Gfx/CanvasD2D.h | 2 +- Library/MeterWindow.cpp | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Common/Gfx/CanvasD2D.cpp b/Common/Gfx/CanvasD2D.cpp index b9fde5cb..7fdda12f 100644 --- a/Common/Gfx/CanvasD2D.cpp +++ b/Common/Gfx/CanvasD2D.cpp @@ -305,9 +305,10 @@ void CanvasD2D::SetTextRenderingOptions(float gamma, float enhancedContrast) HRESULT hr = c_DWFactory->CreateRenderingParams(defaultRenderingParams.GetAddressOf()); if (SUCCEEDED(hr)) { - hr = c_DWFactory->CreateCustomRenderingParams( + hr = ((IDWriteFactory1*)c_DWFactory.Get())->CreateCustomRenderingParams( gamma, enhancedContrast, + enhancedContrast, defaultRenderingParams->GetClearTypeLevel(), defaultRenderingParams->GetPixelGeometry(), defaultRenderingParams->GetRenderingMode(), diff --git a/Common/Gfx/CanvasD2D.h b/Common/Gfx/CanvasD2D.h index 2f578713..a0a1668a 100644 --- a/Common/Gfx/CanvasD2D.h +++ b/Common/Gfx/CanvasD2D.h @@ -91,7 +91,7 @@ private: void UpdateTargetTransform(); Microsoft::WRL::ComPtr m_Target; - Microsoft::WRL::ComPtr m_TextRenderingParams; + Microsoft::WRL::ComPtr m_TextRenderingParams; // Underlying pixel data shared by both m_Target and m_GdipBitmap. Util::WICBitmapDIB m_Bitmap; diff --git a/Library/MeterWindow.cpp b/Library/MeterWindow.cpp index 93e8e3e5..cc984bd9 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -2080,6 +2080,12 @@ bool MeterWindow::ReadSkin() m_Canvas = Gfx::Canvas::Create(useD2D ? Gfx::Renderer::PreferD2D : Gfx::Renderer::GDIP); m_Canvas->SetAccurateText(m_Parser.ReadBool(L"Rainmeter", L"AccurateText", false)); + const auto d2dParams = m_Parser.ReadFloats(L"Rainmeter", L"__D2DParams"); + if (d2dParams.size() == 2) + { + m_Canvas->SetTextRenderingOptions(d2dParams[0], d2dParams[1]); + } + // Gotta have some kind of buffer during initialization CreateDoubleBuffer(1, 1);