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> | 8 #include <utility> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 public: | 69 public: |
70 operator bool() const { return index_x_ != -1 && index_y_ != -1; } | 70 operator bool() const { return index_x_ != -1 && index_y_ != -1; } |
71 | 71 |
72 int index_x() const { return index_x_; } | 72 int index_x() const { return index_x_; } |
73 int index_y() const { return index_y_; } | 73 int index_y() const { return index_y_; } |
74 std::pair<int, int> index() const { | 74 std::pair<int, int> index() const { |
75 return std::make_pair(index_x_, index_y_); | 75 return std::make_pair(index_x_, index_y_); |
76 } | 76 } |
77 | 77 |
78 protected: | 78 protected: |
79 explicit BaseIterator(const TilingData* tiling_data); | 79 BaseIterator(); |
80 void done() { | 80 void done() { |
81 index_x_ = -1; | 81 index_x_ = -1; |
82 index_y_ = -1; | 82 index_y_ = -1; |
83 } | 83 } |
84 | 84 |
85 const TilingData* tiling_data_; | |
86 int index_x_; | 85 int index_x_; |
87 int index_y_; | 86 int index_y_; |
88 }; | 87 }; |
89 | 88 |
90 // Iterate through tiles whose bounds + optional border intersect with |rect|. | 89 // Iterate through tiles whose bounds + optional border intersect with |rect|. |
91 class CC_EXPORT Iterator : public BaseIterator { | 90 class CC_EXPORT Iterator : public BaseIterator { |
92 public: | 91 public: |
93 Iterator(); | 92 Iterator(); |
94 Iterator(const TilingData* tiling_data, | 93 Iterator(const TilingData* tiling_data, |
95 const gfx::Rect& consider_rect, | 94 const gfx::Rect& consider_rect, |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 int border_texels_; | 256 int border_texels_; |
258 | 257 |
259 // These are computed values. | 258 // These are computed values. |
260 int num_tiles_x_; | 259 int num_tiles_x_; |
261 int num_tiles_y_; | 260 int num_tiles_y_; |
262 }; | 261 }; |
263 | 262 |
264 } // namespace cc | 263 } // namespace cc |
265 | 264 |
266 #endif // CC_BASE_TILING_DATA_H_ | 265 #endif // CC_BASE_TILING_DATA_H_ |
OLD | NEW |