projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RowItemOwner: Added depth() method
[pulseview.git]
/
pv
/
view
/
analogsignal.cpp
diff --git
a/pv/view/analogsignal.cpp
b/pv/view/analogsignal.cpp
index 38468942a79ad594d7854cd43029aea08e75a3a7..a8d7b3e8113d6c514e9955fc9c897a65175977a3 100644
(file)
--- a/
pv/view/analogsignal.cpp
+++ b/
pv/view/analogsignal.cpp
@@
-31,6
+31,7
@@
#include <libsigrok/libsigrok.hpp>
using std::max;
#include <libsigrok/libsigrok.hpp>
using std::max;
+using std::make_pair;
using std::min;
using std::shared_ptr;
using std::deque;
using std::min;
using std::shared_ptr;
using std::deque;
@@
-40,6
+41,8
@@
using sigrok::Channel;
namespace pv {
namespace view {
namespace pv {
namespace view {
+const int AnalogSignal::NominalHeight = 80;
+
const QColor AnalogSignal::SignalColours[4] = {
QColor(0xC4, 0xA0, 0x00), // Yellow
QColor(0x87, 0x20, 0x7A), // Magenta
const QColor AnalogSignal::SignalColours[4] = {
QColor(0xC4, 0xA0, 0x00), // Yellow
QColor(0x87, 0x20, 0x7A), // Magenta
@@
-79,24
+82,32
@@
void AnalogSignal::set_scale(float scale)
_scale = scale;
}
_scale = scale;
}
+std::pair<int, int> AnalogSignal::v_extents() const
+{
+ return make_pair(-NominalHeight / 2, NominalHeight / 2);
+}
+
void AnalogSignal::paint_back(QPainter &p, int left, int right)
{
if (_channel->enabled())
void AnalogSignal::paint_back(QPainter &p, int left, int right)
{
if (_channel->enabled())
- paint_axis(p, get_y(), left, right);
+ paint_axis(p, get_
visual_
y(), left, right);
}
void AnalogSignal::paint_mid(QPainter &p, int left, int right)
{
assert(_data);
assert(right >= left);
}
void AnalogSignal::paint_mid(QPainter &p, int left, int right)
{
assert(_data);
assert(right >= left);
+ assert(_owner);
+
+ const int y = get_visual_y();
-
assert(_view
);
-
const int y = _v_offset - _view->v_offset(
);
+
const View *const view = _owner->view(
);
+
assert(view
);
- const double scale =
_
view->scale();
+ const double scale = view->scale();
assert(scale > 0);
assert(scale > 0);
- const double offset =
_
view->offset();
+ const double offset = view->offset();
if (!_channel->enabled())
return;
if (!_channel->enabled())
return;