Index: cc/base/tiling_data.h |
diff --git a/cc/base/tiling_data.h b/cc/base/tiling_data.h |
index 2e392ce3e74da10b5778cfced59f3a50e60ce95d..9a05463e6bfeedb29ddc081a7a35c473f91437a7 100644 |
--- a/cc/base/tiling_data.h |
+++ b/cc/base/tiling_data.h |
@@ -5,10 +5,14 @@ |
#ifndef CC_BASE_TILING_DATA_H_ |
#define CC_BASE_TILING_DATA_H_ |
+#include <list> |
#include <utility> |
+#include <vector> |
#include "base/logging.h" |
+#include "base/memory/ptr_util.h" |
#include "cc/base/cc_export.h" |
+#include "cc/base/pyramid_sequence.h" |
#include "ui/gfx/geometry/rect.h" |
#include "ui/gfx/geometry/size.h" |
@@ -140,6 +144,38 @@ class CC_EXPORT TilingData { |
DifferenceIterator& operator++(); |
}; |
+ struct LevelDistance { |
+ int level; |
+ int distance; |
+ }; |
+ |
+ class LDSequence { |
vmpstr
2016/06/16 18:28:58
I prefer to not abberviate here
vmpstr
2016/06/16 18:28:58
Needs a comment
|
+ public: |
+ typedef std::list<LDSequence> List; |
+ |
+ LDSequence(PyramidSequence traversal_seq, |
vmpstr
2016/06/16 18:28:58
don't abbreviate seq
|
+ PyramidSequence level_seq, |
+ bool swapped, |
+ int distance); |
+ LDSequence(const LDSequence& other); |
+ ~LDSequence(); |
+ |
+ bool IsValid() const { return !level_distances_.empty(); } |
+ int GetIndexX() const; |
+ int GetIndexY() const; |
+ int GetTopDistance(); |
+ bool Advance(); |
+ |
+ private: |
+ void Reset(); |
+ |
+ PyramidSequence traversal_seq_; |
+ bool swapped_; |
+ int current_seq_index_; |
+ int current_level_index_; |
+ std::vector<LevelDistance> level_distances_; |
+ }; |
+ |
// Iterate through all indices whose bounds + border intersect with |
// |consider| but which also do not intersect with |ignore|. The iterator |
// order is a counterclockwise spiral around the given center. |
@@ -150,32 +186,22 @@ class CC_EXPORT TilingData { |
const gfx::Rect& consider_rect, |
const gfx::Rect& ignore_rect, |
const gfx::Rect& center_rect); |
+ ~SpiralDifferenceIterator(); |
SpiralDifferenceIterator& operator++(); |
- private: |
- 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 valid_column(int column) const { |
+ return column >= 0 && column <= num_tiles_x_; |
} |
- bool needs_direction_switch() const; |
- void switch_direction(); |
+ bool valid_row(int row) const { return row >= 0 && row <= num_tiles_y_; } |
- enum Direction { UP, LEFT, DOWN, RIGHT }; |
+ private: |
+ LDSequence::List::iterator GetNextLDSequence(); |
- Direction direction_; |
- int delta_x_; |
- int delta_y_; |
- int current_step_; |
- int horizontal_step_count_; |
- int vertical_step_count_; |
+ int num_tiles_x_; |
+ int num_tiles_y_; |
+ LDSequence::List ld_sequences_; |
+ LDSequence::List::iterator current_ld_seq; |
}; |
class CC_EXPORT ReverseSpiralDifferenceIterator |