From 616f986181c8b26da8e22ecebf2604815bf15052 Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sat, 10 Aug 2013 12:13:59 +0300 Subject: [PATCH] Gfx: Make D2D clip text that overflows the bounding box similarly to GDI+ --- Common/Gfx/CanvasD2D.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Common/Gfx/CanvasD2D.cpp b/Common/Gfx/CanvasD2D.cpp index d0fd1601..70d57629 100644 --- a/Common/Gfx/CanvasD2D.cpp +++ b/Common/Gfx/CanvasD2D.cpp @@ -341,10 +341,15 @@ void CanvasD2D::DrawTextW(const WCHAR* str, UINT strLen, const TextFormat& forma textLayout->SetCharacterSpacing(emOffset, emOffset, 0.0f, range); } + // TODO: Check for transformation. + m_Target->PushAxisAlignedClip(ToRectF(rect), D2D1_ANTIALIAS_MODE_ALIASED); + m_Target->DrawTextLayout( D2D1::Point2F(xPos, rect.Y - 1.0f), formatD2D.m_TextLayout.Get(), solidBrush.Get()); + + m_Target->PopAxisAlignedClip(); } }