When opening a new file, before the mouse enters the profile for the first 
time, the pixmap shows pixel garbage. This patch initializes it properly.

Best
Robert
From 86be509e71188141a0c164ee12dbee1a3652712c Mon Sep 17 00:00:00 2001
From: "Robert C. Helling" <[email protected]>
Date: Sat, 1 Oct 2016 17:38:12 +0200
Subject: [PATCH] Initialize tooltip tissue pixmap properly
To: [email protected]

...otherwise we show garbage before the mouse enters the
profile for the first time.

Signed-off-by: Robert C. Helling <[email protected]>
---
 profile-widget/divetooltipitem.cpp | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/profile-widget/divetooltipitem.cpp 
b/profile-widget/divetooltipitem.cpp
index 49e9bdc..fb7511e 100644
--- a/profile-widget/divetooltipitem.cpp
+++ b/profile-widget/divetooltipitem.cpp
@@ -253,15 +253,16 @@ void ToolTipItem::refresh(const QPointF &pos)
 
        mb.len = 0;
        entry = get_plot_details_new(&pInfo, time, &mb);
+
+       tissues.fill();
+       painter.setPen(QColor(0, 0, 0, 0));
+       painter.setBrush(QColor(LIMENADE1));
+       painter.drawRect(0, 10 + (100 - AMB_PERCENTAGE) / 2, 16, AMB_PERCENTAGE 
/ 2);
+       painter.setBrush(QColor(SPRINGWOOD1));
+       painter.drawRect(0, 10, 16, (100 - AMB_PERCENTAGE) / 2);
+       painter.setBrush(QColor(Qt::red));
+       painter.drawRect(0,0,16,10);
        if (entry) {
-               tissues.fill();
-               painter.setPen(QColor(0, 0, 0, 0));
-               painter.setBrush(QColor(LIMENADE1));
-               painter.drawRect(0, 10 + (100 - AMB_PERCENTAGE) / 2, 16, 
AMB_PERCENTAGE / 2);
-               painter.setBrush(QColor(SPRINGWOOD1));
-               painter.drawRect(0, 10, 16, (100 - AMB_PERCENTAGE) / 2);
-               painter.setBrush(QColor(Qt::red));
-               painter.drawRect(0,0,16,10);
                painter.setPen(QColor(0, 0, 0, 255));
                painter.drawLine(0, 60 - entry->gfline / 2, 16, 60 - 
entry->gfline / 2);
                painter.drawLine(0, 60 - AMB_PERCENTAGE * (entry->pressures.n2 
+ entry->pressures.he) / entry->ambpressure / 2,
@@ -270,9 +271,9 @@ void ToolTipItem::refresh(const QPointF &pos)
                for (int i=0; i<16; i++) {
                        painter.drawLine(i, 60, i, 60 - entry->percentages[i] / 
2);
                }
-               entryToolTip.first->setPixmap(tissues);
                entryToolTip.second->setText(QString::fromUtf8(mb.buffer, 
mb.len));
        }
+       entryToolTip.first->setPixmap(tissues);
 
        Q_FOREACH (QGraphicsItem *item, scene()->items(pos, 
Qt::IntersectsItemBoundingRect
                ,Qt::DescendingOrder, scene()->views().first()->transform())) {
-- 
2.8.4 (Apple Git-73)

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to