]> sigrok.org Git - pulseview.git/commitdiff
ViewItemPaintParams: Added vertical layout information
authorJoel Holdsworth <redacted>
Sat, 13 Dec 2014 12:06:21 +0000 (12:06 +0000)
committerJoel Holdsworth <redacted>
Sun, 28 Dec 2014 15:35:57 +0000 (15:35 +0000)
pv/view/viewitempaintparams.cpp
pv/view/viewitempaintparams.hpp
pv/view/viewport.cpp

index 4edc30a35e6a13a96dc0e645b0e67b91d3349683..b6a179251e0605a2361439c5c7ae501f40591b40 100644 (file)
@@ -29,12 +29,10 @@ namespace pv {
 namespace view {
 
 ViewItemPaintParams::ViewItemPaintParams(
-       int left, int right, double scale, double offset) :
-       left_(left),
-       right_(right),
+       const QRect &rect, double scale, double offset) :
+       rect_(rect),
        scale_(scale),
        offset_(offset) {
-       assert(left <= right);
        assert(scale > 0.0);
 }
 
index 3128ef4802c3ce902f9791ccec2e607f803e1744..a8b519067250976ff0990a510d93a5f2bca6df72 100644 (file)
@@ -29,14 +29,10 @@ namespace view {
 class ViewItemPaintParams
 {
 public:
-       ViewItemPaintParams(int left, int right, double scale, double offset);
+       ViewItemPaintParams(const QRect &rect, double scale, double offset);
 
-       int left() const {
-               return left_;
-       }
-
-       int right() const {
-               return right_;
+       QRect rect() const {
+               return rect_;
        }
 
        double scale() const {
@@ -47,8 +43,28 @@ public:
                return offset_;
        }
 
+       int left() const {
+               return rect_.left();
+       }
+
+       int right() const {
+               return rect_.right();
+       }
+
+       int top() const {
+               return rect_.top();
+       }
+
+       int bottom() const {
+               return rect_.bottom();
+       }
+
        int width() const {
-               return right_ - left_;
+               return rect_.width();
+       }
+
+       int height() const {
+               return rect_.width();
        }
 
        double pixels_offset() const {
@@ -61,8 +77,7 @@ public:
        static int text_height();
 
 private:
-       int left_;
-       int right_;
+       QRect rect_;
        double scale_;
        double offset_;
 };
index 556babcc94435de43d98cd833914f751430d9a97..84092ee451ba77caea5a9661687ff2a8befd9ad5 100644 (file)
@@ -70,7 +70,7 @@ void Viewport::paintEvent(QPaintEvent*)
        if (view_.cursors_shown())
                view_.cursors()->draw_viewport_background(p, rect());
 
-       const ViewItemPaintParams pp(0, width(), view_.scale(), view_.offset());
+       const ViewItemPaintParams pp(rect(), view_.scale(), view_.offset());
 
        // Plot the signal
        for (const shared_ptr<RowItem> r : row_items)