X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fview%2Ftimemarker.cpp;h=853f7c02675e0b594606e96eff8574734fcb2fff;hb=4c7a19d3d7049bcc9fb3185ce2bc91333a7ca9e1;hp=4874eb233c7ebf7d9fe5e282883dc93a1efbc8a7;hpb=aca9aa834c742ba70f49d1ac3eb2d1e02e759416;p=pulseview.git diff --git a/pv/view/timemarker.cpp b/pv/view/timemarker.cpp index 4874eb2..853f7c0 100644 --- a/pv/view/timemarker.cpp +++ b/pv/view/timemarker.cpp @@ -18,6 +18,7 @@ */ #include +#include #include @@ -73,7 +74,8 @@ void TimeMarker::set_time(const pv::util::Timestamp& time) float TimeMarker::get_x() const { - return ((time_ - view_.offset()) / view_.scale()).convert_to(); + // Use roundf() from cmath, std::roundf() causes Android issues (see #945). + return roundf(((time_ - view_.offset()) / view_.scale()).convert_to()) + 0.5f; } QPoint TimeMarker::point(const QRect &rect) const @@ -107,7 +109,7 @@ void TimeMarker::paint_label(QPainter &p, const QRect &rect, bool hover) if (!enabled()) return; - const qreal x = ((time_ - view_.offset()) / view_.scale()).convert_to(); + const qreal x = get_x(); const QRectF r(label_rect(rect)); const QPointF points[] = { @@ -153,7 +155,7 @@ void TimeMarker::paint_label(QPainter &p, const QRect &rect, bool hover) p.drawText(r, Qt::AlignCenter | Qt::AlignVCenter, get_text()); } -void TimeMarker::paint_fore(QPainter &p, const ViewItemPaintParams &pp) +void TimeMarker::paint_fore(QPainter &p, ViewItemPaintParams &pp) { if (!enabled()) return;