From c1aa19123593b412560ac808ef4c6c5d473fbaef Mon Sep 17 00:00:00 2001 From: Birunthan Mohanathas Date: Sat, 28 Sep 2013 17:51:05 +0300 Subject: [PATCH] Gfx: Use GDI+ instead of D2D when drawing scaled images --- Common/Gfx/CanvasD2D.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Common/Gfx/CanvasD2D.cpp b/Common/Gfx/CanvasD2D.cpp index 7366d94a..fe1c7d12 100644 --- a/Common/Gfx/CanvasD2D.cpp +++ b/Common/Gfx/CanvasD2D.cpp @@ -409,6 +409,14 @@ bool CanvasD2D::MeasureTextLinesW(const WCHAR* str, UINT strLen, const TextForma void CanvasD2D::DrawBitmap(Gdiplus::Bitmap* bitmap, const Gdiplus::Rect& dstRect, const Gdiplus::Rect& srcRect) { + if (srcRect.Width != dstRect.Width || srcRect.Height != dstRect.Height) + { + // If the bitmap needs to be scaled, get rid of the D2D target and use the GDI+ code path + // to draw the bitmap. This is due to antialiasing differences between GDI+ and D2D on + // scaled bitmaps. + EndTargetDraw(); + } + if (!m_Target) // Use GDI+ if D2D render target has not been created. { m_GdipGraphics->DrawImage(