]> git.saurik.com Git - wxWidgets.git/commitdiff
There was no need to create the buffer in OnIdle().
authorRobert Roebling <robert@roebling.de>
Thu, 7 Sep 2000 11:17:46 +0000 (11:17 +0000)
committerRobert Roebling <robert@roebling.de>
Thu, 7 Sep 2000 11:17:46 +0000 (11:17 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8281 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

contrib/src/canvas/canvas.cpp

index 14bdeb0fe406624246090fa8c3e25edf7a2a1bec..332e89155067f8d958d526649a8f2626cbdb0b70 100644 (file)
@@ -902,6 +902,8 @@ void wxCanvas::OnPaint(wxPaintEvent &event)
     PrepareDC( dc );
 
     if (!m_buffer.Ok()) return;
+    
+    if (m_frozen) return;
 
     m_needUpdate = TRUE;
 
@@ -1103,27 +1105,30 @@ void wxCanvas::OnMouse(wxMouseEvent &event)
 
 void wxCanvas::OnSize(wxSizeEvent &event)
 {
-    m_requestNewBuffer = TRUE;
-    Freeze();
+    int w,h;
+    GetClientSize( &w, &h );
+    m_buffer = wxImage( w, h );
+        
+    CalcUnscrolledPosition( 0, 0, &m_bufferX, &m_bufferY );
+        
+    wxNode *node = m_updateRects.First();
+    while (node)
+    {
+        wxRect *rect = (wxRect*) node->Data();
+        delete rect;
+        m_updateRects.DeleteNode( node );
+        node = m_updateRects.First();
+    }
+
+    m_frozen = FALSE;
+
+    Update( m_bufferX, m_bufferY, m_buffer.GetWidth(), m_buffer.GetHeight(), FALSE );
 
     event.Skip();
 }
 
 void wxCanvas::OnIdle(wxIdleEvent &event)
 {
-    if (m_requestNewBuffer)
-    {
-        m_requestNewBuffer = FALSE;
-        
-        int w,h;
-        GetClientSize( &w, &h );
-        m_buffer = wxImage( w, h );
-        
-        CalcUnscrolledPosition( 0, 0, &m_bufferX, &m_bufferY );
-        
-        Thaw();
-    }
-    
     UpdateNow();
     event.Skip();
 }