mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
Gfx: Tweaks
This commit is contained in:
parent
5bf776090d
commit
056277ce4f
@ -275,9 +275,10 @@ void CanvasD2D::DrawTextW(const WCHAR* str, UINT strLen, const TextFormat& forma
|
||||
brush.GetColor(&color);
|
||||
|
||||
ID2D1SolidColorBrush* solidBrush;
|
||||
m_Target->CreateSolidColorBrush(ToColorF(color), &solidBrush);
|
||||
|
||||
bool right = ((TextFormatD2D&)format).GetHorizontalAlignment() == Gfx::HorizontalAlignment::Right;
|
||||
HRESULT hr = m_Target->CreateSolidColorBrush(ToColorF(color), &solidBrush);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
const bool right = ((TextFormatD2D&)format).GetHorizontalAlignment() == Gfx::HorizontalAlignment::Right;
|
||||
|
||||
// TODO: Draw cached layout?
|
||||
//m_Target->DrawTextLayout(
|
||||
@ -285,16 +286,17 @@ void CanvasD2D::DrawTextW(const WCHAR* str, UINT strLen, const TextFormat& forma
|
||||
// textLayout,
|
||||
// solidBrush);
|
||||
|
||||
m_Target->DrawTextW(
|
||||
str,
|
||||
strLen,
|
||||
((TextFormatD2D&)format).m_TextFormat,
|
||||
D2D1::RectF(right ? rect.X - 2 : rect.X + 2.0f, rect.Y - 1.0f, (right ? rect.X - 2 : rect.X + 2.0f) + rect.Width, rect.Y + rect.Height - 1.0f),
|
||||
solidBrush,
|
||||
D2D1_DRAW_TEXT_OPTIONS_NONE);
|
||||
auto dst = D2D1::RectF(
|
||||
right ? rect.X - 2 : rect.X + 2.0f,
|
||||
rect.Y - 1.0f,
|
||||
(right ? rect.X - 2 : rect.X + 2.0f) + rect.Width,
|
||||
rect.Y + rect.Height - 1.0f);
|
||||
|
||||
m_Target->DrawTextW(str, strLen, ((TextFormatD2D&)format).m_TextFormat, dst, solidBrush);
|
||||
|
||||
solidBrush->Release();
|
||||
}
|
||||
}
|
||||
|
||||
bool CanvasD2D::MeasureTextW(const WCHAR* str, UINT strLen, const TextFormat& format, Gdiplus::RectF& rect)
|
||||
{
|
||||
@ -396,11 +398,12 @@ void CanvasD2D::FillRectangle(Gdiplus::Rect& rect, const Gdiplus::SolidBrush& br
|
||||
brush.GetColor(&color);
|
||||
|
||||
ID2D1SolidColorBrush* solidBrush;
|
||||
m_Target->CreateSolidColorBrush(ToColorF(color), &solidBrush);
|
||||
|
||||
HRESULT hr = m_Target->CreateSolidColorBrush(ToColorF(color), &solidBrush);
|
||||
if (SUCCEEDED(hr))
|
||||
{
|
||||
m_Target->FillRectangle(ToRectF(rect), solidBrush);
|
||||
|
||||
solidBrush->Release();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Gfx
|
Loading…
Reference in New Issue
Block a user