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
This commit is contained in:
Vadim Zeitlin 2005-02-17 23:55:53 +00:00
parent 94ab4d929b
commit 518ba66331
2 changed files with 37 additions and 19 deletions

View 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)

View 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);