X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/72cdf4c9b3ce92addf09cfb322f0c19bfb0f8744..92dda0f7a31fdfeed083cd285b2900e6e9a83a0b:/src/gtk/dc.cpp diff --git a/src/gtk/dc.cpp b/src/gtk/dc.cpp index 489a2f102e..11b2991b40 100644 --- a/src/gtk/dc.cpp +++ b/src/gtk/dc.cpp @@ -3,19 +3,22 @@ // Purpose: // Author: Robert Roebling // RCS-ID: $Id$ -// Copyright: (c) 1998 Robert Roebling, Markus Holzem +// Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "dc.h" #endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #include "wx/dc.h" -#include "gdk/gdk.h" -#include "gtk/gtk.h" +#include +#include //----------------------------------------------------------------------------- // constants @@ -38,8 +41,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 */ @@ -69,19 +74,13 @@ void wxDC::DestroyClippingRegion() // get DC capabilities // --------------------------------------------------------------------------- -void wxDC::DoGetSize( int* width, int* height ) const -{ - if (width) *width = m_maxX-m_minX; - if (height) *height = m_maxY-m_minY; -} - 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