OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CC_BASE_PYRAMID_SEQUENCE_H_ | |
6 #define CC_BASE_PYRAMID_SEQUENCE_H_ | |
7 | |
8 #include "base/logging.h" | |
9 #include "cc/base/cc_export.h" | |
10 | |
11 namespace cc { | |
12 | |
13 class CC_EXPORT PyramidSequence { | |
vmpstr
2016/06/16 18:28:58
Can you put a comprehensive comment here explainin
| |
14 public: | |
15 enum class Type : uint16_t { | |
16 FORWARD, | |
17 BACKWARD, | |
18 DIAGONAL_FORWARD, | |
19 DIAGONAL_BACKWARD | |
20 }; | |
21 | |
22 PyramidSequence(Type type, int start, int end, int levels); | |
vmpstr
2016/06/16 18:28:58
This needs a comment to explain what each variable
| |
23 ~PyramidSequence(); | |
24 | |
25 int GetCurrent(); | |
vmpstr
2016/06/16 18:28:58
Name this better... GetCurrent what?
| |
26 int GetCoverage(); | |
27 bool within_bounds() { return within_bounds_; } | |
vmpstr
2016/06/16 18:28:58
is_within_bounds
| |
28 void Advance(); | |
29 | |
30 private: | |
31 typedef void (PyramidSequence::*InflateFn)(); | |
vmpstr
2016/06/16 18:28:58
using InflateFn = void (PyramidSequence::*)();
| |
32 typedef bool (PyramidSequence::*IsWithinBoundsFn)(); | |
33 | |
34 void Init(Type type); | |
35 void Reset(); | |
36 | |
37 void InflateForward(); | |
38 bool IsWithinBoundsForward(); | |
39 void InflateBackward(); | |
40 bool IsWithinBoundsBackward(); | |
41 void InflateDiagonalForward(); | |
42 bool IsWithinBoundsDiagonalForward(); | |
43 void InflateDiagonalBackward(); | |
44 bool IsWithinBoundsDiagonalBackward(); | |
45 | |
46 int start_; | |
47 int end_; | |
48 int levels_; | |
49 int levels_traversed_; | |
50 bool within_bounds_; | |
51 int current_; | |
52 int step_; | |
53 | |
54 InflateFn inflater_; | |
vmpstr
2016/06/16 18:28:58
I'd call this "inflate_" and "determine_within_bou
| |
55 IsWithinBoundsFn within_bounds_checker_; | |
56 }; | |
57 | |
58 } // namespace cc | |
59 | |
60 #endif // CC_BASE_PYRAMID_SEQUENCE_H_ | |
OLD | NEW |