diff base/BaseTypes.h @ 1532:5360f7aba189 zoom

Pull out ZoomLevel, add inexact frame/pixel conversion functions and streaming
author Chris Cannam
date Wed, 19 Sep 2018 15:41:44 +0100
parents bf32b26d1dad
children 895186c43fce
line wrap: on
line diff
--- a/base/BaseTypes.h	Tue Sep 18 16:28:56 2018 +0100
+++ b/base/BaseTypes.h	Wed Sep 19 15:41:44 2018 +0100
@@ -55,62 +55,5 @@
 typedef std::vector<std::complex<float>,
                     breakfastquay::StlAllocator<std::complex<float>>> complexvec_t;
 
-/** Display zoom level. Can be an integer number of samples per pixel,
- *  or an integer number of pixels per sample.
- */
-struct ZoomLevel {
-
-    enum Zone {
-        FramesPerPixel, // zoomed out (as in classic SV)
-        PixelsPerFrame  // zoomed in beyond 1-1 (interpolating the waveform)
-    };
-    Zone zone;
-    int level;
-
-    ZoomLevel(Zone z, int l) : zone(z), level(l) { }
-    
-    bool operator<(const ZoomLevel &other) const {
-        if (zone == FramesPerPixel) {
-            if (other.zone == zone) {
-                return level < other.level;
-            } else {
-                return false;
-            }
-        } else {
-            if (other.zone == zone) {
-                return level > other.level;
-            } else {
-                return false;
-            }
-        }
-    }
-
-    bool operator==(const ZoomLevel &other) const {
-        return (zone == other.zone && level == other.level);
-    }
-    
-    ZoomLevel incremented() const {
-        if (zone == FramesPerPixel) {
-            return { zone, level + 1 };
-        } else if (level == 1) {
-            return { FramesPerPixel, 2 };
-        } else if (level == 2) {
-            return { FramesPerPixel, 1 };
-        } else {
-            return { zone, level - 1 };
-        }
-    }
-
-    ZoomLevel decremented() const {
-        if (zone == PixelsPerFrame) {
-            return { zone, level + 1 };
-        } else if (level == 1) {
-            return { PixelsPerFrame, 2 };
-        } else {
-            return { zone, level - 1 };
-        }
-    }
-};
-
 #endif