aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/diveprofileitem.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2014-02-05 15:45:23 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-02-06 06:31:11 -0800
commit151a90bec0610a12880802234a9159a2b3747722 (patch)
tree447ea15b71395bc94864cbdf315eceed377660e5 /qt-ui/profile/diveprofileitem.cpp
parented230f8aacb2d1bc4076f927240998ca9f1fa8b6 (diff)
downloadsubsurface-151a90bec0610a12880802234a9159a2b3747722.tar.gz
Big improvement in speed ( callgrind )
This patch makes use of a cache variable instead of creating / accessing a new one via operator[], because for some reason QGraphicsPolygonItem doesn't return a reference for polygon and a copy is always made. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/diveprofileitem.cpp')
-rw-r--r--qt-ui/profile/diveprofileitem.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp
index e7cf7cf03..9aa204808 100644
--- a/qt-ui/profile/diveprofileitem.cpp
+++ b/qt-ui/profile/diveprofileitem.cpp
@@ -113,12 +113,13 @@ void DiveProfileItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* o
QPen pen;
pen.setCosmetic(true);
pen.setWidth(2);
+ QPolygonF poly = polygon();
// This paints the colors of the velocities.
for (int i = 1, count = dataModel->rowCount(); i < count; i++) {
QModelIndex colorIndex = dataModel->index(i, DivePlotDataModel::COLOR);
pen.setBrush(QBrush(colorIndex.data(Qt::BackgroundRole).value<QColor>()));
painter->setPen(pen);
- painter->drawLine(polygon()[i-1],polygon()[i]);
+ painter->drawLine(poly[i-1],poly[i]);
}
}