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

Unified Diff: cc/base/tiling_data.h

Issue 2352393002: cc: Detach spiral iterator implementation to separate file. (Closed)
Patch Set: review comments Created 4 years, 3 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 184f94705d7d968641dc94c19ac8ffb058b5b6c7..590049ebcbf73e89a1a395518307d8a137141e84 100644
--- a/cc/base/tiling_data.h
+++ b/cc/base/tiling_data.h
@@ -10,6 +10,8 @@
#include "base/logging.h"
#include "cc/base/cc_export.h"
#include "cc/base/index_rect.h"
+#include "cc/base/reverse_spiral_iterator.h"
+#include "cc/base/spiral_iterator.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
@@ -51,6 +53,8 @@ class CC_EXPORT TilingData {
// Return the highest tile index whose border texels include src_position.
int LastBorderTileXIndexFromSrcCoord(int src_position) const;
int LastBorderTileYIndexFromSrcCoord(int src_position) const;
+ // Return the tile indices around the given rect.
+ IndexRect TileAroundIndexRect(const gfx::Rect& center_rect) const;
gfx::Rect ExpandRectIgnoringBordersToTileBounds(const gfx::Rect& rect) const;
gfx::Rect ExpandRectToTileBounds(const gfx::Rect& rect) const;
@@ -136,22 +140,7 @@ class CC_EXPORT TilingData {
SpiralDifferenceIterator& operator++();
private:
- int current_step_count() const {
- return (direction_ == UP || direction_ == DOWN) ? vertical_step_count_
- : horizontal_step_count_;
- }
-
- bool needs_direction_switch() const;
- void switch_direction();
-
- enum Direction { UP, LEFT, DOWN, RIGHT };
-
- Direction direction_;
- int delta_x_;
- int delta_y_;
- int current_step_;
- int horizontal_step_count_;
- int vertical_step_count_;
+ SpiralIterator spiral_iterator_;
};
class CC_EXPORT ReverseSpiralDifferenceIterator
@@ -165,24 +154,7 @@ class CC_EXPORT TilingData {
ReverseSpiralDifferenceIterator& operator++();
private:
- int current_step_count() const {
- return (direction_ == UP || direction_ == DOWN) ? vertical_step_count_
- : horizontal_step_count_;
- }
-
- bool needs_direction_switch() const;
- void switch_direction();
-
- IndexRect around_index_rect_;
-
- 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_;
+ ReverseSpiralIterator reverse_spiral_iterator_;
};
private:

Powered by Google App Engine
This is Rietveld 408576698