diff 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
line wrap: on
line diff
--- a/layer/ScrollableImageCache.h	Thu Jun 30 12:40:22 2016 +0100
+++ b/layer/ScrollableImageCache.h	Thu Jun 30 15:46:14 2016 +0100
@@ -58,8 +58,10 @@
     }
     
     void resize(QSize newSize) {
-	m_image = QImage(newSize, QImage::Format_ARGB32_Premultiplied);
-	invalidate();
+        if (getSize() != newSize) {
+            m_image = QImage(newSize, QImage::Format_ARGB32_Premultiplied);
+            invalidate();
+        }
     }
 	
     int getValidLeft() const {
@@ -83,8 +85,10 @@
     }
     
     void setZoomLevel(int zoom) {
-	m_zoomLevel = zoom;
-	invalidate();
+        if (m_zoomLevel != zoom) {
+            m_zoomLevel = zoom;
+            invalidate();
+        }
     }
 
     sv_frame_t getStartFrame() const {
@@ -97,8 +101,10 @@
      * where possible, use scrollTo() instead.
      */
     void setStartFrame(sv_frame_t frame) {
-	m_startFrame = frame;
-	invalidate();
+        if (m_startFrame != frame) {
+            m_startFrame = frame;
+            invalidate();
+        }
     }
     
     const QImage &getImage() const {