From: Joel Holdsworth Date: Sat, 13 Dec 2014 12:06:21 +0000 (+0000) Subject: ViewItemPaintParams: Added vertical layout information X-Git-Tag: pulseview-0.3.0~352 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=36e7001de1e6620deeb93fa77c2ec6c4ebc4b3ea;p=pulseview.git ViewItemPaintParams: Added vertical layout information --- diff --git a/pv/view/viewitempaintparams.cpp b/pv/view/viewitempaintparams.cpp index 4edc30a3..b6a17925 100644 --- a/pv/view/viewitempaintparams.cpp +++ b/pv/view/viewitempaintparams.cpp @@ -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); } diff --git a/pv/view/viewitempaintparams.hpp b/pv/view/viewitempaintparams.hpp index 3128ef48..a8b51906 100644 --- a/pv/view/viewitempaintparams.hpp +++ b/pv/view/viewitempaintparams.hpp @@ -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_; }; diff --git a/pv/view/viewport.cpp b/pv/view/viewport.cpp index 556babcc..84092ee4 100644 --- a/pv/view/viewport.cpp +++ b/pv/view/viewport.cpp @@ -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 r : row_items)