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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/base/tiling_data.cc » ('j') | cc/base/tiling_data.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/tiling_data.h
diff --git a/cc/base/tiling_data.h b/cc/base/tiling_data.h
index a2e0a136967df3b4b2c77834adbfee08a2affdfa..08d421c47fe270c85a72602cf4ad156a9ac2bb3d 100644
--- a/cc/base/tiling_data.h
+++ b/cc/base/tiling_data.h
@@ -182,6 +182,66 @@ class CC_EXPORT TilingData {
int vertical_step_count_;
};
+ class CC_EXPORT ReverseSpiralDifferenceIterator : public BaseIterator {
+ public:
+ ReverseSpiralDifferenceIterator();
+ ReverseSpiralDifferenceIterator(const TilingData* tiling_data,
+ const gfx::Rect& consider_rect,
+ const gfx::Rect& ignore_rect,
+ const gfx::Rect& center_rect);
+ ReverseSpiralDifferenceIterator& operator++();
+
+ private:
+ bool in_consider_rect() const {
+ return index_x_ >= consider_left_ && index_x_ <= consider_right_ &&
+ index_y_ >= consider_top_ && index_y_ <= consider_bottom_;
+ }
+ bool in_around_rect() const {
+ return index_x_ >= around_left_ && index_x_ <= around_right_ &&
+ index_y_ >= around_top_ && index_y_ <= around_bottom_;
+ }
+ bool in_ignore_rect() const {
+ return index_x_ >= ignore_left_ && index_x_ <= ignore_right_ &&
+ index_y_ >= ignore_top_ && index_y_ <= ignore_bottom_;
+ }
+ bool valid_column() const {
+ return index_x_ >= consider_left_ && index_x_ <= consider_right_;
+ }
+ bool valid_row() const {
+ return index_y_ >= consider_top_ && index_y_ <= consider_bottom_;
+ }
+
+ int current_step_count() const {
+ return (direction_ == UP || direction_ == DOWN) ? vertical_step_count_
+ : horizontal_step_count_;
+ }
+
+ bool needs_direction_switch() const;
+ void switch_direction();
+
+ int consider_left_;
+ int consider_top_;
+ int consider_right_;
+ int consider_bottom_;
+ int around_left_;
+ int around_top_;
+ int around_right_;
+ 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
+ int ignore_left_;
+ int ignore_top_;
+ int ignore_right_;
+ int ignore_bottom_;
+
+ enum Direction { LEFT, UP, RIGHT, DOWN };
+
+ Direction direction_;
+ int delta_x_;
+ int delta_y_;
+ int current_step_;
+ int horizontal_step_count_;
+ int vertical_step_count_;
+ };
+
private:
void AssertTile(int i, int j) const {
DCHECK_GE(i, 0);
« 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