]> sigrok.org Git - pulseview.git/blobdiff - pv/view/logicsignal.cpp
Split signal painting into 3 layers
[pulseview.git] / pv / view / logicsignal.cpp
index 0c934cc72cb0f3de8a675332de3115deb86b9ee4..19522fb27f0187d05fd3b27dfd5c705045445162 100644 (file)
@@ -28,6 +28,7 @@
 #include "pv/sigsession.h"
 #include "pv/data/logic.h"
 #include "pv/data/logicsnapshot.h"
+#include "pv/view/view.h"
 
 using namespace boost;
 using namespace std;
@@ -117,6 +118,11 @@ void LogicSignal::init_context_bar_actions(QWidget *parent)
                this, SLOT(on_trigger_change()));
 }
 
+boost::shared_ptr<pv::data::Logic> LogicSignal::data() const
+{
+       return _data;
+}
+
 const list<QAction*> LogicSignal::get_context_bar_actions()
 {
        GVariant *gvar;
@@ -156,8 +162,13 @@ const list<QAction*> LogicSignal::get_context_bar_actions()
        return actions;
 }
 
-void LogicSignal::paint(QPainter &p, int y, int left, int right,
-               double scale, double offset)
+void LogicSignal::paint_back(QPainter &p, int left, int right)
+{
+       if (_probe->enabled)
+               paint_axis(p, get_y(), left, right);
+}
+
+void LogicSignal::paint_mid(QPainter &p, int left, int right)
 {
        using pv::view::View;
 
@@ -166,15 +177,20 @@ void LogicSignal::paint(QPainter &p, int y, int left, int right,
        vector< pair<int64_t, bool> > edges;
 
        assert(_probe);
-       assert(scale > 0);
        assert(_data);
        assert(right >= left);
 
+       assert(_view);
+       const int y = _v_offset - _view->v_offset();
+       
+       const double scale = _view->scale();
+       assert(scale > 0);
+       
+       const double offset = _view->offset();
+
        if (!_probe->enabled)
                return;
 
-       paint_axis(p, y, left, right);
-
        const float high_offset = y - View::SignalHeight + 0.5f;
        const float low_offset = y + 0.5f;