X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4ee4c7b948e76377a6947d3ffbe5099870d0c3e9..424da8bdb9f05243d8888d78a56ab0cc3f615a6c:/src/msw/graphics.cpp diff --git a/src/msw/graphics.cpp b/src/msw/graphics.cpp index 8eb6374851..52c809b805 100644 --- a/src/msw/graphics.cpp +++ b/src/msw/graphics.cpp @@ -40,6 +40,9 @@ #include "wx/private/graphics.h" #include "wx/msw/wrapgdip.h" #include "wx/msw/dc.h" +#if wxUSE_ENH_METAFILE + #include "wx/msw/enhmeta.h" +#endif #include "wx/dcgraph.h" #include "wx/msw/private.h" // needs to be before #include @@ -1043,7 +1046,7 @@ void wxGDIPlusMatrixData::Scale( wxDouble xScale , wxDouble yScale ) // add the rotation to this matrix (radians) void wxGDIPlusMatrixData::Rotate( wxDouble angle ) { - m_matrix->Rotate( angle ); + m_matrix->Rotate( RadToDeg(angle) ); } // @@ -1151,6 +1154,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() @@ -1496,6 +1507,8 @@ void wxGDIPlusContext::GetTextExtent( const wxString &str, wxDouble *width, wxDo m_context->MeasureString((const wchar_t *) s , wcslen(s) , f, layoutRect, &strFormat, &bounds ) ; if ( width ) *width = bounds.Width; + if ( height ) + *height = bounds.Height; } } @@ -1619,7 +1632,13 @@ public : virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc); +#if wxUSE_PRINTING_ARCHITECTURE virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc); +#endif + +#if wxUSE_ENH_METAFILE + virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc); +#endif virtual wxGraphicsContext * CreateContextFromNativeContext( void * context ); @@ -1745,6 +1764,7 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxWindowDC& dc) return new wxGDIPlusContext(this,(HDC) msw->GetHDC(), sz.x, sz.y); } +#if wxUSE_PRINTING_ARCHITECTURE wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxPrinterDC& dc) { ENSURE_LOADED_OR_RETURN(NULL); @@ -1752,6 +1772,17 @@ wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxPrinterDC& dc) wxSize sz = dc.GetSize(); return new wxGDIPlusContext(this,(HDC) msw->GetHDC(), sz.x, sz.y); } +#endif + +#if wxUSE_ENH_METAFILE +wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxEnhMetaFileDC& dc) +{ + ENSURE_LOADED_OR_RETURN(NULL); + wxMSWDCImpl *msw = wxDynamicCast( dc.GetImpl() , wxMSWDCImpl ); + wxSize sz = dc.GetSize(); + return new wxGDIPlusContext(this,(HDC) msw->GetHDC(), sz.x, sz.y); +} +#endif wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxMemoryDC& dc) {