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

Unified Diff: cc/base/tiling_data.h

Issue 2067213002: cc: Implement tile iteration order based on pyramid sequence. [old] Base URL: https://chromium.googlesource.com/chromium/src.git@tiling_data_fix
Patch Set: tild Created 4 years, 6 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
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

Powered by Google App Engine
This is Rietveld 408576698