Mercurial > hg > svgui
comparison layer/ScrollableImageCache.h @ 1079:7ebfb61b1701 spectrogram-minor-refactor
More filling in render & cache code
author | Chris Cannam |
---|---|
date | Thu, 30 Jun 2016 15:46:14 +0100 |
parents | 5144d7185fb5 |
children | cbc7c8675706 |
comparison
equal
deleted
inserted
replaced
1078:ee01a4062747 | 1079:7ebfb61b1701 |
---|---|
56 QSize getSize() const { | 56 QSize getSize() const { |
57 return m_image.size(); | 57 return m_image.size(); |
58 } | 58 } |
59 | 59 |
60 void resize(QSize newSize) { | 60 void resize(QSize newSize) { |
61 m_image = QImage(newSize, QImage::Format_ARGB32_Premultiplied); | 61 if (getSize() != newSize) { |
62 invalidate(); | 62 m_image = QImage(newSize, QImage::Format_ARGB32_Premultiplied); |
63 invalidate(); | |
64 } | |
63 } | 65 } |
64 | 66 |
65 int getValidLeft() const { | 67 int getValidLeft() const { |
66 return m_left; | 68 return m_left; |
67 } | 69 } |
81 int getZoomLevel() const { | 83 int getZoomLevel() const { |
82 return m_zoomLevel; | 84 return m_zoomLevel; |
83 } | 85 } |
84 | 86 |
85 void setZoomLevel(int zoom) { | 87 void setZoomLevel(int zoom) { |
86 m_zoomLevel = zoom; | 88 if (m_zoomLevel != zoom) { |
87 invalidate(); | 89 m_zoomLevel = zoom; |
90 invalidate(); | |
91 } | |
88 } | 92 } |
89 | 93 |
90 sv_frame_t getStartFrame() const { | 94 sv_frame_t getStartFrame() const { |
91 return m_startFrame; | 95 return m_startFrame; |
92 } | 96 } |
95 * Set the start frame and invalidate the cache. To scroll, | 99 * Set the start frame and invalidate the cache. To scroll, |
96 * i.e. to set the start frame while retaining cache validity | 100 * i.e. to set the start frame while retaining cache validity |
97 * where possible, use scrollTo() instead. | 101 * where possible, use scrollTo() instead. |
98 */ | 102 */ |
99 void setStartFrame(sv_frame_t frame) { | 103 void setStartFrame(sv_frame_t frame) { |
100 m_startFrame = frame; | 104 if (m_startFrame != frame) { |
101 invalidate(); | 105 m_startFrame = frame; |
106 invalidate(); | |
107 } | |
102 } | 108 } |
103 | 109 |
104 const QImage &getImage() const { | 110 const QImage &getImage() const { |
105 return m_image; | 111 return m_image; |
106 } | 112 } |