changeset 1534:8f9e9cff141d zoom

Use frame type
author Chris Cannam
date Thu, 20 Sep 2018 11:45:11 +0100
parents 53073777e591
children 22fe34dd7f26
files base/ZoomLevel.h
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/base/ZoomLevel.h	Thu Sep 20 10:45:48 2018 +0100
+++ b/base/ZoomLevel.h	Thu Sep 20 11:45:11 2018 +0100
@@ -15,6 +15,8 @@
 #ifndef SV_ZOOM_LEVEL_H
 #define SV_ZOOM_LEVEL_H
 
+#include "BaseTypes.h"
+
 #include <ostream>
 #include <cmath>
 
@@ -103,11 +105,11 @@
     /** Return a ZoomLevel that approximates the given ratio of pixels
      *  to frames.
      */
-    static ZoomLevel fromRatio(int pixels, int frames) {
+    static ZoomLevel fromRatio(int pixels, sv_frame_t frames) {
         if (pixels < frames) {
-            return { FramesPerPixel, int(round(double(pixels)/frames)) };
+            return { FramesPerPixel, int(round(double(frames)/pixels)) };
         } else {
-            int r = int(round(double(frames)/pixels));
+            int r = int(round(pixels/double(frames)));
             if (r > 1) {
                 return { PixelsPerFrame, r };
             } else {