diff layer/Colour3DPlotRenderer.h @ 1113:261a00010918 spectrogram-minor-refactor

Consts and willRenderOpaque
author Chris Cannam
date Tue, 19 Jul 2016 14:49:46 +0100
parents d578b685d912
children be5b91ec81a0
line wrap: on
line diff
--- a/layer/Colour3DPlotRenderer.h	Tue Jul 19 10:12:30 2016 +0100
+++ b/layer/Colour3DPlotRenderer.h	Tue Jul 19 14:49:46 2016 +0100
@@ -120,7 +120,7 @@
      * that the LayerGeometryProvider returns valid results; it is the
      * caller's responsibility to ensure these.
      */
-    RenderResult render(LayerGeometryProvider *v, QPainter &paint, QRect rect);
+    RenderResult render(const LayerGeometryProvider *v, QPainter &paint, QRect rect);
     
     /**
      * Render the requested area using the given painter, obtaining
@@ -147,7 +147,7 @@
      * that the LayerGeometryProvider returns valid results; it is the
      * caller's responsibility to ensure these.
      */
-    RenderResult renderTimeConstrained(LayerGeometryProvider *v,
+    RenderResult renderTimeConstrained(const LayerGeometryProvider *v,
                                        QPainter &paint, QRect rect);
 
     /**
@@ -163,6 +163,15 @@
      * Returns an empty QRect if the cache is entirely valid.
      */
     QRect getLargestUncachedRect();
+
+    /**
+     * Return true if the rendering will be opaque. This may be used
+     * by the calling layer to determine whether it can scroll
+     * directly without regard to any other layers beneath.
+     */
+    bool willRenderOpaque(const LayerGeometryProvider *v) {
+        return decideRenderType(v) != DirectTranslucent;
+    }
     
 private:
     Sources m_sources;
@@ -183,17 +192,17 @@
     // then repainting from cache to the requested painter.
     ScrollableImageCache m_cache;
 
-    RenderResult render(LayerGeometryProvider *v,
+    RenderResult render(const LayerGeometryProvider *v,
                         QPainter &paint, QRect rect, bool timeConstrained);
 
-    void renderDirectTranslucent(LayerGeometryProvider *v,
+    void renderDirectTranslucent(const LayerGeometryProvider *v,
                                  QPainter &paint, QRect rect);
     
-    void renderToCachePixelResolution(LayerGeometryProvider *v, int x0,
+    void renderToCachePixelResolution(const LayerGeometryProvider *v, int x0,
                                       int repaintWidth, bool rightToLeft,
                                       bool timeConstrained);
 
-    void renderToCacheBinResolution(LayerGeometryProvider *v, int x0,
+    void renderToCacheBinResolution(const LayerGeometryProvider *v, int x0,
                                     int repaintWidth);
 
     int renderDrawBuffer(int w, int h,
@@ -203,7 +212,7 @@
                          bool rightToLeft,
                          bool timeConstrained);
 
-    int renderDrawBufferPeakFrequencies(LayerGeometryProvider *v,
+    int renderDrawBufferPeakFrequencies(const LayerGeometryProvider *v,
                                         int w, int h,
                                         const std::vector<int> &binforx,
                                         const std::vector<double> &binfory,
@@ -219,7 +228,7 @@
         DirectTranslucent
     };
 
-    RenderType decideRenderType(LayerGeometryProvider *) const;
+    RenderType decideRenderType(const LayerGeometryProvider *) const;
 };
 
 #endif