const shared_ptr<Cursor> other(get_other_cursor());
assert(other);
- const float x = ((time_ - view_.offset())/ view_.scale()).convert_to<float>();
+ const float x = get_x();
QFontMetrics m(QApplication::font());
QSize text_size = m.boundingRect(get_text()).size();
assert(first_);
assert(second_);
- return pair<float, float>(
- ((first_->time() - view_.offset()) / view_.scale()).convert_to<float>(),
- ((second_->time() - view_.offset()) / view_.scale()).convert_to<float>());
+ return pair<float, float>(first_->get_x(), second_->get_x());
}
} // namespace TraceView
*/
#include <algorithm>
+#include <cmath>
#include <extdef.h>
float TimeMarker::get_x() const
{
- return ((time_ - view_.offset()) / view_.scale()).convert_to<float>();
+ return std::roundf(((time_ - view_.offset()) / view_.scale()).convert_to<float>()) + 0.5f;
}
QPoint TimeMarker::point(const QRect &rect) const
if (!enabled())
return;
- const qreal x = ((time_ - view_.offset()) / view_.scale()).convert_to<qreal>();
+ const qreal x = get_x();
const QRectF r(label_rect(rect));
const QPointF points[] = {
for (const shared_ptr<RowItem> r : row_items)
r->paint_fore(p, pp);
- p.setRenderHint(QPainter::Antialiasing, false);
for (const shared_ptr<TimeItem> t : time_items)
t->paint_fore(p, pp);