OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_BASE_INDEX_RECT_H_ | 5 #ifndef CC_BASE_INDEX_RECT_H_ |
6 #define CC_BASE_INDEX_RECT_H_ | 6 #define CC_BASE_INDEX_RECT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "cc/base/cc_export.h" | 10 #include "cc/base/base_export.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 // This class encapsulates the index boundaries for region on co-ordinate system | 14 // This class encapsulates the index boundaries for region on co-ordinate system |
15 // (used for tiling). The delimiting boundaries |left_|, |right_|, |top_| and | 15 // (used for tiling). The delimiting boundaries |left_|, |right_|, |top_| and |
16 // |bottom_| are basically leftmost, rightmost, topmost and bottommost indices | 16 // |bottom_| are basically leftmost, rightmost, topmost and bottommost indices |
17 // of the region. These delimiters can span in any quadrants. | 17 // of the region. These delimiters can span in any quadrants. |
18 // | 18 // |
19 // If |left_| <= |right_| and |top_| <= |bottom_|, IndexRect is considered to | 19 // If |left_| <= |right_| and |top_| <= |bottom_|, IndexRect is considered to |
20 // hold valid indices and this can be checked using is_valid(). | 20 // hold valid indices and this can be checked using is_valid(). |
(...skipping 30 matching lines...) Expand all Loading... |
51 // 0 │ │ │ │ │ │ | 51 // 0 │ │ │ │ │ │ |
52 // ├───┼───┼───┼───┼───┤ | 52 // ├───┼───┼───┼───┼───┤ |
53 // 1 │ │ │ │ │ │ | 53 // 1 │ │ │ │ │ │ |
54 // ├───┼───┼───┼───┼───┤ | 54 // ├───┼───┼───┼───┼───┤ |
55 // 2 │ │ │ │ │ │ | 55 // 2 │ │ │ │ │ │ |
56 // ├───┼───┼───┼───┼───┤ | 56 // ├───┼───┼───┼───┼───┤ |
57 // 3 │ │ │ │ │ │ | 57 // 3 │ │ │ │ │ │ |
58 // ├───┼───┼───┼───┼───┤ | 58 // ├───┼───┼───┼───┼───┤ |
59 // 4 │ │ │ │ │ │ | 59 // 4 │ │ │ │ │ │ |
60 // └───┴───┴───┴───┴───┘ | 60 // └───┴───┴───┴───┴───┘ |
61 class CC_EXPORT IndexRect { | 61 class CC_BASE_EXPORT IndexRect { |
62 public: | 62 public: |
63 constexpr IndexRect(int left, int right, int top, int bottom) | 63 constexpr IndexRect(int left, int right, int top, int bottom) |
64 : left_(left), right_(right), top_(top), bottom_(bottom) {} | 64 : left_(left), right_(right), top_(top), bottom_(bottom) {} |
65 | 65 |
66 ~IndexRect() = default; | 66 ~IndexRect() = default; |
67 | 67 |
68 constexpr int left() const { return left_; } | 68 constexpr int left() const { return left_; } |
69 constexpr int right() const { return right_; } | 69 constexpr int right() const { return right_; } |
70 constexpr int top() const { return top_; } | 70 constexpr int top() const { return top_; } |
71 constexpr int bottom() const { return bottom_; } | 71 constexpr int bottom() const { return bottom_; } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 lhs.top() == rhs.top() && lhs.bottom() == rhs.bottom(); | 114 lhs.top() == rhs.top() && lhs.bottom() == rhs.bottom(); |
115 } | 115 } |
116 | 116 |
117 inline bool operator!=(const IndexRect& lhs, const IndexRect& rhs) { | 117 inline bool operator!=(const IndexRect& lhs, const IndexRect& rhs) { |
118 return !(lhs == rhs); | 118 return !(lhs == rhs); |
119 } | 119 } |
120 | 120 |
121 } // namespace cc | 121 } // namespace cc |
122 | 122 |
123 #endif // CC_BASE_INDEX_RECT_H_ | 123 #endif // CC_BASE_INDEX_RECT_H_ |
OLD | NEW |