From: Włodzimierz Skiba Date: Tue, 7 Dec 2004 20:10:40 +0000 (+0000) Subject: Fix to FIXME about using unused Get/SetOptimization. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ea76a6a5ca75f8e623982de97f7f7b2746b5ee50 Fix to FIXME about using unused Get/SetOptimization. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30895 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/contrib/docs/latex/svg/dcsvg.tex b/contrib/docs/latex/svg/dcsvg.tex index fbaf2a6710..fb4ee445e8 100644 --- a/contrib/docs/latex/svg/dcsvg.tex +++ b/contrib/docs/latex/svg/dcsvg.tex @@ -169,7 +169,7 @@ The arc is drawn in an anticlockwise direction from the start point to the end p \func{void}{DrawBitmap}{\param{const wxBitmap\&}{ bitmap}, \param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{bool}{ transparent}} -Draw a bitmap on the device context at the specified point. If {\it transparent} is TRUE and the bitmap has +Draw a bitmap on the device context at the specified point. If {\it transparent} is true and the bitmap has a transparency mask, the bitmap will be drawn transparently. When drawing a mono-bitmap, the current text foreground colour will be used to draw the foreground @@ -433,12 +433,6 @@ Gets the current logical function (see \helpref{wxSVGFileDC::SetLogicalFunction} Gets the {\it mapping mode} for the device context (see \helpref{wxSVGFileDC::SetMapMode}{wxdcsetmapmode}). -\membersection{wxSVGFileDC::GetOptimization}\label{wxdcgetoptimization} - -\func{bool}{GetOptimization}{\void} - -Always returns TRUE, with an assertion in debug mode that optimisation is not implemented - \membersection{wxSVGFileDC::GetPen}\label{wxdcgetpen} \func{wxPen\&}{GetPen}{\void} @@ -561,7 +555,7 @@ Gets the minimum vertical extent used in drawing commands so far. \func{bool}{Ok}{\void} -Returns TRUE if the DC is ok to use; False values arise from being unable to +Returns true if the DC is ok to use; False values arise from being unable to write the file \membersection{wxSVGFileDC::ResetBoundingBox}\label{wxdcresetboundingbox} @@ -695,12 +689,6 @@ The mapping mode can be one of the following: \twocolitem{wxMM\_TEXT}{Each logical unit is 1 pixel.} \end{twocollist} -\membersection{wxSVGFileDC::SetOptimization}\label{wxsetoptimization} - -\func{void}{SetOptimization}{\param{bool }{optimize}} - -Does nothing - \membersection{wxSVGFileDC::SetPen}\label{wxdcsetpen} \func{void}{SetPen}{\param{const wxPen\& }{pen}} diff --git a/contrib/include/wx/svg/dcsvg.h b/contrib/include/wx/svg/dcsvg.h index fefeea5084..0cae7be4a8 100644 --- a/contrib/include/wx/svg/dcsvg.h +++ b/contrib/include/wx/svg/dcsvg.h @@ -38,31 +38,31 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC int m_sub_images ; bool m_OK, m_graphics_changed ; int m_width, m_height ; - - double + + double m_logicalScaleX, m_logicalScaleY, m_userScaleX, m_userScaleY, m_scaleX, m_scaleY, - m_OriginX, + m_OriginX, m_OriginY, m_mm_to_pix_x, m_mm_to_pix_y; - bool - m_needComputeScaleX, + bool + m_needComputeScaleX, m_needComputeScaleY; // not yet used - - bool DoGetPixel(wxCoord, wxCoord, class wxColour *) const - { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); return TRUE ; }; + + bool DoGetPixel(wxCoord, wxCoord, class wxColour *) const + { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); return true; }; virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, class wxDC *, wxCoord, wxCoord, int = wxCOPY, bool = 0, int = -1, int = -1) ; - void DoCrossHair(wxCoord, wxCoord) + void DoCrossHair(wxCoord, wxCoord) { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::CrossHair Call not implemented")); return ; }; void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord); @@ -99,7 +99,7 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC void DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, wxFont *font = NULL) const ; - void DoSetClippingRegionAsRegion(const class wxRegion &) + void DoSetClippingRegionAsRegion(const class wxRegion &) { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::DoSetClippingRegionAsRegion Call not yet implemented")); return ; }; void Init (wxString f, int Width, int Height, float dpi); @@ -191,7 +191,7 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC return (wxCoord)((double)(y) * m_scaleY - 0.5); } - void write(const wxString &s); + void write(const wxString &s); public: @@ -201,13 +201,13 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC ~wxSVGFileDC(); - bool CanDrawBitmap() const { return TRUE ; }; + bool CanDrawBitmap() const { return true; }; - bool CanGetTextExtent() const { return TRUE ; }; + bool CanGetTextExtent() const { return true; }; int GetDepth() const { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::GetDepth Call not implemented")); return -1 ; }; - + void BeginDrawing() { return;}; bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC* source, wxCoord xsrc, wxCoord ysrc, int logicalFunc = wxCOPY, bool useMask = FALSE) @@ -235,7 +235,6 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool transparent) { DoDrawBitmap ( bitmap, x, y, transparent ) ; return ;}; - void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) {DoDrawIcon(icon, x, y) ; return ; }; @@ -265,9 +264,6 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC int GetMapMode() ; - bool GetOptimization() - { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::GetOptimization() No optimization code used")); return TRUE ; }; - bool GetPixel(wxCoord x, wxCoord y, wxColour *colour) { return DoGetPixel (x, y, colour) ; } ; @@ -310,8 +306,6 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC void SetMapMode(int anint) ; - void SetOptimization(bool WXUNUSED(optimize)) { return ; }; - void SetPen(const wxPen& pen) ; void SetUserScale(double xScale, double yScale) ; diff --git a/docs/latex/wx/dc.tex b/docs/latex/wx/dc.tex index 2ac964b21f..c2f28ef4b0 100644 --- a/docs/latex/wx/dc.tex +++ b/docs/latex/wx/dc.tex @@ -664,14 +664,6 @@ Gets the current logical function (see \helpref{wxDC::SetLogicalFunction}{wxdcse Gets the {\it mapping mode} for the device context (see \helpref{wxDC::SetMapMode}{wxdcsetmapmode}). -\membersection{wxDC::GetOptimization}\label{wxdcgetoptimization} - -\func{bool}{GetOptimization}{\void} - -Returns true if device context optimization is on. -See \helpref{wxDC::SetOptimization}{wxsetoptimization} for details. - - \membersection{wxDC::GetPartialTextExtents}\label{wxdcgetpartialtextextents} \constfunc{bool}{GetPartialTextExtents}{\param{const wxString\& }{text}, @@ -1059,21 +1051,6 @@ The mapping mode can be one of the following: \end{twocollist} -\membersection{wxDC::SetOptimization}\label{wxsetoptimization} - -\func{void}{SetOptimization}{\param{bool }{optimize}} - -If {\it optimize} is true (the default), this function sets optimization mode on. -This currently means that under X, the device context will not try to set a pen or brush -property if it is known to be set already. This approach can fall down -if non-wxWidgets code is using the same device context or window, for example -when the window is a panel on which the windowing system draws panel items. -The wxWidgets device context 'memory' will now be out of step with reality. - -Setting optimization off, drawing, then setting it back on again, is a trick -that must occasionally be employed. - - \membersection{wxDC::SetPalette}\label{wxdcsetpalette} \func{void}{SetPalette}{\param{const wxPalette\& }{palette}} diff --git a/docs/latex/wx/dcsvg.tex b/docs/latex/wx/dcsvg.tex index fbaf2a6710..fb4ee445e8 100644 --- a/docs/latex/wx/dcsvg.tex +++ b/docs/latex/wx/dcsvg.tex @@ -169,7 +169,7 @@ The arc is drawn in an anticlockwise direction from the start point to the end p \func{void}{DrawBitmap}{\param{const wxBitmap\&}{ bitmap}, \param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{bool}{ transparent}} -Draw a bitmap on the device context at the specified point. If {\it transparent} is TRUE and the bitmap has +Draw a bitmap on the device context at the specified point. If {\it transparent} is true and the bitmap has a transparency mask, the bitmap will be drawn transparently. When drawing a mono-bitmap, the current text foreground colour will be used to draw the foreground @@ -433,12 +433,6 @@ Gets the current logical function (see \helpref{wxSVGFileDC::SetLogicalFunction} Gets the {\it mapping mode} for the device context (see \helpref{wxSVGFileDC::SetMapMode}{wxdcsetmapmode}). -\membersection{wxSVGFileDC::GetOptimization}\label{wxdcgetoptimization} - -\func{bool}{GetOptimization}{\void} - -Always returns TRUE, with an assertion in debug mode that optimisation is not implemented - \membersection{wxSVGFileDC::GetPen}\label{wxdcgetpen} \func{wxPen\&}{GetPen}{\void} @@ -561,7 +555,7 @@ Gets the minimum vertical extent used in drawing commands so far. \func{bool}{Ok}{\void} -Returns TRUE if the DC is ok to use; False values arise from being unable to +Returns true if the DC is ok to use; False values arise from being unable to write the file \membersection{wxSVGFileDC::ResetBoundingBox}\label{wxdcresetboundingbox} @@ -695,12 +689,6 @@ The mapping mode can be one of the following: \twocolitem{wxMM\_TEXT}{Each logical unit is 1 pixel.} \end{twocollist} -\membersection{wxSVGFileDC::SetOptimization}\label{wxsetoptimization} - -\func{void}{SetOptimization}{\param{bool }{optimize}} - -Does nothing - \membersection{wxSVGFileDC::SetPen}\label{wxdcsetpen} \func{void}{SetPen}{\param{const wxPen\& }{pen}} diff --git a/include/wx/dc.h b/include/wx/dc.h index d696bcb49e..bb485c7aca 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -534,12 +534,10 @@ public: int GetLogicalFunction() const { return m_logicalFunction; } virtual void SetLogicalFunction(int function) = 0; - // Sometimes we need to override optimization, e.g. if other software is - // drawing onto our surface and we can't be sure of who's done what. - // - // FIXME: is this (still) used? +#if WXWIN_COMPATIBILITY_2_4 virtual void SetOptimization(bool WXUNUSED(opt)) { } virtual bool GetOptimization() { return false; } +#endif // bounding box // ------------ diff --git a/include/wx/dcsvg.h b/include/wx/dcsvg.h index fefeea5084..0cae7be4a8 100644 --- a/include/wx/dcsvg.h +++ b/include/wx/dcsvg.h @@ -38,31 +38,31 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC int m_sub_images ; bool m_OK, m_graphics_changed ; int m_width, m_height ; - - double + + double m_logicalScaleX, m_logicalScaleY, m_userScaleX, m_userScaleY, m_scaleX, m_scaleY, - m_OriginX, + m_OriginX, m_OriginY, m_mm_to_pix_x, m_mm_to_pix_y; - bool - m_needComputeScaleX, + bool + m_needComputeScaleX, m_needComputeScaleY; // not yet used - - bool DoGetPixel(wxCoord, wxCoord, class wxColour *) const - { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); return TRUE ; }; + + bool DoGetPixel(wxCoord, wxCoord, class wxColour *) const + { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); return true; }; virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, class wxDC *, wxCoord, wxCoord, int = wxCOPY, bool = 0, int = -1, int = -1) ; - void DoCrossHair(wxCoord, wxCoord) + void DoCrossHair(wxCoord, wxCoord) { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::CrossHair Call not implemented")); return ; }; void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord); @@ -99,7 +99,7 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC void DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, wxFont *font = NULL) const ; - void DoSetClippingRegionAsRegion(const class wxRegion &) + void DoSetClippingRegionAsRegion(const class wxRegion &) { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::DoSetClippingRegionAsRegion Call not yet implemented")); return ; }; void Init (wxString f, int Width, int Height, float dpi); @@ -191,7 +191,7 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC return (wxCoord)((double)(y) * m_scaleY - 0.5); } - void write(const wxString &s); + void write(const wxString &s); public: @@ -201,13 +201,13 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC ~wxSVGFileDC(); - bool CanDrawBitmap() const { return TRUE ; }; + bool CanDrawBitmap() const { return true; }; - bool CanGetTextExtent() const { return TRUE ; }; + bool CanGetTextExtent() const { return true; }; int GetDepth() const { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::GetDepth Call not implemented")); return -1 ; }; - + void BeginDrawing() { return;}; bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC* source, wxCoord xsrc, wxCoord ysrc, int logicalFunc = wxCOPY, bool useMask = FALSE) @@ -235,7 +235,6 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool transparent) { DoDrawBitmap ( bitmap, x, y, transparent ) ; return ;}; - void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) {DoDrawIcon(icon, x, y) ; return ; }; @@ -265,9 +264,6 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC int GetMapMode() ; - bool GetOptimization() - { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::GetOptimization() No optimization code used")); return TRUE ; }; - bool GetPixel(wxCoord x, wxCoord y, wxColour *colour) { return DoGetPixel (x, y, colour) ; } ; @@ -310,8 +306,6 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC void SetMapMode(int anint) ; - void SetOptimization(bool WXUNUSED(optimize)) { return ; }; - void SetPen(const wxPen& pen) ; void SetUserScale(double xScale, double yScale) ; diff --git a/src/motif/dcclient.cpp b/src/motif/dcclient.cpp index e082c7e640..97cfb8a329 100644 --- a/src/motif/dcclient.cpp +++ b/src/motif/dcclient.cpp @@ -96,6 +96,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC) #define IS_HATCH(s) ((s)>=wxFIRST_HATCH && (s)<=wxLAST_HATCH) #endif +// FIXME: left over after removal of wxDC::GetOptimization() +#define GET_OPTIMIZATION false + // ---------------------------------------------------------------------------- // prototypes // ---------------------------------------------------------------------------- @@ -1085,7 +1088,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) sameColour = (sameColour && (oldPenColour.GetPixel() == m_textBackgroundColour.GetPixel())); - if (!sameColour || !GetOptimization()) + if (!sameColour || !GET_OPTIMIZATION) { int pixel = m_textBackgroundColour.AllocColour(m_display); m_currentColour = m_textBackgroundColour; @@ -1118,7 +1121,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) (oldPenColour.Green () == m_currentColour.Green ()) && (oldPenColour.GetPixel() == m_currentColour.GetPixel())); - if (!sameColour || !GetOptimization()) + if (!sameColour || !GET_OPTIMIZATION) { int pixel = CalculatePixel(m_textForegroundColour, m_currentColour, false); @@ -1592,7 +1595,7 @@ void wxWindowDC::SetPen( const wxPen &pen ) (oldPenColour.Green () == m_currentColour.Green ()) && (oldPenColour.GetPixel() == m_currentColour.GetPixel())); - if (!sameStyle || !GetOptimization()) + if (!sameStyle || !GET_OPTIMIZATION) { int scaled_width = (int) XLOG2DEVREL (m_pen.GetWidth ()); if (scaled_width < 0) @@ -1705,7 +1708,7 @@ void wxWindowDC::SetPen( const wxPen &pen ) XSetLineAttributes ((Display*) m_display,(GC) m_gcBacking, scaled_width, style, cap, join); } - if (IS_HATCH(m_currentFill) && ((m_currentFill != oldFill) || !GetOptimization())) + if (IS_HATCH(m_currentFill) && ((m_currentFill != oldFill) || !GET_OPTIMIZATION)) { Pixmap myStipple; @@ -1763,7 +1766,7 @@ void wxWindowDC::SetPen( const wxPen &pen ) XSetStipple ((Display*) m_display,(GC) m_gcBacking, myStipple); } else if (m_currentStipple.Ok() - && ((m_currentStipple != oldStipple) || !GetOptimization())) + && ((m_currentStipple != oldStipple) || !GET_OPTIMIZATION)) { XSetStipple ((Display*) m_display, (GC) m_gc, (Pixmap) m_currentStipple.GetDrawable()); @@ -1771,7 +1774,7 @@ void wxWindowDC::SetPen( const wxPen &pen ) XSetStipple ((Display*) m_display,(GC) m_gcBacking, (Pixmap) m_currentStipple.GetDrawable()); } - if ((m_currentFill != oldFill) || !GetOptimization()) + if ((m_currentFill != oldFill) || !GET_OPTIMIZATION) { int fill_style; @@ -1787,7 +1790,7 @@ void wxWindowDC::SetPen( const wxPen &pen ) } // must test m_logicalFunction, because it involves background! - if (!sameColour || !GetOptimization() + if (!sameColour || !GET_OPTIMIZATION || ((m_logicalFunction == wxXOR) || (m_autoSetting & 0x2))) { int pixel = -1; @@ -1837,7 +1840,7 @@ void wxWindowDC::SetBrush( const wxBrush &brush ) int stippleDepth = -1; - if ((oldFill != m_brush.GetStyle ()) || !GetOptimization()) + if ((oldFill != m_brush.GetStyle ()) || !GET_OPTIMIZATION) { switch (brush.GetStyle ()) { @@ -1876,7 +1879,7 @@ void wxWindowDC::SetBrush( const wxBrush &brush ) } } - if (IS_HATCH(m_currentFill) && ((m_currentFill != oldFill) || !GetOptimization())) + if (IS_HATCH(m_currentFill) && ((m_currentFill != oldFill) || !GET_OPTIMIZATION)) { Pixmap myStipple; @@ -1955,7 +1958,7 @@ void wxWindowDC::SetBrush( const wxBrush &brush ) } // must test m_logicalFunction, because it involves background! - if (!sameColour || !GetOptimization() || m_logicalFunction == wxXOR) + if (!sameColour || !GET_OPTIMIZATION || m_logicalFunction == wxXOR) { int pixel = CalculatePixel(m_brush.GetColour(), m_currentColour, true); diff --git a/src/motif/dcmemory.cpp b/src/motif/dcmemory.cpp index ce07b8fdd8..8bf23e219b 100644 --- a/src/motif/dcmemory.cpp +++ b/src/motif/dcmemory.cpp @@ -6,7 +6,7 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) @@ -38,11 +38,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)); @@ -52,28 +52,28 @@ 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)); @@ -83,9 +83,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); @@ -101,16 +101,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)); @@ -120,23 +120,17 @@ 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; - + 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); - + SetBrush (* wxWHITE_BRUSH); SetPen (* wxBLACK_PEN); - - SetOptimization(oldOpt); - } else { diff --git a/src/motif/utils.cpp b/src/motif/utils.cpp index 6f80f461de..682d39ed77 100644 --- a/src/motif/utils.cpp +++ b/src/motif/utils.cpp @@ -277,7 +277,7 @@ bool wxWriteResource(const wxString& section, const wxString& entry, const wxStr strcat (resName, entry.c_str()); XrmPutStringResource (&database, resName, value); - return TRUE; + return true; } bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file) @@ -354,7 +354,7 @@ bool wxGetResource(const wxString& section, const wxString& entry, char **value, *value = new char[xvalue.size + 1]; strncpy (*value, xvalue.addr, (int) xvalue.size); - return TRUE; + return true; } return FALSE; } @@ -367,7 +367,7 @@ bool wxGetResource(const wxString& section, const wxString& entry, float *value, { *value = (float)strtod(s, NULL); delete[] s; - return TRUE; + return true; } else return FALSE; } @@ -380,7 +380,7 @@ bool wxGetResource(const wxString& section, const wxString& entry, long *value, { *value = strtol(s, NULL, 10); delete[] s; - return TRUE; + return true; } else return FALSE; } @@ -402,7 +402,7 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c else *value = (int) strtol (s, NULL, 10); delete[] s; - return TRUE; + return true; } else return FALSE; @@ -528,7 +528,7 @@ void wxGetMousePosition( int* x, int* y ) #endif }; -// Return TRUE if we have a colour display +// Return true if we have a colour display bool wxColourDisplay() { return wxDisplayDepth() > 1; @@ -592,11 +592,11 @@ bool wxSetDisplay(const wxString& display_name) { gs_displayName = display_name; - if ( display_name.IsEmpty() ) + if ( display_name.empty() ) { gs_currentDisplay = NULL; - return TRUE; + return true; } else { @@ -617,7 +617,7 @@ bool wxSetDisplay(const wxString& display_name) if (display) { gs_currentDisplay = (WXDisplay*) display; - return TRUE; + return true; } else return FALSE; @@ -757,22 +757,22 @@ wxString wxGetXEventName(XEvent& event) return str; #else int type = event.xany.type; - static char* event_name[] = { - "", "unknown(-)", // 0-1 - "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", // 2-5 - "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", // 6-9 - "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", // 10-13 - "NoExpose", "VisibilityNotify", "CreateNotify", // 14-16 - "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest",// 17-20 - "ReparentNotify", "ConfigureNotify", "ConfigureRequest", // 21-23 - "GravityNotify", "ResizeRequest", "CirculateNotify", // 24-26 - "CirculateRequest", "PropertyNotify", "SelectionClear", // 27-29 - "SelectionRequest", "SelectionNotify", "ColormapNotify", // 30-32 - "ClientMessage", "MappingNotify", // 33-34 - "unknown(+)"}; // 35 - type = wxMin(35, type); type = wxMax(1, type); - wxString str(event_name[type]); - return str; + static char* event_name[] = { + "", "unknown(-)", // 0-1 + "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", // 2-5 + "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", // 6-9 + "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", // 10-13 + "NoExpose", "VisibilityNotify", "CreateNotify", // 14-16 + "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest",// 17-20 + "ReparentNotify", "ConfigureNotify", "ConfigureRequest", // 21-23 + "GravityNotify", "ResizeRequest", "CirculateNotify", // 24-26 + "CirculateRequest", "PropertyNotify", "SelectionClear", // 27-29 + "SelectionRequest", "SelectionNotify", "ColormapNotify", // 30-32 + "ClientMessage", "MappingNotify", // 33-34 + "unknown(+)"}; // 35 + type = wxMin(35, type); type = wxMax(1, type); + wxString str(event_name[type]); + return str; #endif } #endif @@ -976,11 +976,10 @@ wxBitmap wxCreateMaskedBitmap(const wxBitmap& bitmap, wxColour& colour) destDC.SelectObject(newBitmap); wxBrush brush(colour, wxSOLID); - // destDC.SetOptimization(FALSE); destDC.SetBackground(brush); destDC.Clear(); destDC.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(), - &srcDC, 0, 0, wxCOPY, TRUE); + &srcDC, 0, 0, wxCOPY, true); return newBitmap; }