X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Fdecodetrace.cpp;h=5392b17e0fc815fa3f2b799424bca5c633a4d25f;hp=0b129c3bf7b9d45acb6a69e89d0433576f3a4d6c;hb=f3d66e52ed6b454ea7a0662d5e6367e230116a2b;hpb=97904bf71258d3b522b00eb3dcae1efea6bd1298 diff --git a/pv/view/decodetrace.cpp b/pv/view/decodetrace.cpp index 0b129c3b..5392b17e 100644 --- a/pv/view/decodetrace.cpp +++ b/pv/view/decodetrace.cpp @@ -45,7 +45,7 @@ extern "C" { #include #include #include -#include +#include #include #include #include @@ -160,9 +160,7 @@ pair DecodeTrace::v_extents() const { /// @todo Replace this with an implementation that knows the true /// height of the trace - QFontMetrics m(QApplication::font()); - const int text_height = m.boundingRect(QRect(), 0, "Tg").height(); - const int row_height = (text_height * 6) / 4; + const int row_height = (RowItemPaintParams::text_height() * 6) / 4; return make_pair(-row_height / 2, row_height * 7 / 2); } @@ -176,8 +174,7 @@ void DecodeTrace::paint_mid(QPainter &p, const RowItemPaintParams &pp) { using namespace pv::data::decode; - QFontMetrics m(QApplication::font()); - text_height_ = m.boundingRect(QRect(), 0, "Tg").height(); + text_height_ = RowItemPaintParams::text_height(); row_height_ = (text_height_ * 6) / 4; const int annotation_height = (text_height_ * 5) / 4; @@ -477,20 +474,20 @@ void DecodeTrace::draw_unresolved_period(QPainter &p, int h, int left, // We get the logic data of the first channel in the list. // This works because we are currently assuming all - // LogicSignals have the same data/snapshot + // LogicSignals have the same data/segment for (const shared_ptr &dec : stack) if (dec && !dec->channels().empty() && ((logic_signal = (*dec->channels().begin()).second)) && ((data = logic_signal->logic_data()))) break; - if (!data || data->get_snapshots().empty()) + if (!data || data->logic_segments().empty()) return; - const shared_ptr snapshot = - data->get_snapshots().front(); - assert(snapshot); - const int64_t sample_count = (int64_t)snapshot->get_sample_count(); + const shared_ptr segment = + data->logic_segments().front(); + assert(segment); + const int64_t sample_count = (int64_t)segment->get_sample_count(); if (sample_count == 0) return; @@ -530,7 +527,7 @@ pair DecodeTrace::get_pixels_offset_samples_per_pixel() const assert(scale > 0); const double pixels_offset = - (view->offset() - decoder_stack_->get_start_time()) / scale; + (view->offset() - decoder_stack_->start_time()) / scale; double samplerate = decoder_stack_->samplerate();