X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Fviewitempaintparams.hpp;h=87e9d0e63b5447a442f89d70ddbca5f5b6c29e4e;hp=3128ef4802c3ce902f9791ccec2e607f803e1744;hb=3ed4af999487a1d7d851032b7a762bcda6e959cc;hpb=5b5fa4da3b7112414b9f51e6626ae7f4bf606f02 diff --git a/pv/view/viewitempaintparams.hpp b/pv/view/viewitempaintparams.hpp index 3128ef48..87e9d0e6 100644 --- a/pv/view/viewitempaintparams.hpp +++ b/pv/view/viewitempaintparams.hpp @@ -18,8 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef PULSEVIEW_PV_VIEW_ROWITEMPAINTPARAMS_H -#define PULSEVIEW_PV_VIEW_ROWITEMPAINTPARAMS_H +#ifndef PULSEVIEW_PV_VIEW_VIEWITEMPAINTPARAMS_HPP +#define PULSEVIEW_PV_VIEW_VIEWITEMPAINTPARAMS_HPP + +#include "pv/util.hpp" #include @@ -29,30 +31,47 @@ namespace view { class ViewItemPaintParams { public: - ViewItemPaintParams(int left, int right, double scale, double offset); + ViewItemPaintParams( + const QRect &rect, double scale, const pv::util::Timestamp& offset); + + QRect rect() const { + return rect_; + } + + double scale() const { + return scale_; + } + + const pv::util::Timestamp& offset() const { + return offset_; + } int left() const { - return left_; + return rect_.left(); } int right() const { - return right_; + return rect_.right(); } - double scale() const { - return scale_; + int top() const { + return rect_.top(); } - double offset() const { - return offset_; + int bottom() const { + return rect_.bottom(); } int width() const { - return right_ - left_; + return rect_.width(); + } + + int height() const { + return rect_.height(); } double pixels_offset() const { - return offset_ / scale_; + return (offset_ / scale_).convert_to(); } public: @@ -61,13 +80,12 @@ public: static int text_height(); private: - int left_; - int right_; + QRect rect_; double scale_; - double offset_; + pv::util::Timestamp offset_; }; } // namespace view } // namespace pv -#endif // PULSEVIEW_PV_VIEW_ROWITEMPAINTPARAMS_H +#endif // PULSEVIEW_PV_VIEW_VIEWITEMPAINTPARAMS_HPP