X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fview%2Fruler.cpp;h=5dea19474c84714a3f653e8449ff099f0f700625;hb=49f8ff3fd225c72934eca725eacffb12b6542ebf;hp=743a11fcb9e5e3e40afdfb782adbad7e85eb8708;hpb=1b5813fe7a82d959976389f7bb41bf731f1ff435;p=pulseview.git diff --git a/pv/view/ruler.cpp b/pv/view/ruler.cpp index 743a11fc..5dea1947 100644 --- a/pv/view/ruler.cpp +++ b/pv/view/ruler.cpp @@ -1,5 +1,5 @@ /* - * This file is part of the sigrok project. + * This file is part of the PulseView project. * * Copyright (C) 2012 Joel Holdsworth * @@ -21,7 +21,7 @@ #include "ruler.h" #include "view.h" -#include "../../extdef.h" +#include #include #include @@ -56,7 +56,7 @@ void Ruler::paintEvent(QPaintEvent *event) const int order = (int)floorf(log10f(min_period)); const double order_decimal = pow(10, order); - int unit = 0; + unsigned int unit = 0; double tick_period = 0.0f; do @@ -64,11 +64,11 @@ void Ruler::paintEvent(QPaintEvent *event) tick_period = order_decimal * ScaleUnits[unit++]; } while(tick_period < min_period && unit < countof(ScaleUnits)); - const int prefix = (order - FirstSIPrefixPower) / 3; + const unsigned int prefix = (order - FirstSIPrefixPower) / 3; assert(prefix >= 0); assert(prefix < countof(SIPrefixes)); - const double multiplier = pow(0.1, prefix * 3 + FirstSIPrefixPower); + const double multiplier = pow(10.0, - prefix * 3 - FirstSIPrefixPower); const int text_height = p.boundingRect(0, 0, INT_MAX, INT_MAX, Qt::AlignLeft | Qt::AlignTop, "8").height();