X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e6feb95a79834836e88143b15d9f424ebe79621..6c02c32922ecd6b3272c89669e3fe1304cd9dfac:/include/wx/dc.h diff --git a/include/wx/dc.h b/include/wx/dc.h index 7ca8eb3b76..8dc21ff6f0 100644 --- a/include/wx/dc.h +++ b/include/wx/dc.h @@ -274,17 +274,17 @@ public: bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = FALSE) + int rop = wxCOPY, bool useMask = FALSE, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1) { return DoBlit(xdest, ydest, width, height, - source, xsrc, ysrc, rop, useMask); + source, xsrc, ysrc, rop, useMask, xsrcMask, ysrcMask); } bool Blit(const wxPoint& destPt, const wxSize& sz, wxDC *source, const wxPoint& srcPt, - int rop = wxCOPY, bool useMask = FALSE) + int rop = wxCOPY, bool useMask = FALSE, const wxPoint& srcPtMask = wxPoint(-1, -1)) { return DoBlit(destPt.x, destPt.y, sz.x, sz.y, - source, srcPt.x, srcPt.y, rop, useMask); + source, srcPt.x, srcPt.y, rop, useMask, srcPtMask.x, srcPtMask.y); } #if wxUSE_SPLINES @@ -486,6 +486,16 @@ public: virtual void SetOptimization(bool WXUNUSED(opt)) { } virtual bool GetOptimization() { return FALSE; } + // Some platforms have a DC cache, which should be cleared + // at appropriate points such as after a series of DC operations. + // Put ClearCache in the wxDC implementation class, since it has to be + // static. + // static void ClearCache() ; +#if wxUSE_DC_CACHEING + static void EnableCache(bool cacheing) { sm_cacheing = cacheing; } + static bool CacheEnabled() { return sm_cacheing ; } +#endif + // bounding box // ------------ @@ -624,7 +634,7 @@ protected: virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop = wxCOPY, bool useMask = FALSE) = 0; + int rop = wxCOPY, bool useMask = FALSE, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1) = 0; virtual void DoGetSize(int *width, int *height) const = 0; virtual void DoGetSizeMM(int* width, int* height) const = 0; @@ -688,6 +698,9 @@ protected: bool m_clipping:1; bool m_isInteractive:1; bool m_isBBoxValid:1; +#if wxUSE_DC_CACHEING + static bool sm_cacheing; +#endif // coordinate system variables @@ -721,7 +734,7 @@ protected: wxPalette m_palette; private: - DECLARE_NO_COPY_CLASS(wxDCBase); + DECLARE_NO_COPY_CLASS(wxDCBase) DECLARE_ABSTRACT_CLASS(wxDCBase) }; @@ -776,5 +789,24 @@ private: wxColour m_colFgOld; }; +// ---------------------------------------------------------------------------- +// another small helper class: sets the clipping region in its ctor and +// destroys it in the dtor +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxDCClipper +{ +public: + wxDCClipper(wxDC& dc, const wxRect& r) : m_dc(dc) + { dc.SetClippingRegion(r.x, r.y, r.width, r.height); } + wxDCClipper(wxDC& dc, wxCoord x, wxCoord y, wxCoord w, wxCoord h) : m_dc(dc) + { dc.SetClippingRegion(x, y, w, h); } + + ~wxDCClipper() { m_dc.DestroyClippingRegion(); } + +private: + wxDC& m_dc; +}; + #endif // _WX_DC_H_BASE_