From 151a90bec0610a12880802234a9159a2b3747722 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 5 Feb 2014 15:45:23 -0200 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/profile/diveprofileitem.cpp | 3 ++- qt-ui/profile/divetooltipitem.cpp | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'qt-ui') 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())); painter->setPen(pen); - painter->drawLine(polygon()[i-1],polygon()[i]); + painter->drawLine(poly[i-1],poly[i]); } } diff --git a/qt-ui/profile/divetooltipitem.cpp b/qt-ui/profile/divetooltipitem.cpp index ca355b710..26d19ecc3 100644 --- a/qt-ui/profile/divetooltipitem.cpp +++ b/qt-ui/profile/divetooltipitem.cpp @@ -225,7 +225,6 @@ void ToolTipItem::refresh(const QPointF& pos) { clear(); int time = timeAxis->valueAt( pos ); - qDebug() << "time" << time; char buffer[500]; get_plot_details_new(&pInfo, time, buffer, 500); addToolTip(QString(buffer)); -- cgit v1.2.3-70-g09d2