OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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_TILING_DATA_H_ | 5 #ifndef CC_BASE_TILING_DATA_H_ |
6 #define CC_BASE_TILING_DATA_H_ | 6 #define CC_BASE_TILING_DATA_H_ |
7 | 7 |
| 8 #include <utility> |
| 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
11 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
12 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
13 | 15 |
14 namespace gfx { | 16 namespace gfx { |
15 class Vector2d; | 17 class Vector2d; |
16 } | 18 } |
17 | 19 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 operator bool() const { return index_x_ != -1 && index_y_ != -1; } | 69 operator bool() const { return index_x_ != -1 && index_y_ != -1; } |
68 | 70 |
69 int index_x() const { return index_x_; } | 71 int index_x() const { return index_x_; } |
70 int index_y() const { return index_y_; } | 72 int index_y() const { return index_y_; } |
71 std::pair<int, int> index() const { | 73 std::pair<int, int> index() const { |
72 return std::make_pair(index_x_, index_y_); | 74 return std::make_pair(index_x_, index_y_); |
73 } | 75 } |
74 | 76 |
75 protected: | 77 protected: |
76 explicit BaseIterator(const TilingData* tiling_data); | 78 explicit BaseIterator(const TilingData* tiling_data); |
77 void done() { index_x_ = -1; index_y_ = -1; } | 79 void done() { |
| 80 index_x_ = -1; |
| 81 index_y_ = -1; |
| 82 } |
78 | 83 |
79 const TilingData* tiling_data_; | 84 const TilingData* tiling_data_; |
80 int index_x_; | 85 int index_x_; |
81 int index_y_; | 86 int index_y_; |
82 }; | 87 }; |
83 | 88 |
84 // Iterate through all indices whose bounds + border intersect with |rect|. | 89 // Iterate through all indices whose bounds + border intersect with |rect|. |
85 class CC_EXPORT Iterator : public BaseIterator { | 90 class CC_EXPORT Iterator : public BaseIterator { |
86 public: | 91 public: |
87 Iterator(const TilingData* tiling_data, gfx::Rect rect); | 92 Iterator(const TilingData* tiling_data, gfx::Rect rect); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 int border_texels_; | 139 int border_texels_; |
135 | 140 |
136 // These are computed values. | 141 // These are computed values. |
137 int num_tiles_x_; | 142 int num_tiles_x_; |
138 int num_tiles_y_; | 143 int num_tiles_y_; |
139 }; | 144 }; |
140 | 145 |
141 } // namespace cc | 146 } // namespace cc |
142 | 147 |
143 #endif // CC_BASE_TILING_DATA_H_ | 148 #endif // CC_BASE_TILING_DATA_H_ |
OLD | NEW |