]> git.saurik.com Git - wxWidgets.git/commitdiff
Set wxGraphicsContext page scale, which is required for printing to work properly
authorJaakko Salli <jaakko.salli@dnainternet.net>
Mon, 10 May 2010 13:52:12 +0000 (13:52 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Mon, 10 May 2010 13:52:12 +0000 (13:52 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64271 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/graphics.cpp

index 8eb63748514c144e387f2dd96d7373062b931016..03037d82b39d044476c00cf5e6c19301e86149c5 100644 (file)
@@ -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()