X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fview%2Fanalogsignal.cpp;h=a8d7b3e8113d6c514e9955fc9c897a65175977a3;hb=448a72cf7f0225eace2335ec05b979c4e9a6b882;hp=bba84caeaff2eef7444d4e59e8f2ed3b279e2765;hpb=d5d1f925b5480e4f7d40a8cbc67bd653fa89bd89;p=pulseview.git diff --git a/pv/view/analogsignal.cpp b/pv/view/analogsignal.cpp index bba84cae..a8d7b3e8 100644 --- a/pv/view/analogsignal.cpp +++ b/pv/view/analogsignal.cpp @@ -31,6 +31,7 @@ #include using std::max; +using std::make_pair; using std::min; using std::shared_ptr; using std::deque; @@ -40,6 +41,8 @@ using sigrok::Channel; namespace pv { namespace view { +const int AnalogSignal::NominalHeight = 80; + const QColor AnalogSignal::SignalColours[4] = { QColor(0xC4, 0xA0, 0x00), // Yellow QColor(0x87, 0x20, 0x7A), // Magenta @@ -79,23 +82,32 @@ void AnalogSignal::set_scale(float scale) _scale = scale; } +std::pair AnalogSignal::v_extents() const +{ + return make_pair(-NominalHeight / 2, NominalHeight / 2); +} + void AnalogSignal::paint_back(QPainter &p, int left, int right) { if (_channel->enabled()) - paint_axis(p, get_y(), left, right); + paint_axis(p, get_visual_y(), left, right); } void AnalogSignal::paint_mid(QPainter &p, int left, int right) { assert(_data); assert(right >= left); + assert(_owner); + + const int y = get_visual_y(); - const int y = get_y(); + const View *const view = _owner->view(); + assert(view); - const double scale = _view->scale(); + const double scale = view->scale(); assert(scale > 0); - const double offset = _view->offset(); + const double offset = view->offset(); if (!_channel->enabled()) return;