X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bc797f4cc8ffe36277ba8b7dd4b57e63a96bfcb5..670f9935630beb2123a5ca62894ae92a3f0efa4f:/src/x11/dc.cpp diff --git a/src/x11/dc.cpp b/src/x11/dc.cpp index c66c5f4797..e3f513a143 100644 --- a/src/x11/dc.cpp +++ b/src/x11/dc.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: dc.cpp +// Name: src/x11/dc.cpp // Purpose: wxDC class // Author: Julian Smart // Modified by: @@ -9,97 +9,55 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ - #pragma implementation "dc.h" -#endif +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" #include "wx/dc.h" #include "wx/dcmemory.h" -#include "wx/defs.h" IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) -//----------------------------------------------------------------------------- -// constants -//----------------------------------------------------------------------------- - -#define mm2inches 0.0393700787402 -#define inches2mm 25.4 -#define mm2twips 56.6929133859 -#define twips2mm 0.0176388888889 -#define mm2pt 2.83464566929 -#define pt2mm 0.352777777778 - //----------------------------------------------------------------------------- // wxDC //----------------------------------------------------------------------------- wxDC::wxDC() { - m_ok = FALSE; + m_ok = false; +#if 1 m_mm_to_pix_x = 1.0; m_mm_to_pix_y = 1.0; +#else + m_mm_to_pix_x = (double)wxGetDisplaySize().GetWidth() / + (double)wxGetDisplaySizeMM().GetWidth(); + m_mm_to_pix_y = (double)wxGetDisplaySize().GetHeight() / + (double)wxGetDisplaySizeMM().GetHeight(); +#endif - m_backgroundMode = wxTRANSPARENT; - - m_isInteractive = FALSE; -} - -void wxDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y) -{ - wxCHECK_RET( Ok(), "invalid dc" ); - wxCHECK_RET( icon.Ok(), "invalid icon" ); - - DoDrawBitmap(icon, x, y, TRUE); -} + m_needComputeScaleX = false; /* not used yet */ + m_needComputeScaleY = false; /* not used yet */ -void wxDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask ) -{ - wxCHECK_RET( bitmap.Ok(), "invalid bitmap" ); + m_logicalFunction = wxCOPY; - wxMemoryDC memDC; - memDC.SelectObject(bitmap); + m_pen = *wxBLACK_PEN; + m_font = *wxNORMAL_FONT; + m_brush = *wxWHITE_BRUSH; -#if 0 - // Not sure if we need this. The mask should leave the masked areas as per - // the original background of this DC. - if (useMask) - { - // There might be transparent areas, so make these the same colour as this - // DC - memDC.SetBackground(* GetBackground()); - memDC.Clear(); - } -#endif // 0 - - Blit(x, y, bitmap.GetWidth(), bitmap.GetHeight(), &memDC, 0, 0, wxCOPY, useMask); + m_backgroundMode = wxTRANSPARENT; - memDC.SelectObject(wxNullBitmap); + m_isInteractive = false; // ??? } void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) { - m_clipping = TRUE; + m_clipping = true; m_clipX1 = x; m_clipY1 = y; m_clipX2 = x + width; m_clipY2 = y + height; } -void wxDC::DestroyClippingRegion() -{ - m_clipping = FALSE; -} - -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, h; @@ -141,8 +99,8 @@ void wxDC::SetMapMode( int mode ) } if (mode != wxMM_TEXT) { - m_needComputeScaleX = TRUE; - m_needComputeScaleY = TRUE; + m_needComputeScaleX = true; + m_needComputeScaleY = true; } } @@ -229,4 +187,3 @@ void wxDC::ComputeScaleAndOrigin() m_scaleX = m_logicalScaleX * m_userScaleX; m_scaleY = m_logicalScaleY * m_userScaleY; } -