X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fview%2Fviewitempaintparams.hpp;h=9f2125c86159271ab981df0b46e2d201eac6bdc4;hp=86742ba7ceb811ec1e3642f7ee15e1776ac1e36e;hb=59ec98e2b704d918c236e82f41536ce833890fb0;hpb=7a01bd3654ed046216308fa64edfd79be7cd525f diff --git a/pv/view/viewitempaintparams.hpp b/pv/view/viewitempaintparams.hpp index 86742ba7..9f2125c8 100644 --- a/pv/view/viewitempaintparams.hpp +++ b/pv/view/viewitempaintparams.hpp @@ -14,22 +14,26 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * along with this program; if not, see . */ -#ifndef PULSEVIEW_PV_VIEW_ROWITEMPAINTPARAMS_HPP -#define PULSEVIEW_PV_VIEW_ROWITEMPAINTPARAMS_HPP +#ifndef PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWITEMPAINTPARAMS_HPP +#define PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWITEMPAINTPARAMS_HPP + +#include "pv/util.hpp" #include +#include namespace pv { -namespace view { +namespace views { +namespace TraceView { class ViewItemPaintParams { public: - ViewItemPaintParams(const QRect &rect, double scale, double offset); + ViewItemPaintParams( + const QRect &rect, double scale, const pv::util::Timestamp& offset); QRect rect() const { return rect_; @@ -39,7 +43,7 @@ public: return scale_; } - double offset() const { + const pv::util::Timestamp& offset() const { return offset_; } @@ -68,7 +72,13 @@ public: } double pixels_offset() const { - return offset_ / scale_; + return (offset_ / scale_).convert_to(); + } + + bool next_bg_colour_state() { + const bool state = bg_colour_state_; + bg_colour_state_ = !bg_colour_state_; + return state; } public: @@ -79,10 +89,12 @@ public: private: QRect rect_; double scale_; - double offset_; + pv::util::Timestamp offset_; + bool bg_colour_state_; }; -} // namespace view +} // namespace TraceView +} // namespace views } // namespace pv -#endif // PULSEVIEW_PV_VIEW_ROWITEMPAINTPARAMS_HPP +#endif // PULSEVIEW_PV_VIEWS_TRACEVIEW_VIEWITEMPAINTPARAMS_HPP