From b84839aea9dc3237994dead27f35de963d0f4c7f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 11 Jul 2001 13:35:07 +0000 Subject: [PATCH] (much) more efficient report mode redrawing git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10967 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/listctrl.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 4a94a65b79..84a4fe9b12 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2397,7 +2397,6 @@ void wxListMainWindow::RefreshAfter( size_t lineFrom ) CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y ); RefreshRect( rect ); - } else // !report { @@ -2433,10 +2432,24 @@ void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) size_t visibleFrom, visibleTo; GetVisibleLinesRange(&visibleFrom, &visibleTo); + + wxRect rectLine; + wxCoord xOrig, yOrig; + CalcUnscrolledPosition(0, 0, &xOrig, &yOrig); + for ( size_t line = visibleFrom; line <= visibleTo; line++ ) { + rectLine = GetLineRect(line); + + if ( !IsExposed(rectLine.x - xOrig, rectLine.y - yOrig, + rectLine.width, rectLine.height) ) + { + // don't redraw unaffected lines to avoid flicker + continue; + } + GetLine(line)->DrawInReportMode( &dc, - GetLineRect(line), + rectLine, GetLineHighlightRect(line), IsHighlighted(line) ); } @@ -3756,6 +3769,7 @@ void wxListMainWindow::DeleteItem( long lindex ) m_lines.RemoveAt( index ); } + m_dirty = TRUE; RefreshAfter(index); } @@ -3934,6 +3948,7 @@ void wxListMainWindow::InsertItem( wxListItem &item ) m_lines.Insert( line, id ); + m_dirty = TRUE; RefreshLines(id, GetItemCount() - 1); } -- 2.45.2