comparison base/ZoomConstraint.h @ 1527:710e6250a401 zoom

Merge from default branch
author Chris Cannam
date Mon, 17 Sep 2018 13:51:14 +0100
parents d4a28d1479a8 48e9f538e6e9
children c1c45c5146bb
comparison
equal deleted inserted replaced
1324:d4a28d1479a8 1527:710e6250a401
33 { 33 {
34 public: 34 public:
35 virtual ~ZoomConstraint() { } 35 virtual ~ZoomConstraint() { }
36 36
37 enum RoundingDirection { 37 enum RoundingDirection {
38 RoundDown, 38 RoundDown,
39 RoundUp, 39 RoundUp,
40 RoundNearest 40 RoundNearest
41 }; 41 };
42 42
43 /** 43 /**
44 * Given an "ideal" zoom level (frames per pixel or pixels per 44 * Given an "ideal" zoom level (frames per pixel or pixels per
45 * frame) for a given zoom level, return the nearest viable block 45 * frame) for a given zoom level, return the nearest viable block
50 * summaries at powers-of-two block sizes, return 1024 or 2048 50 * summaries at powers-of-two block sizes, return 1024 or 2048
51 * depending on the rounding direction supplied. 51 * depending on the rounding direction supplied.
52 */ 52 */
53 virtual ZoomLevel getNearestZoomLevel(ZoomLevel requestedZoomLevel, 53 virtual ZoomLevel getNearestZoomLevel(ZoomLevel requestedZoomLevel,
54 RoundingDirection = RoundNearest) 54 RoundingDirection = RoundNearest)
55 const 55 const
56 { 56 {
57 if (getMaxZoomLevel() < requestedZoomLevel) return getMaxZoomLevel(); 57 if (getMaxZoomLevel() < requestedZoomLevel) return getMaxZoomLevel();
58 else return requestedZoomLevel; 58 else return requestedZoomLevel;
59 } 59 }
60 60