15 #ifndef SV_ZOOM_LEVEL_H 16 #define SV_ZOOM_LEVEL_H 41 if (other.
zone == zone) {
42 return level < other.
level;
47 if (other.
zone == zone) {
48 return level > other.
level;
56 return (zone == other.
zone && level == other.
level);
61 return {
zone, level + 1 };
62 }
else if (level == 1) {
64 }
else if (level == 2) {
67 return {
zone, level - 1 };
73 return {
zone, level + 1 };
74 }
else if (level == 1) {
77 return {
zone, level - 1 };
87 return frames *
level;
89 return frames /
level;
99 return pixels /
level;
101 return pixels *
level;
109 if (pixels < frames) {
112 int r = int(round(pixels/
double(frames)));
static ZoomLevel fromRatio(int pixels, sv_frame_t frames)
Return a ZoomLevel that approximates the given ratio of pixels to frames.
int64_t sv_frame_t
Frame index, the unit of our time axis.
double framesToPixels(double frames) const
Inexact conversion.
bool operator<(const ZoomLevel &other) const
ZoomLevel decremented() const
double pixelsToFrames(double pixels) const
Inexact conversion.
bool operator==(const ZoomLevel &other) const
ZoomLevel(Zone z, int lev)
std::ostream & operator<<(std::ostream &s, const ZoomLevel &z)
ZoomLevel incremented() const