# HG changeset patch # User Chris Cannam # Date 1537536823 -3600 # Node ID 0e4551fd7f1407890d0bf17a9628a7ed9a74bb08 # Parent 59f6830be8d89b870e448d2e883a030219eb6d99 Another tidy diff -r 59f6830be8d8 -r 0e4551fd7f14 layer/WaveformLayer.cpp --- a/layer/WaveformLayer.cpp Fri Sep 21 14:22:53 2018 +0100 +++ b/layer/WaveformLayer.cpp Fri Sep 21 14:33:43 2018 +0100 @@ -554,15 +554,19 @@ } int x0 = 0, x1 = w - 1; - int y0 = 0, y1 = h - 1; x0 = rect.left(); x1 = rect.right(); - y0 = rect.top(); - y1 = rect.bottom(); - if (x0 > 0) --x0; - if (x1 < w) ++x1; + if (x0 > 0) { + rect.adjust(-1, 0, 0, 0); + x0 = rect.left(); + } + + if (x1 < w) { + rect.adjust(0, 0, 1, 0); + x1 = rect.right(); + } // Our zoom level may differ from that at which the underlying // model has its blocks. @@ -616,8 +620,7 @@ } for (int ch = minChannel; ch <= maxChannel; ++ch) { - paintChannel(v, paint, ch, ranges, - blockSize, x0, y0, x1, y1, frame0, frame1); + paintChannel(v, paint, rect, ch, ranges, blockSize, frame0, frame1); } if (m_middleLineHeight != 0.5) { @@ -636,13 +639,18 @@ } void -WaveformLayer::paintChannel(LayerGeometryProvider *v, QPainter *paint, int ch, +WaveformLayer::paintChannel(LayerGeometryProvider *v, QPainter *paint, + QRect rect, int ch, const vector &ranges, - int blockSize, int x0, int y0, int x1, int y1, - sv_frame_t frame0, sv_frame_t frame1) + int blockSize, sv_frame_t frame0, sv_frame_t frame1) const { - int w = v->getPaintWidth(); + int x0 = rect.left(); + int y0 = rect.top(); + + int x1 = rect.right(); + int y1 = rect.bottom(); + int h = v->getPaintHeight(); int channels = 0, minChannel = 0, maxChannel = 0; @@ -690,6 +698,8 @@ my = m + (((ch - minChannel) * h) / channels); } + + paint->setPen(greys[1]); paint->drawLine(x0, my, x1, my); diff -r 59f6830be8d8 -r 0e4551fd7f14 layer/WaveformLayer.h --- a/layer/WaveformLayer.h Fri Sep 21 14:22:53 2018 +0100 +++ b/layer/WaveformLayer.h Fri Sep 21 14:33:43 2018 +0100 @@ -213,10 +213,11 @@ int getChannelArrangement(int &min, int &max, bool &merging, bool &mixing) const; - void paintChannel(LayerGeometryProvider *, QPainter *paint, int channel, + void paintChannel(LayerGeometryProvider *, QPainter *paint, QRect rect, + int channel, const std::vector &ranges, - int blockSize, int x0, int y0, int x1, int y1, - sv_frame_t frame0, sv_frame_t frame1) const; + int blockSize, sv_frame_t frame0, sv_frame_t frame1) + const; int getYForValue(const LayerGeometryProvider *v, double value, int channel) const;