wxDC scaling fix patch (Derry Bryson)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9240 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -38,8 +38,10 @@ wxDC::wxDC()
|
||||
{
|
||||
m_ok = FALSE;
|
||||
|
||||
m_mm_to_pix_x = 1.0;
|
||||
m_mm_to_pix_y = 1.0;
|
||||
m_mm_to_pix_x = (double)wxGetDisplaySize().GetWidth() /
|
||||
(double)wxGetDisplaySizeMM().GetWidth();
|
||||
m_mm_to_pix_y = (double)wxGetDisplaySize().GetHeight() /
|
||||
(double)wxGetDisplaySizeMM().GetHeight();
|
||||
|
||||
m_needComputeScaleX = FALSE; /* not used yet */
|
||||
m_needComputeScaleY = FALSE; /* not used yet */
|
||||
@@ -74,8 +76,8 @@ void wxDC::DoGetSizeMM( int* width, int* height ) const
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
GetSize( &w, &h );
|
||||
if (width) *width = int( double(w) / (m_scaleX*m_mm_to_pix_x) );
|
||||
if (height) *height = int( double(h) / (m_scaleY*m_mm_to_pix_y) );
|
||||
if (width) *width = int( double(w) / (m_userScaleX*m_mm_to_pix_x) );
|
||||
if (height) *height = int( double(h) / (m_userScaleY*m_mm_to_pix_y) );
|
||||
}
|
||||
|
||||
// Resolution in pixels per logical inch
|
||||
|
@@ -2041,7 +2041,7 @@ void wxWindowDC::ComputeScaleAndOrigin()
|
||||
// Resolution in pixels per logical inch
|
||||
wxSize wxWindowDC::GetPPI() const
|
||||
{
|
||||
return wxSize(100, 100);
|
||||
return wxSize(m_mm_to_pix_x * 25.4 + 0.5, m_mm_to_pix_y * 25.4 + 0.5);
|
||||
}
|
||||
|
||||
int wxWindowDC::GetDepth() const
|
||||
|
Reference in New Issue
Block a user