Added wxUSE_DC_CACHEING and associated code to wxMSW
Added EnableCache, CacheEnabled to wxDCBase Added mask source args to DoBlit, Blit Added cache testing code to dragimag sample Added wxSystemOptions, regenerated makefiles git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10962 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -83,7 +83,6 @@ void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
||||
PrepareDC( dc );
|
||||
|
||||
DrawShapes(dc);
|
||||
|
||||
}
|
||||
|
||||
void MyCanvas::OnEraseBackground(wxEraseEvent& event)
|
||||
@@ -102,6 +101,9 @@ void MyCanvas::OnEraseBackground(wxEraseEvent& event)
|
||||
wxClientDC dc(this);
|
||||
wxGetApp().TileBitmap(rect, dc, wxGetApp().GetBackgroundBitmap());
|
||||
}
|
||||
#if wxUSE_DC_CACHEING
|
||||
wxDC::ClearCache();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
event.Skip(); // The official way of doing it
|
||||
@@ -279,6 +281,9 @@ void MyCanvas::DrawShapes(wxDC& dc)
|
||||
shape->Draw(dc);
|
||||
node = node->Next();
|
||||
}
|
||||
#if wxUSE_DC_CACHEING
|
||||
wxDC::ClearCache();
|
||||
#endif
|
||||
}
|
||||
|
||||
void MyCanvas::EraseShape(DragShape* shape, wxDC& dc)
|
||||
@@ -320,7 +325,6 @@ DragShape* MyCanvas::FindShape(const wxPoint& pt) const
|
||||
}
|
||||
|
||||
// MyFrame
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS( MyFrame, wxFrame )
|
||||
|
||||
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
|
||||
@@ -381,13 +385,18 @@ bool MyApp::OnInit()
|
||||
wxImage::AddHandler( new wxPNGHandler );
|
||||
#endif
|
||||
|
||||
// The DC cache is an efficiency measure to be used
|
||||
// when a lot of masked blitting is done
|
||||
#if wxUSE_DC_CACHEING
|
||||
wxDC::EnableCache(TRUE);
|
||||
#endif
|
||||
|
||||
wxImage image;
|
||||
if (image.LoadFile("backgrnd.png", wxBITMAP_TYPE_PNG))
|
||||
{
|
||||
m_background = image.ConvertToBitmap();
|
||||
}
|
||||
|
||||
|
||||
MyFrame *frame = new MyFrame();
|
||||
|
||||
wxString rootName("shape0");
|
||||
@@ -434,6 +443,14 @@ bool MyApp::OnInit()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int MyApp::OnExit()
|
||||
{
|
||||
#if wxUSE_DC_CACHEING
|
||||
wxDC::ClearCache();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool MyApp::TileBitmap(const wxRect& rect, wxDC& dc, wxBitmap& bitmap)
|
||||
{
|
||||
int w = bitmap.GetWidth();
|
||||
|
Reference in New Issue
Block a user