X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/277480474552707c27c7466bb5e5d1738a16372b..491b5be8305968871bc289453ed088a70c3de044:/src/msw/dc.cpp diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp index a9cfabdf12..0f31dee21b 100644 --- a/src/msw/dc.cpp +++ b/src/msw/dc.cpp @@ -42,6 +42,7 @@ #include "wx/sysopt.h" #include "wx/dcprint.h" +#include "wx/module.h" #include #include @@ -1710,10 +1711,10 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxDCCacheEntry* dcCacheEntry1 = FindDCInCache(NULL, source->GetHDC()); dc_mask = (HDC) dcCacheEntry1->m_dc; - wxDCCacheEntry* dcCacheEntry2 = FindDCInCache(dcCacheEntry1, dest->GetHDC()); + wxDCCacheEntry* dcCacheEntry2 = FindDCInCache(dcCacheEntry1, GetHDC()); dc_buffer = (HDC) dcCacheEntry2->m_dc; - wxDCCacheEntry* bitmapCacheEntry = FindBitmapInCache(dest->GetHDC(), + wxDCCacheEntry* bitmapCacheEntry = FindBitmapInCache(GetHDC(), width, height); buffer_bmap = (HBITMAP) bitmapCacheEntry->m_bitmap; @@ -1985,6 +1986,19 @@ void wxDC::ClearCache() sm_dcCache.DeleteContents(FALSE); } +// Clean up cache at app exit +class wxDCModule : public wxModule +{ +public: + virtual bool OnInit() { return TRUE; } + virtual void OnExit() { wxDC::ClearCache(); } + +private: + DECLARE_DYNAMIC_CLASS(wxDCModule) +}; + +IMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule) + #endif // wxUSE_DC_CACHEING