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
This commit is contained in:
Włodzimierz Skiba
2004-12-07 20:10:40 +00:00
parent c65650d7b5
commit ea76a6a5ca
9 changed files with 92 additions and 157 deletions

View File

@@ -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}} \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. 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 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}). 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} \membersection{wxSVGFileDC::GetPen}\label{wxdcgetpen}
\func{wxPen\&}{GetPen}{\void} \func{wxPen\&}{GetPen}{\void}
@@ -561,7 +555,7 @@ Gets the minimum vertical extent used in drawing commands so far.
\func{bool}{Ok}{\void} \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 write the file
\membersection{wxSVGFileDC::ResetBoundingBox}\label{wxdcresetboundingbox} \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.} \twocolitem{wxMM\_TEXT}{Each logical unit is 1 pixel.}
\end{twocollist} \end{twocollist}
\membersection{wxSVGFileDC::SetOptimization}\label{wxsetoptimization}
\func{void}{SetOptimization}{\param{bool }{optimize}}
Does nothing
\membersection{wxSVGFileDC::SetPen}\label{wxdcsetpen} \membersection{wxSVGFileDC::SetPen}\label{wxdcsetpen}
\func{void}{SetPen}{\param{const wxPen\& }{pen}} \func{void}{SetPen}{\param{const wxPen\& }{pen}}

View File

@@ -38,31 +38,31 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC
int m_sub_images ; int m_sub_images ;
bool m_OK, m_graphics_changed ; bool m_OK, m_graphics_changed ;
int m_width, m_height ; int m_width, m_height ;
double double
m_logicalScaleX, m_logicalScaleX,
m_logicalScaleY, m_logicalScaleY,
m_userScaleX, m_userScaleX,
m_userScaleY, m_userScaleY,
m_scaleX, m_scaleX,
m_scaleY, m_scaleY,
m_OriginX, m_OriginX,
m_OriginY, m_OriginY,
m_mm_to_pix_x, m_mm_to_pix_x,
m_mm_to_pix_y; m_mm_to_pix_y;
bool bool
m_needComputeScaleX, m_needComputeScaleX,
m_needComputeScaleY; // not yet used 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 *, virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, class wxDC *,
wxCoord, wxCoord, int = wxCOPY, bool = 0, int = -1, int = -1) ; 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 ; }; { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::CrossHair Call not implemented")); return ; };
void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord); 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 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 ; }; { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::DoSetClippingRegionAsRegion Call not yet implemented")); return ; };
void Init (wxString f, int Width, int Height, float dpi); 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); return (wxCoord)((double)(y) * m_scaleY - 0.5);
} }
void write(const wxString &s); void write(const wxString &s);
public: public:
@@ -201,13 +201,13 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC
~wxSVGFileDC(); ~wxSVGFileDC();
bool CanDrawBitmap() const { return TRUE ; }; bool CanDrawBitmap() const { return true; };
bool CanGetTextExtent() const { return TRUE ; }; bool CanGetTextExtent() const { return true; };
int GetDepth() const int GetDepth() const
{ wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::GetDepth Call not implemented")); return -1 ; }; { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::GetDepth Call not implemented")); return -1 ; };
void BeginDrawing() { return;}; 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) 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) void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool transparent)
{ DoDrawBitmap ( bitmap, x, y, transparent ) ; return ;}; { DoDrawBitmap ( bitmap, x, y, transparent ) ; return ;};
void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
{DoDrawIcon(icon, x, y) ; return ; }; {DoDrawIcon(icon, x, y) ; return ; };
@@ -265,9 +264,6 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC
int GetMapMode() ; int GetMapMode() ;
bool GetOptimization()
{ wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::GetOptimization() No optimization code used")); return TRUE ; };
bool GetPixel(wxCoord x, wxCoord y, wxColour *colour) bool GetPixel(wxCoord x, wxCoord y, wxColour *colour)
{ return DoGetPixel (x, y, colour) ; } ; { return DoGetPixel (x, y, colour) ; } ;
@@ -310,8 +306,6 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC
void SetMapMode(int anint) ; void SetMapMode(int anint) ;
void SetOptimization(bool WXUNUSED(optimize)) { return ; };
void SetPen(const wxPen& pen) ; void SetPen(const wxPen& pen) ;
void SetUserScale(double xScale, double yScale) ; void SetUserScale(double xScale, double yScale) ;

View File

@@ -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}). 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} \membersection{wxDC::GetPartialTextExtents}\label{wxdcgetpartialtextextents}
\constfunc{bool}{GetPartialTextExtents}{\param{const wxString\& }{text}, \constfunc{bool}{GetPartialTextExtents}{\param{const wxString\& }{text},
@@ -1059,21 +1051,6 @@ The mapping mode can be one of the following:
\end{twocollist} \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} \membersection{wxDC::SetPalette}\label{wxdcsetpalette}
\func{void}{SetPalette}{\param{const wxPalette\& }{palette}} \func{void}{SetPalette}{\param{const wxPalette\& }{palette}}

View File

@@ -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}} \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. 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 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}). 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} \membersection{wxSVGFileDC::GetPen}\label{wxdcgetpen}
\func{wxPen\&}{GetPen}{\void} \func{wxPen\&}{GetPen}{\void}
@@ -561,7 +555,7 @@ Gets the minimum vertical extent used in drawing commands so far.
\func{bool}{Ok}{\void} \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 write the file
\membersection{wxSVGFileDC::ResetBoundingBox}\label{wxdcresetboundingbox} \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.} \twocolitem{wxMM\_TEXT}{Each logical unit is 1 pixel.}
\end{twocollist} \end{twocollist}
\membersection{wxSVGFileDC::SetOptimization}\label{wxsetoptimization}
\func{void}{SetOptimization}{\param{bool }{optimize}}
Does nothing
\membersection{wxSVGFileDC::SetPen}\label{wxdcsetpen} \membersection{wxSVGFileDC::SetPen}\label{wxdcsetpen}
\func{void}{SetPen}{\param{const wxPen\& }{pen}} \func{void}{SetPen}{\param{const wxPen\& }{pen}}

View File

@@ -534,12 +534,10 @@ public:
int GetLogicalFunction() const { return m_logicalFunction; } int GetLogicalFunction() const { return m_logicalFunction; }
virtual void SetLogicalFunction(int function) = 0; virtual void SetLogicalFunction(int function) = 0;
// Sometimes we need to override optimization, e.g. if other software is #if WXWIN_COMPATIBILITY_2_4
// drawing onto our surface and we can't be sure of who's done what.
//
// FIXME: is this (still) used?
virtual void SetOptimization(bool WXUNUSED(opt)) { } virtual void SetOptimization(bool WXUNUSED(opt)) { }
virtual bool GetOptimization() { return false; } virtual bool GetOptimization() { return false; }
#endif
// bounding box // bounding box
// ------------ // ------------

View File

@@ -38,31 +38,31 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC
int m_sub_images ; int m_sub_images ;
bool m_OK, m_graphics_changed ; bool m_OK, m_graphics_changed ;
int m_width, m_height ; int m_width, m_height ;
double double
m_logicalScaleX, m_logicalScaleX,
m_logicalScaleY, m_logicalScaleY,
m_userScaleX, m_userScaleX,
m_userScaleY, m_userScaleY,
m_scaleX, m_scaleX,
m_scaleY, m_scaleY,
m_OriginX, m_OriginX,
m_OriginY, m_OriginY,
m_mm_to_pix_x, m_mm_to_pix_x,
m_mm_to_pix_y; m_mm_to_pix_y;
bool bool
m_needComputeScaleX, m_needComputeScaleX,
m_needComputeScaleY; // not yet used 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 *, virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, class wxDC *,
wxCoord, wxCoord, int = wxCOPY, bool = 0, int = -1, int = -1) ; 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 ; }; { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::CrossHair Call not implemented")); return ; };
void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord); 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 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 ; }; { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::DoSetClippingRegionAsRegion Call not yet implemented")); return ; };
void Init (wxString f, int Width, int Height, float dpi); 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); return (wxCoord)((double)(y) * m_scaleY - 0.5);
} }
void write(const wxString &s); void write(const wxString &s);
public: public:
@@ -201,13 +201,13 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC
~wxSVGFileDC(); ~wxSVGFileDC();
bool CanDrawBitmap() const { return TRUE ; }; bool CanDrawBitmap() const { return true; };
bool CanGetTextExtent() const { return TRUE ; }; bool CanGetTextExtent() const { return true; };
int GetDepth() const int GetDepth() const
{ wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::GetDepth Call not implemented")); return -1 ; }; { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::GetDepth Call not implemented")); return -1 ; };
void BeginDrawing() { return;}; 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) 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) void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool transparent)
{ DoDrawBitmap ( bitmap, x, y, transparent ) ; return ;}; { DoDrawBitmap ( bitmap, x, y, transparent ) ; return ;};
void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y) void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
{DoDrawIcon(icon, x, y) ; return ; }; {DoDrawIcon(icon, x, y) ; return ; };
@@ -265,9 +264,6 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC
int GetMapMode() ; int GetMapMode() ;
bool GetOptimization()
{ wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::GetOptimization() No optimization code used")); return TRUE ; };
bool GetPixel(wxCoord x, wxCoord y, wxColour *colour) bool GetPixel(wxCoord x, wxCoord y, wxColour *colour)
{ return DoGetPixel (x, y, colour) ; } ; { return DoGetPixel (x, y, colour) ; } ;
@@ -310,8 +306,6 @@ class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC
void SetMapMode(int anint) ; void SetMapMode(int anint) ;
void SetOptimization(bool WXUNUSED(optimize)) { return ; };
void SetPen(const wxPen& pen) ; void SetPen(const wxPen& pen) ;
void SetUserScale(double xScale, double yScale) ; void SetUserScale(double xScale, double yScale) ;

View File

@@ -96,6 +96,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
#define IS_HATCH(s) ((s)>=wxFIRST_HATCH && (s)<=wxLAST_HATCH) #define IS_HATCH(s) ((s)>=wxFIRST_HATCH && (s)<=wxLAST_HATCH)
#endif #endif
// FIXME: left over after removal of wxDC::GetOptimization()
#define GET_OPTIMIZATION false
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// prototypes // prototypes
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -1085,7 +1088,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
sameColour = (sameColour && sameColour = (sameColour &&
(oldPenColour.GetPixel() == m_textBackgroundColour.GetPixel())); (oldPenColour.GetPixel() == m_textBackgroundColour.GetPixel()));
if (!sameColour || !GetOptimization()) if (!sameColour || !GET_OPTIMIZATION)
{ {
int pixel = m_textBackgroundColour.AllocColour(m_display); int pixel = m_textBackgroundColour.AllocColour(m_display);
m_currentColour = m_textBackgroundColour; m_currentColour = m_textBackgroundColour;
@@ -1118,7 +1121,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
(oldPenColour.Green () == m_currentColour.Green ()) && (oldPenColour.Green () == m_currentColour.Green ()) &&
(oldPenColour.GetPixel() == m_currentColour.GetPixel())); (oldPenColour.GetPixel() == m_currentColour.GetPixel()));
if (!sameColour || !GetOptimization()) if (!sameColour || !GET_OPTIMIZATION)
{ {
int pixel = CalculatePixel(m_textForegroundColour, int pixel = CalculatePixel(m_textForegroundColour,
m_currentColour, false); m_currentColour, false);
@@ -1592,7 +1595,7 @@ void wxWindowDC::SetPen( const wxPen &pen )
(oldPenColour.Green () == m_currentColour.Green ()) && (oldPenColour.Green () == m_currentColour.Green ()) &&
(oldPenColour.GetPixel() == m_currentColour.GetPixel())); (oldPenColour.GetPixel() == m_currentColour.GetPixel()));
if (!sameStyle || !GetOptimization()) if (!sameStyle || !GET_OPTIMIZATION)
{ {
int scaled_width = (int) XLOG2DEVREL (m_pen.GetWidth ()); int scaled_width = (int) XLOG2DEVREL (m_pen.GetWidth ());
if (scaled_width < 0) 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); 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; Pixmap myStipple;
@@ -1763,7 +1766,7 @@ void wxWindowDC::SetPen( const wxPen &pen )
XSetStipple ((Display*) m_display,(GC) m_gcBacking, myStipple); XSetStipple ((Display*) m_display,(GC) m_gcBacking, myStipple);
} }
else if (m_currentStipple.Ok() 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()); 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()); 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; int fill_style;
@@ -1787,7 +1790,7 @@ void wxWindowDC::SetPen( const wxPen &pen )
} }
// must test m_logicalFunction, because it involves background! // must test m_logicalFunction, because it involves background!
if (!sameColour || !GetOptimization() if (!sameColour || !GET_OPTIMIZATION
|| ((m_logicalFunction == wxXOR) || (m_autoSetting & 0x2))) || ((m_logicalFunction == wxXOR) || (m_autoSetting & 0x2)))
{ {
int pixel = -1; int pixel = -1;
@@ -1837,7 +1840,7 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
int stippleDepth = -1; int stippleDepth = -1;
if ((oldFill != m_brush.GetStyle ()) || !GetOptimization()) if ((oldFill != m_brush.GetStyle ()) || !GET_OPTIMIZATION)
{ {
switch (brush.GetStyle ()) 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; Pixmap myStipple;
@@ -1955,7 +1958,7 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
} }
// must test m_logicalFunction, because it involves background! // 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); int pixel = CalculatePixel(m_brush.GetColour(), m_currentColour, true);

View File

@@ -6,7 +6,7 @@
// Created: 01/02/97 // Created: 01/02/97
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) Julian Smart // Copyright: (c) Julian Smart
// Licence: wxWindows licence // Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
@@ -38,11 +38,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxWindowDC)
wxMemoryDC::wxMemoryDC(void) wxMemoryDC::wxMemoryDC(void)
{ {
m_ok = TRUE; m_ok = true;
m_display = wxGetDisplay(); m_display = wxGetDisplay();
Display* display = (Display*) m_display; Display* display = (Display*) m_display;
XGCValues gcvalues; XGCValues gcvalues;
gcvalues.foreground = BlackPixel (display, DefaultScreen (display)); gcvalues.foreground = BlackPixel (display, DefaultScreen (display));
gcvalues.background = WhitePixel (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)), m_gc = (WXGC) XCreateGC (display, RootWindow (display, DefaultScreen (display)),
GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode, GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode,
&gcvalues); &gcvalues);
m_backgroundPixel = (int) gcvalues.background; m_backgroundPixel = (int) gcvalues.background;
// Get the current Font so we can set it back later // Get the current Font so we can set it back later
XGCValues valReturn; XGCValues valReturn;
XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn); XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn);
m_oldFont = (WXFont) valReturn.font; m_oldFont = (WXFont) valReturn.font;
SetBrush (* wxWHITE_BRUSH); SetBrush (* wxWHITE_BRUSH);
SetPen (* wxBLACK_PEN); SetPen (* wxBLACK_PEN);
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
}; };
wxMemoryDC::wxMemoryDC( wxDC* dc ) wxMemoryDC::wxMemoryDC( wxDC* dc )
{ {
m_ok = TRUE; m_ok = true;
if (dc && dc->IsKindOf(CLASSINFO(wxWindowDC))) if (dc && dc->IsKindOf(CLASSINFO(wxWindowDC)))
m_display = ((wxWindowDC*)dc)->GetDisplay(); m_display = ((wxWindowDC*)dc)->GetDisplay();
else else
m_display = wxGetDisplay(); m_display = wxGetDisplay();
Display* display = (Display*) m_display; Display* display = (Display*) m_display;
XGCValues gcvalues; XGCValues gcvalues;
gcvalues.foreground = BlackPixel (display, DefaultScreen (display)); gcvalues.foreground = BlackPixel (display, DefaultScreen (display));
gcvalues.background = WhitePixel (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)), m_gc = (WXGC) XCreateGC (display, RootWindow (display, DefaultScreen (display)),
GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode, GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode,
&gcvalues); &gcvalues);
m_backgroundPixel = (int) gcvalues.background; m_backgroundPixel = (int) gcvalues.background;
// Get the current Font so we can set it back later // Get the current Font so we can set it back later
XGCValues valReturn; XGCValues valReturn;
XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn); XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn);
@@ -101,16 +101,16 @@ wxMemoryDC::~wxMemoryDC(void)
void wxMemoryDC::SelectObject( const wxBitmap& bitmap ) void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
{ {
m_bitmap = bitmap; m_bitmap = bitmap;
if (m_gc) if (m_gc)
XFreeGC((Display*) m_display, (GC) m_gc); XFreeGC((Display*) m_display, (GC) m_gc);
m_gc = (WXGC) NULL; m_gc = (WXGC) NULL;
if (m_bitmap.Ok() && (bitmap.GetDisplay() == m_display)) if (m_bitmap.Ok() && (bitmap.GetDisplay() == m_display))
{ {
m_pixmap = m_bitmap.GetDrawable(); m_pixmap = m_bitmap.GetDrawable();
Display* display = (Display*) m_display; Display* display = (Display*) m_display;
XGCValues gcvalues; XGCValues gcvalues;
gcvalues.foreground = BlackPixel (display, DefaultScreen (display)); gcvalues.foreground = BlackPixel (display, DefaultScreen (display));
gcvalues.background = WhitePixel (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)) */, m_gc = (WXGC) XCreateGC (display, (Drawable)m_pixmap/* RootWindow (display, DefaultScreen (display)) */,
GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode, GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode,
&gcvalues); &gcvalues);
m_backgroundPixel = (int) gcvalues.background; m_backgroundPixel = (int) gcvalues.background;
m_ok = TRUE; m_ok = true;
// Get the current Font so we can set it back later // Get the current Font so we can set it back later
XGCValues valReturn; XGCValues valReturn;
XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn); XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn);
m_oldFont = (WXFont) valReturn.font; m_oldFont = (WXFont) valReturn.font;
bool oldOpt = GetOptimization();
SetOptimization(FALSE);
SetBrush (* wxWHITE_BRUSH); SetBrush (* wxWHITE_BRUSH);
SetPen (* wxBLACK_PEN); SetPen (* wxBLACK_PEN);
SetOptimization(oldOpt);
} }
else else
{ {

View File

@@ -277,7 +277,7 @@ bool wxWriteResource(const wxString& section, const wxString& entry, const wxStr
strcat (resName, entry.c_str()); strcat (resName, entry.c_str());
XrmPutStringResource (&database, resName, value); XrmPutStringResource (&database, resName, value);
return TRUE; return true;
} }
bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file) 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]; *value = new char[xvalue.size + 1];
strncpy (*value, xvalue.addr, (int) xvalue.size); strncpy (*value, xvalue.addr, (int) xvalue.size);
return TRUE; return true;
} }
return FALSE; return FALSE;
} }
@@ -367,7 +367,7 @@ bool wxGetResource(const wxString& section, const wxString& entry, float *value,
{ {
*value = (float)strtod(s, NULL); *value = (float)strtod(s, NULL);
delete[] s; delete[] s;
return TRUE; return true;
} }
else return FALSE; else return FALSE;
} }
@@ -380,7 +380,7 @@ bool wxGetResource(const wxString& section, const wxString& entry, long *value,
{ {
*value = strtol(s, NULL, 10); *value = strtol(s, NULL, 10);
delete[] s; delete[] s;
return TRUE; return true;
} }
else return FALSE; else return FALSE;
} }
@@ -402,7 +402,7 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c
else else
*value = (int) strtol (s, NULL, 10); *value = (int) strtol (s, NULL, 10);
delete[] s; delete[] s;
return TRUE; return true;
} }
else else
return FALSE; return FALSE;
@@ -528,7 +528,7 @@ void wxGetMousePosition( int* x, int* y )
#endif #endif
}; };
// Return TRUE if we have a colour display // Return true if we have a colour display
bool wxColourDisplay() bool wxColourDisplay()
{ {
return wxDisplayDepth() > 1; return wxDisplayDepth() > 1;
@@ -592,11 +592,11 @@ bool wxSetDisplay(const wxString& display_name)
{ {
gs_displayName = display_name; gs_displayName = display_name;
if ( display_name.IsEmpty() ) if ( display_name.empty() )
{ {
gs_currentDisplay = NULL; gs_currentDisplay = NULL;
return TRUE; return true;
} }
else else
{ {
@@ -617,7 +617,7 @@ bool wxSetDisplay(const wxString& display_name)
if (display) if (display)
{ {
gs_currentDisplay = (WXDisplay*) display; gs_currentDisplay = (WXDisplay*) display;
return TRUE; return true;
} }
else else
return FALSE; return FALSE;
@@ -757,22 +757,22 @@ wxString wxGetXEventName(XEvent& event)
return str; return str;
#else #else
int type = event.xany.type; int type = event.xany.type;
static char* event_name[] = { static char* event_name[] = {
"", "unknown(-)", // 0-1 "", "unknown(-)", // 0-1
"KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", // 2-5 "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", // 2-5
"MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", // 6-9 "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", // 6-9
"FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", // 10-13 "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", // 10-13
"NoExpose", "VisibilityNotify", "CreateNotify", // 14-16 "NoExpose", "VisibilityNotify", "CreateNotify", // 14-16
"DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest",// 17-20 "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest",// 17-20
"ReparentNotify", "ConfigureNotify", "ConfigureRequest", // 21-23 "ReparentNotify", "ConfigureNotify", "ConfigureRequest", // 21-23
"GravityNotify", "ResizeRequest", "CirculateNotify", // 24-26 "GravityNotify", "ResizeRequest", "CirculateNotify", // 24-26
"CirculateRequest", "PropertyNotify", "SelectionClear", // 27-29 "CirculateRequest", "PropertyNotify", "SelectionClear", // 27-29
"SelectionRequest", "SelectionNotify", "ColormapNotify", // 30-32 "SelectionRequest", "SelectionNotify", "ColormapNotify", // 30-32
"ClientMessage", "MappingNotify", // 33-34 "ClientMessage", "MappingNotify", // 33-34
"unknown(+)"}; // 35 "unknown(+)"}; // 35
type = wxMin(35, type); type = wxMax(1, type); type = wxMin(35, type); type = wxMax(1, type);
wxString str(event_name[type]); wxString str(event_name[type]);
return str; return str;
#endif #endif
} }
#endif #endif
@@ -976,11 +976,10 @@ wxBitmap wxCreateMaskedBitmap(const wxBitmap& bitmap, wxColour& colour)
destDC.SelectObject(newBitmap); destDC.SelectObject(newBitmap);
wxBrush brush(colour, wxSOLID); wxBrush brush(colour, wxSOLID);
// destDC.SetOptimization(FALSE);
destDC.SetBackground(brush); destDC.SetBackground(brush);
destDC.Clear(); destDC.Clear();
destDC.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(), destDC.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(),
&srcDC, 0, 0, wxCOPY, TRUE); &srcDC, 0, 0, wxCOPY, true);
return newBitmap; return newBitmap;
} }