From 2fb733ef75aeeac51e875087928aa7863c8ba78a Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sun, 6 Oct 2013 17:07:00 +0300 Subject: [PATCH] Gfx: Remove __D2DParams --- Common/Gfx/Canvas.h | 3 --- Common/Gfx/CanvasD2D.cpp | 26 -------------------------- Common/Gfx/CanvasD2D.h | 2 -- Library/MeterWindow.cpp | 6 ------ 4 files changed, 37 deletions(-) diff --git a/Common/Gfx/Canvas.h b/Common/Gfx/Canvas.h index c64170ca..5b7b88dd 100644 --- a/Common/Gfx/Canvas.h +++ b/Common/Gfx/Canvas.h @@ -84,9 +84,6 @@ public: virtual void SetAntiAliasing(bool enable) = 0; virtual void SetTextAntiAliasing(bool enable) = 0; - // FIXME: Temporary hack to test things out. This will be removed when no longer needed. - virtual void SetTextRenderingOptions(float gamma, float enhancedContrast) {}; - virtual void Clear(const Gdiplus::Color& color = Gdiplus::Color(0, 0, 0, 0)) = 0; virtual void DrawTextW(const WCHAR* str, UINT strLen, const TextFormat& format, Gdiplus::RectF& rect, const Gdiplus::SolidBrush& brush) = 0; diff --git a/Common/Gfx/CanvasD2D.cpp b/Common/Gfx/CanvasD2D.cpp index 7fdda12f..fe1c7d12 100644 --- a/Common/Gfx/CanvasD2D.cpp +++ b/Common/Gfx/CanvasD2D.cpp @@ -167,10 +167,6 @@ bool CanvasD2D::BeginTargetDraw() if (SUCCEEDED(hr)) { SetTextAntiAliasing(m_TextAntiAliasing); - if (m_TextRenderingParams) - { - m_Target->SetTextRenderingParams(m_TextRenderingParams.Get()); - } m_Target->BeginDraw(); @@ -299,28 +295,6 @@ void CanvasD2D::SetTextAntiAliasing(bool enable) } } -void CanvasD2D::SetTextRenderingOptions(float gamma, float enhancedContrast) -{ - Microsoft::WRL::ComPtr defaultRenderingParams; - HRESULT hr = c_DWFactory->CreateRenderingParams(defaultRenderingParams.GetAddressOf()); - if (SUCCEEDED(hr)) - { - hr = ((IDWriteFactory1*)c_DWFactory.Get())->CreateCustomRenderingParams( - gamma, - enhancedContrast, - enhancedContrast, - defaultRenderingParams->GetClearTypeLevel(), - defaultRenderingParams->GetPixelGeometry(), - defaultRenderingParams->GetRenderingMode(), - m_TextRenderingParams.ReleaseAndGetAddressOf()); - } - - if (SUCCEEDED(hr) && m_Target) - { - m_Target->SetTextRenderingParams(m_TextRenderingParams.Get()); - } -} - void CanvasD2D::Clear(const Gdiplus::Color& color) { if (!m_Target) // Use GDI+ if D2D render target has not been created. diff --git a/Common/Gfx/CanvasD2D.h b/Common/Gfx/CanvasD2D.h index e403583f..25039761 100644 --- a/Common/Gfx/CanvasD2D.h +++ b/Common/Gfx/CanvasD2D.h @@ -63,7 +63,6 @@ public: virtual void SetAntiAliasing(bool enable) override; virtual void SetTextAntiAliasing(bool enable) override; - virtual void SetTextRenderingOptions(float gamma, float enhancedContrast) override; virtual void Clear(const Gdiplus::Color& color) override; @@ -91,7 +90,6 @@ private: void UpdateTargetTransform(); Microsoft::WRL::ComPtr m_Target; - 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 3c472b01..eb394635 100644 --- a/Library/MeterWindow.cpp +++ b/Library/MeterWindow.cpp @@ -2081,12 +2081,6 @@ bool MeterWindow::ReadSkin() m_UseD2D && GetRainmeter().GetUseD2D() ? 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);