]> git.saurik.com Git - wxWidgets.git/commitdiff
revert to the old flicker-less version when background bitmap is not used
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 17 Feb 2005 23:55:53 +0000 (23:55 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 17 Feb 2005 23:55:53 +0000 (23:55 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32123 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/html/htmlwin.h
src/html/htmlwin.cpp

index 016782b6d642f9da4ba4b197b88a68f499dc3eca..388cc120103741bdec070573f1532d9db4a2c954 100644 (file)
@@ -333,9 +333,6 @@ private:
     wxPoint     m_tmpSelFromPos;
     wxHtmlCell *m_tmpSelFromCell;
 
-    // a flag indicated if mouse moved
-    // (if true we will try to change cursor in last call to OnIdle)
-    bool m_tmpMouseMoved;
     // contains last link name
     wxHtmlLinkInfo *m_tmpLastLink;
     // contains the last (terminal) cell which contained the mouse
@@ -349,15 +346,23 @@ private:
     // this filter is used when no filter is able to read some file
     static wxHtmlFilter *m_DefaultFilter;
 
-    wxHtmlHistoryArray *m_History;
+    // html processors array:
+    wxHtmlProcessorList *m_Processors;
+    static wxHtmlProcessorList *m_GlobalProcessors;
+
     // browser history
+    wxHtmlHistoryArray *m_History;
     int m_HistoryPos;
     // if this FLAG is false, items are not added to history
     bool m_HistoryOn;
 
-    // html processors array:
-    wxHtmlProcessorList *m_Processors;
-    static wxHtmlProcessorList *m_GlobalProcessors;
+    // a flag indicated if mouse moved
+    // (if true we will try to change cursor in last call to OnIdle)
+    bool m_tmpMouseMoved;
+
+    // a flag set if we need to erase background in OnPaint() (otherwise this
+    // is supposed to have been done in OnEraseBackground())
+    bool m_eraseBgInOnPaint;
 
     DECLARE_EVENT_TABLE()
     DECLARE_NO_COPY_CLASS(wxHtmlWindow)
index 0dc11db54826a855e3533305c5cfe5f53fa3effa..00be22276af981b72e631c71a2288f4369ccc0cc 100644 (file)
@@ -180,6 +180,7 @@ void wxHtmlWindow::Init()
     m_lastDoubleClick = 0;
 #endif // wxUSE_CLIPBOARD
     m_backBuffer = NULL;
+    m_eraseBgInOnPaint = false;
 }
 
 bool wxHtmlWindow::Create(wxWindow *parent, wxWindowID id,
@@ -853,10 +854,11 @@ void wxHtmlWindow::OnEraseBackground(wxEraseEvent& event)
 {
     if ( !m_bmpBg.Ok() )
     {
-        // we used to do nothing at all here but we do have to erase background
-        // now that we reuse it (instead of overwriting it) in OnPaint() below
-        event.Skip();
-
+        // don't even skip the event, if we don't have a bg bitmap we're going
+        // to overwrite background in OnPaint() below anyhow, so letting the
+        // default handling take place would only result in flicker, just set a
+        // flag to erase the background below
+        m_eraseBgInOnPaint = true;
         return;
     }
 
@@ -887,7 +889,8 @@ void wxHtmlWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
     wxPaintDC dc(this);
 
-    if (m_tmpCanDrawLocks > 0 || m_Cell == NULL) return;
+    if (m_tmpCanDrawLocks > 0 || m_Cell == NULL)
+        return;
 
     int x, y;
     GetViewStart(&x, &y);
@@ -899,13 +902,23 @@ void wxHtmlWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
         m_backBuffer = new wxBitmap(sz.x, sz.y);
     dcm.SelectObject(*m_backBuffer);
 
-    // preserve the existing background, otherwise we'd erase anything the user
-    // code had drawn in its EVT_ERASE_BACKGROUND handler when we do the Blit
-    // back below
-    dcm.Blit(0, rect.GetTop(),
-             sz.x, rect.GetBottom() - rect.GetTop() + 1,
-             &dc,
-             0, rect.GetTop());
+    if ( m_eraseBgInOnPaint )
+    {
+        dcm.SetBackground(wxBrush(GetBackgroundColour(), wxSOLID));
+        dcm.Clear();
+
+        m_eraseBgInOnPaint = false;
+    }
+    else // someone has already erased the background, keep it
+    {
+        // preserve the existing background, otherwise we'd erase anything the
+        // user code had drawn in its EVT_ERASE_BACKGROUND handler when we do
+        // the Blit back below
+        dcm.Blit(0, rect.GetTop(),
+                 sz.x, rect.GetBottom() - rect.GetTop() + 1,
+                 &dc,
+                 0, rect.GetTop());
+    }
 
     PrepareDC(dcm);
     dcm.SetMapMode(wxMM_TEXT);