comparison base/ZoomConstraint.h @ 0:da6937383da8

initial import
author Chris Cannam
date Tue, 10 Jan 2006 16:33:16 +0000
parents
children d86891498eef
comparison
equal deleted inserted replaced
-1:000000000000 0:da6937383da8
1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 A waveform viewer and audio annotation editor.
5 Chris Cannam, Queen Mary University of London, 2005
6
7 This is experimental software. Not for distribution.
8 */
9
10 #ifndef _ZOOM_CONSTRAINT_H_
11 #define _ZOOM_CONSTRAINT_H_
12
13 #include <stdlib.h>
14
15 /**
16 * ZoomConstraint is a simple interface that describes a limitation on
17 * the available zoom sizes for a view, for example based on cache
18 * strategy or a (processing) window-size limitation.
19 *
20 * The default ZoomConstraint imposes no actual constraint.
21 */
22
23 class ZoomConstraint
24 {
25 public:
26 enum RoundingDirection {
27 RoundDown,
28 RoundUp,
29 RoundNearest
30 };
31
32 /**
33 * Given the "ideal" block size (frames per pixel) for a given
34 * zoom level, return the nearest viable block size for this
35 * constraint.
36 *
37 * For example, if a block size of 1523 frames per pixel is
38 * requested but the underlying model only supports value
39 * summaries at powers-of-two block sizes, return 1024 or 2048
40 * depending on the rounding direction supplied.
41 */
42 virtual size_t getNearestBlockSize(size_t requestedBlockSize,
43 RoundingDirection = RoundNearest)
44 const
45 {
46 return requestedBlockSize;
47 }
48 };
49
50 #endif
51