X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/aae0472bf3086707216125e4caa8650caeeeaf97..4db6714b166a733177740b06cd21f31f4bb27896:/src/motif/dcmemory.cpp diff --git a/src/motif/dcmemory.cpp b/src/motif/dcmemory.cpp index 451576cf5e..19d75551f9 100644 --- a/src/motif/dcmemory.cpp +++ b/src/motif/dcmemory.cpp @@ -6,12 +6,11 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "dcmemory.h" -#endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" #include "wx/dcmemory.h" #include "wx/settings.h" @@ -35,11 +34,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxWindowDC) wxMemoryDC::wxMemoryDC(void) { - m_ok = TRUE; + m_ok = true; m_display = wxGetDisplay(); - + Display* display = (Display*) m_display; - + XGCValues gcvalues; gcvalues.foreground = BlackPixel (display, DefaultScreen (display)); gcvalues.background = WhitePixel (display, DefaultScreen (display)); @@ -49,28 +48,24 @@ wxMemoryDC::wxMemoryDC(void) m_gc = (WXGC) XCreateGC (display, RootWindow (display, DefaultScreen (display)), GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode, &gcvalues); - + m_backgroundPixel = (int) gcvalues.background; - - // Get the current Font so we can set it back later - XGCValues valReturn; - XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn); - m_oldFont = (WXFont) valReturn.font; + SetBrush (* wxWHITE_BRUSH); SetPen (* wxBLACK_PEN); - SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); + SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); }; wxMemoryDC::wxMemoryDC( wxDC* dc ) { - m_ok = TRUE; + m_ok = true; if (dc && dc->IsKindOf(CLASSINFO(wxWindowDC))) m_display = ((wxWindowDC*)dc)->GetDisplay(); else m_display = wxGetDisplay(); - + Display* display = (Display*) m_display; - + XGCValues gcvalues; gcvalues.foreground = BlackPixel (display, DefaultScreen (display)); gcvalues.background = WhitePixel (display, DefaultScreen (display)); @@ -80,13 +75,9 @@ wxMemoryDC::wxMemoryDC( wxDC* dc ) m_gc = (WXGC) XCreateGC (display, RootWindow (display, DefaultScreen (display)), GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode, &gcvalues); - + m_backgroundPixel = (int) gcvalues.background; - - // Get the current Font so we can set it back later - XGCValues valReturn; - XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn); - m_oldFont = (WXFont) valReturn.font; + SetBrush (* wxWHITE_BRUSH); SetPen (* wxBLACK_PEN); }; @@ -98,16 +89,16 @@ wxMemoryDC::~wxMemoryDC(void) void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) { m_bitmap = bitmap; - + if (m_gc) XFreeGC((Display*) m_display, (GC) m_gc); m_gc = (WXGC) NULL; - + if (m_bitmap.Ok() && (bitmap.GetDisplay() == m_display)) { m_pixmap = m_bitmap.GetDrawable(); Display* display = (Display*) m_display; - + XGCValues gcvalues; gcvalues.foreground = BlackPixel (display, DefaultScreen (display)); gcvalues.background = WhitePixel (display, DefaultScreen (display)); @@ -117,27 +108,16 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) m_gc = (WXGC) XCreateGC (display, (Drawable)m_pixmap/* RootWindow (display, DefaultScreen (display)) */, GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode, &gcvalues); - + m_backgroundPixel = (int) gcvalues.background; - m_ok = TRUE; - - // Get the current Font so we can set it back later - XGCValues valReturn; - XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn); - m_oldFont = (WXFont) valReturn.font; - - bool oldOpt = GetOptimization(); - SetOptimization(FALSE); - + m_ok = true; + SetBrush (* wxWHITE_BRUSH); SetPen (* wxBLACK_PEN); - - SetOptimization(oldOpt); - } else { - m_ok = FALSE; + m_ok = false; m_pixmap = (WXPixmap) 0; }; };