From: Vadim Zeitlin Date: Thu, 17 Feb 2005 23:55:53 +0000 (+0000) Subject: revert to the old flicker-less version when background bitmap is not used X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/518ba66331d4e63376448802ce23fb7f7da82250?ds=inline revert to the old flicker-less version when background bitmap is not used git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32123 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/html/htmlwin.h b/include/wx/html/htmlwin.h index 016782b6d6..388cc12010 100644 --- a/include/wx/html/htmlwin.h +++ b/include/wx/html/htmlwin.h @@ -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) diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index 0dc11db548..00be22276a 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -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);