Commit eb3bf439 authored by Robert Knight's avatar Robert Knight
Browse files

Optimize updates when changing the search text or scrolling with the search...

Optimize updates when changing the search text or scrolling with the search bar active.  Compute the area covered by hotspots before and after the filter processing and then update the union of those two regions.

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=756109
parent 7fe743af
......@@ -158,8 +158,6 @@ void SessionController::updateSearchFilter()
Q_ASSERT( searchBar() && searchBar()->isVisible() );
_view->processFilters();
// TODO - Optimize by only repainting the affected regions
_view->update();
}
}
......@@ -368,8 +366,6 @@ bool SessionController::eventFilter(QObject* watched , QEvent* event)
_view->filterChain()->addFilter( _viewUrlFilter );
}
//kDebug() << "Updating url filter.";
_view->processFilters();
_urlFilterUpdateRequired = false;
}
......@@ -821,9 +817,6 @@ void SessionController::beginSearch(const QString& text , int direction)
}
_view->processFilters();
// TODO - Optimise by only updating affected regions
_view->update();
}
void SessionController::highlightMatches(bool highlight)
{
......
......@@ -793,10 +793,25 @@ void TerminalDisplay::scrollImage(int lines , const QRect& screenWindowRegion)
scroll( 0 , _fontHeight * (-lines) , scrollRect );
}
QRegion TerminalDisplay::hotSpotRegion() const
{
QRegion region;
foreach( Filter::HotSpot* hotSpot , _filterChain->hotSpots() )
{
QRect rect;
rect.setLeft(hotSpot->startColumn());
rect.setTop(hotSpot->startLine());
rect.setRight(hotSpot->endColumn());
rect.setBottom(hotSpot->endLine());
region |= imageToWidget(rect);
}
return region;
}
void TerminalDisplay::processFilters()
{
QTime t;
t.start();
QRegion preUpdateHotSpots = hotSpotRegion();
// use _screenWindow->getImage() here rather than _image because
// other classes may call processFilters() when this display's
......@@ -808,6 +823,10 @@ void TerminalDisplay::processFilters()
_screenWindow->windowColumns(),
_screenWindow->getLineProperties() );
_filterChain->process();
QRegion postUpdateHotSpots = hotSpotRegion();
update( preUpdateHotSpots | postUpdateHotSpots );
}
void TerminalDisplay::updateImage()
......
......@@ -609,7 +609,11 @@ private:
void makeImage();
void paintFilters(QPainter& painter);
// returns a region covering all of the areas of the widget which contain
// a hotspot
QRegion hotSpotRegion() const;
// the window onto the terminal screen which this display
// is currently showing.
QPointer<ScreenWindow> _screenWindow;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment