From c9c94a99fff6b840f7334b0a7782dc730b086763 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Wed, 2 May 2007 14:01:12 +0000 Subject: [PATCH] trying optimal scrolling solution perf-wise git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@45756 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/scrlwing.cpp | 11 ++++++----- src/mac/carbon/window.cpp | 9 ++------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/generic/scrlwing.cpp b/src/generic/scrlwing.cpp index da6b4aa59b..4c1c5ab1d9 100644 --- a/src/generic/scrlwing.cpp +++ b/src/generic/scrlwing.cpp @@ -483,11 +483,7 @@ void wxScrollHelper::HandleOnScroll(wxScrollWinEvent& event) } bool needsRefresh = false; -#ifdef __WXMAC__ - // OS X blocks on immediate redraws, so make this a refresh - if (!wxScrolledWindowHasChildren(m_targetWindow)) - needsRefresh = true; -#endif + int dx = 0, dy = 0; int orient = event.GetOrientation(); @@ -519,7 +515,12 @@ void wxScrollHelper::HandleOnScroll(wxScrollWinEvent& event) // flush all pending repaints before we change m_{x,y}ScrollPosition, as // otherwise invalidated area could be updated incorrectly later when // ScrollWindow() makes sure they're repainted before scrolling them +#ifdef __WXMAC__ + // wxWindowMac is taking care of making sure the update area is correctly + // set up, while not forcing an immediate redraw +#else m_targetWindow->Update(); +#endif } if (orient == wxHORIZONTAL) diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index c3c11d1273..7e2e2c7fae 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -2634,7 +2634,8 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) if ( m_peer->GetNeedsDisplay() ) { - // because HIViewScrollRect does not scroll the already invalidated area we have two options: + // because HIViewScrollRect does not scroll the already invalidated area we have two options + // in case there is already a pending redraw on that area // either immediate redraw or full invalidate #if 1 // is the better overall solution, as it does not slow down scrolling @@ -2655,14 +2656,8 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) scrollrect.Offset( -MacGetLeftBorderSize() , -MacGetTopBorderSize() ) ; m_peer->ScrollRect( &scrollrect , dx , dy ) ; - // becuase HIViewScrollRect does not scroll the already invalidated area we have two options - // either immediate redraw or full invalidate #if 0 - // is the better overall solution, as it does not slow down scrolling - m_peer->SetNeedsDisplay() ; -#else // this would be the preferred version for fast drawing controls - HIViewRender(m_peer->GetControlRef()) ; #endif }