From cf624f92bd3da7305afc70c6e440dab81fdf19f4 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 5 Oct 2017 09:38:45 +0200 Subject: [PATCH] TextEditor: Optimize line annotation painting Paint an annotation only if the event rectangle contains the block for that specific annotation Change-Id: I5f992f916da25268dd2c9e6b4703701934c8551d Reviewed-by: Christian Stenger --- src/plugins/texteditor/texteditor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 0fe63bbc95e..1a2ed84d6ce 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -4408,6 +4408,8 @@ void TextEditorWidget::paintEvent(QPaintEvent *e) || d->m_blockSelection.positionColumn == d->m_blockSelection.anchorColumn) && blockSelectionCursorRect.isValid()) painter.fillRect(blockSelectionCursorRect, palette().text()); + + d->drawLineAnnotation(painter, block, lineX < viewportRect.width() ? lineX : 0); } offset.ry() += r.height(); @@ -4554,7 +4556,6 @@ void TextEditorWidget::paintEvent(QPaintEvent *e) painter.restore(); } } - d->drawLineAnnotation(painter, block, lineX < viewportRect.width() ? lineX : 0); block = nextVisibleBlock; top = bottom;