comparison view/ViewProxy.h @ 1030:0be17aafa935 spectrogram-minor-refactor

Start refactoring out the spectrogram image cache
author Chris Cannam
date Fri, 29 Jan 2016 15:08:01 +0000
parents 4c8e7014abab
children 4e5c1c326794
comparison
equal deleted inserted replaced
1029:fdfd84b022df 1030:0be17aafa935
39 virtual sv_frame_t getFrameForX(int x) const { 39 virtual sv_frame_t getFrameForX(int x) const {
40 sv_frame_t f0 = m_view->getFrameForX(x / m_scaleFactor); 40 sv_frame_t f0 = m_view->getFrameForX(x / m_scaleFactor);
41 if (m_scaleFactor == 1) return f0; 41 if (m_scaleFactor == 1) return f0;
42 sv_frame_t f1 = m_view->getFrameForX((x / m_scaleFactor) + 1); 42 sv_frame_t f1 = m_view->getFrameForX((x / m_scaleFactor) + 1);
43 return f0 + ((f1 - f0) * (x % m_scaleFactor)) / m_scaleFactor; 43 return f0 + ((f1 - f0) * (x % m_scaleFactor)) / m_scaleFactor;
44 }
45 virtual int getXForViewX(int viewx) const {
46 return viewx * m_scaleFactor;
47 }
48 virtual int getViewXForX(int x) const {
49 return x / m_scaleFactor;
44 } 50 }
45 virtual sv_frame_t getModelsStartFrame() const { 51 virtual sv_frame_t getModelsStartFrame() const {
46 return m_view->getModelsStartFrame(); 52 return m_view->getModelsStartFrame();
47 } 53 }
48 virtual sv_frame_t getModelsEndFrame() const { 54 virtual sv_frame_t getModelsEndFrame() const {
127 virtual void drawMeasurementRect(QPainter &p, const Layer *layer, 133 virtual void drawMeasurementRect(QPainter &p, const Layer *layer,
128 QRect rect, bool focus) const { 134 QRect rect, bool focus) const {
129 m_view->drawMeasurementRect(p, layer, rect, focus); 135 m_view->drawMeasurementRect(p, layer, rect, focus);
130 } 136 }
131 137
138 virtual void updatePaintRect(QRect r) {
139 m_view->update(r.x() / m_scaleFactor,
140 r.y() / m_scaleFactor,
141 r.width() / m_scaleFactor,
142 r.height() / m_scaleFactor);
143 }
144
132 virtual View *getView() { return m_view; } 145 virtual View *getView() { return m_view; }
133 virtual const View *getView() const { return m_view; } 146 virtual const View *getView() const { return m_view; }
134 147
135 private: 148 private:
136 View *m_view; 149 View *m_view;