aboutsummaryrefslogtreecommitdiff
path: root/src/qt/trafficgraphwidget.cpp
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2017-06-04 22:45:22 +0200
committerpracticalswift <practicalswift@users.noreply.github.com>2017-06-05 00:52:36 +0200
commit90593ed92cfd5d49900a6fb6c2c10a482ab9fdbb (patch)
tree1f830a3679ef00b774dc8ac6b216366f2ed52a68 /src/qt/trafficgraphwidget.cpp
parentf259263a7b11c6ff925851985ef0082b0a190a57 (diff)
downloadbitcoin-90593ed92cfd5d49900a6fb6c2c10a482ab9fdbb.tar.xz
Limit variable scope
Diffstat (limited to 'src/qt/trafficgraphwidget.cpp')
-rw-r--r--src/qt/trafficgraphwidget.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/qt/trafficgraphwidget.cpp b/src/qt/trafficgraphwidget.cpp
index 601d554c02..06f9c5134a 100644
--- a/src/qt/trafficgraphwidget.cpp
+++ b/src/qt/trafficgraphwidget.cpp
@@ -47,13 +47,14 @@ int TrafficGraphWidget::getGraphRangeMins() const
void TrafficGraphWidget::paintPath(QPainterPath &path, QQueue<float> &samples)
{
- int h = height() - YMARGIN * 2, w = width() - XMARGIN * 2;
- int sampleCount = samples.size(), x = XMARGIN + w, y;
+ int sampleCount = samples.size();
if(sampleCount > 0) {
+ int h = height() - YMARGIN * 2, w = width() - XMARGIN * 2;
+ int x = XMARGIN + w;
path.moveTo(x, YMARGIN + h);
for(int i = 0; i < sampleCount; ++i) {
x = XMARGIN + w - w * i / DESIRED_SAMPLES;
- y = YMARGIN + h - (int)(h * samples.at(i) / fMax);
+ int y = YMARGIN + h - (int)(h * samples.at(i) / fMax);
path.lineTo(x, y);
}
path.lineTo(x, YMARGIN + h);