Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: cc/base/tiling_data.h

Issue 645173004: cc: Add ReverseSpiralDifferenceIterator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/base/tiling_data.cc » ('j') | cc/base/tiling_data.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 enum Direction { UP, LEFT, DOWN, RIGHT }; 175 enum Direction { UP, LEFT, DOWN, RIGHT };
176 176
177 Direction direction_; 177 Direction direction_;
178 int delta_x_; 178 int delta_x_;
179 int delta_y_; 179 int delta_y_;
180 int current_step_; 180 int current_step_;
181 int horizontal_step_count_; 181 int horizontal_step_count_;
182 int vertical_step_count_; 182 int vertical_step_count_;
183 }; 183 };
184 184
185 class CC_EXPORT ReverseSpiralDifferenceIterator : public BaseIterator {
186 public:
187 ReverseSpiralDifferenceIterator();
188 ReverseSpiralDifferenceIterator(const TilingData* tiling_data,
189 const gfx::Rect& consider_rect,
190 const gfx::Rect& ignore_rect,
191 const gfx::Rect& center_rect);
192 ReverseSpiralDifferenceIterator& operator++();
193
194 private:
195 bool in_consider_rect() const {
196 return index_x_ >= consider_left_ && index_x_ <= consider_right_ &&
197 index_y_ >= consider_top_ && index_y_ <= consider_bottom_;
198 }
199 bool in_around_rect() const {
200 return index_x_ >= around_left_ && index_x_ <= around_right_ &&
201 index_y_ >= around_top_ && index_y_ <= around_bottom_;
202 }
203 bool in_ignore_rect() const {
204 return index_x_ >= ignore_left_ && index_x_ <= ignore_right_ &&
205 index_y_ >= ignore_top_ && index_y_ <= ignore_bottom_;
206 }
207 bool valid_column() const {
208 return index_x_ >= consider_left_ && index_x_ <= consider_right_;
209 }
210 bool valid_row() const {
211 return index_y_ >= consider_top_ && index_y_ <= consider_bottom_;
212 }
213
214 int current_step_count() const {
215 return (direction_ == UP || direction_ == DOWN) ? vertical_step_count_
216 : horizontal_step_count_;
217 }
218
219 bool needs_direction_switch() const;
220 void switch_direction();
221
222 int consider_left_;
223 int consider_top_;
224 int consider_right_;
225 int consider_bottom_;
226 int around_left_;
227 int around_top_;
228 int around_right_;
229 int around_bottom_;
ajuma 2014/10/15 17:56:52 Just to make sure I'm understanding, the reason we
vmpstr 2014/10/15 18:10:46 That's correct. In the outward spiral, we just sta
230 int ignore_left_;
231 int ignore_top_;
232 int ignore_right_;
233 int ignore_bottom_;
234
235 enum Direction { LEFT, UP, RIGHT, DOWN };
236
237 Direction direction_;
238 int delta_x_;
239 int delta_y_;
240 int current_step_;
241 int horizontal_step_count_;
242 int vertical_step_count_;
243 };
244
185 private: 245 private:
186 void AssertTile(int i, int j) const { 246 void AssertTile(int i, int j) const {
187 DCHECK_GE(i, 0); 247 DCHECK_GE(i, 0);
188 DCHECK_LT(i, num_tiles_x_); 248 DCHECK_LT(i, num_tiles_x_);
189 DCHECK_GE(j, 0); 249 DCHECK_GE(j, 0);
190 DCHECK_LT(j, num_tiles_y_); 250 DCHECK_LT(j, num_tiles_y_);
191 } 251 }
192 252
193 void RecomputeNumTiles(); 253 void RecomputeNumTiles();
194 254
195 gfx::Size max_texture_size_; 255 gfx::Size max_texture_size_;
196 gfx::Size tiling_size_; 256 gfx::Size tiling_size_;
197 int border_texels_; 257 int border_texels_;
198 258
199 // These are computed values. 259 // These are computed values.
200 int num_tiles_x_; 260 int num_tiles_x_;
201 int num_tiles_y_; 261 int num_tiles_y_;
202 }; 262 };
203 263
204 } // namespace cc 264 } // namespace cc
205 265
206 #endif // CC_BASE_TILING_DATA_H_ 266 #endif // CC_BASE_TILING_DATA_H_
OLDNEW
« no previous file with comments | « no previous file | cc/base/tiling_data.cc » ('j') | cc/base/tiling_data.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698