From a53b5e867be984d9fbf540f89fcc5f6e7960d372 Mon Sep 17 00:00:00 2001 From: Jaakko Salli Date: Mon, 10 May 2010 13:52:12 +0000 Subject: [PATCH] Set wxGraphicsContext page scale, which is required for printing to work properly git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64271 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/graphics.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/msw/graphics.cpp b/src/msw/graphics.cpp index 8eb6374851..03037d82b3 100644 --- a/src/msw/graphics.cpp +++ b/src/msw/graphics.cpp @@ -1151,6 +1151,14 @@ void wxGDIPlusContext::SetDefaults() m_context->SetSmoothingMode(SmoothingModeHighQuality); m_state1 = m_context->Save(); m_state2 = m_context->Save(); + + // Setup page scale, based on DPI ratio. + // Antecedent should be 100dpi when the default page unit (UnitDisplay) + // is used. Page unit UnitDocument would require 300dpi instead. + // Note that calling SetPageScale() does not have effect on non-printing + // DCs (that is, any other than wxPrinterDC or wxEnhMetaFileDC). + REAL dpiRatio = 100.0 / m_context->GetDpiY(); + m_context->SetPageScale(dpiRatio); } wxGDIPlusContext::~wxGDIPlusContext() -- 2.47.2