]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/dc.cpp
added wxListView class: this is going to be a wxListCtrl with human (inter)face
[wxWidgets.git] / src / msw / dc.cpp
index cae9668ac8e9e93be1e4a81d5f54ea47281da47f..0f31dee21b8223d925d4ee4e7b4fd92e188811dd 100644 (file)
@@ -42,6 +42,7 @@
 
 #include "wx/sysopt.h"
 #include "wx/dcprint.h"
+#include "wx/module.h"
 
 #include <string.h>
 #include <math.h>
@@ -1704,16 +1705,16 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest,
             HBITMAP buffer_bmap ;
 
 #if wxUSE_DC_CACHEING
-            if (CacheEnabled())
+            if (TRUE)
             {
                 // create a temp buffer bitmap and DCs to access it and the mask
                 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;
@@ -1776,14 +1777,13 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest,
             ::SelectObject(dc_mask, 0);
             ::SelectObject(dc_buffer, 0);
 
-#if wxUSE_DC_CACHEING
-            if (!CacheEnabled())
-#endif
+#if !wxUSE_DC_CACHEING
             {
                 ::DeleteDC(dc_mask);
                 ::DeleteDC(dc_buffer);
                 ::DeleteObject(buffer_bmap);
             }
+#endif
         }
     }
     else // no mask, just BitBlt() it
@@ -1986,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