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

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: spiral coverage sequence Created 4 years, 4 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 3c3937db81541378eb71cdae42ca419e07af0bf0..f0d85674c7cd8fc18a701117730ea045a7f1b75c 100644
--- a/cc/base/tiling_data.h
+++ b/cc/base/tiling_data.h
@@ -9,6 +9,7 @@
#include "base/logging.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"
@@ -50,6 +51,16 @@ 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 virtual tile index, assuming tiling size to be infinite in all
+ // quadrants.
+ int TileVirtualXIndexFromSrcCoord(int src_position) const;
+ int TileVirtualYIndexFromSrcCoord(int src_position) const;
+ // Return the virtual around tile indices around the given rect.
+ void TileVirtualAroundIndices(const gfx::Rect& center_rect,
+ int* around_left,
+ int* around_right,
+ int* around_top,
+ int* around_bottom) const;
gfx::Rect ExpandRectIgnoringBordersToTileBounds(const gfx::Rect& rect) const;
gfx::Rect ExpandRectToTileBounds(const gfx::Rect& rect) const;
@@ -148,32 +159,17 @@ class CC_EXPORT TilingData {
const gfx::Rect& consider_rect,
const gfx::Rect& ignore_rect,
const gfx::Rect& center_rect);
- 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_;
- }
+ SpiralDifferenceIterator(const SpiralDifferenceIterator& other);
+ SpiralDifferenceIterator(SpiralDifferenceIterator&& other);
+ ~SpiralDifferenceIterator();
- int current_step_count() const {
- return (direction_ == UP || direction_ == DOWN) ? vertical_step_count_
- : horizontal_step_count_;
- }
-
- bool needs_direction_switch() const;
- void switch_direction();
+ SpiralDifferenceIterator& operator=(const SpiralDifferenceIterator& other);
+ SpiralDifferenceIterator& operator=(SpiralDifferenceIterator&& other);
- enum Direction { UP, LEFT, DOWN, RIGHT };
+ SpiralDifferenceIterator& operator++();
- Direction direction_;
- int delta_x_;
- int delta_y_;
- int current_step_;
- int horizontal_step_count_;
- int vertical_step_count_;
+ private:
+ TopDownPyramidSequence pyramid_sequence_;
};
class CC_EXPORT ReverseSpiralDifferenceIterator
@@ -184,41 +180,20 @@ class CC_EXPORT TilingData {
const gfx::Rect& consider_rect,
const gfx::Rect& ignore_rect,
const gfx::Rect& center_rect);
- ReverseSpiralDifferenceIterator& operator++();
+ ReverseSpiralDifferenceIterator(
+ const ReverseSpiralDifferenceIterator& other);
+ ReverseSpiralDifferenceIterator(ReverseSpiralDifferenceIterator&& other);
+ ~ReverseSpiralDifferenceIterator();
- private:
- bool in_around_rect() const {
- return index_x_ >= around_left_ && index_x_ <= around_right_ &&
- index_y_ >= around_top_ && index_y_ <= around_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 around_left_;
- int around_top_;
- int around_right_;
- int around_bottom_;
+ ReverseSpiralDifferenceIterator& operator=(
+ const ReverseSpiralDifferenceIterator& other);
+ ReverseSpiralDifferenceIterator& operator=(
+ ReverseSpiralDifferenceIterator&& other);
- enum Direction { LEFT, UP, RIGHT, DOWN };
+ ReverseSpiralDifferenceIterator& operator++();
- Direction direction_;
- int delta_x_;
- int delta_y_;
- int current_step_;
- int horizontal_step_count_;
- int vertical_step_count_;
+ private:
+ BottomUpPyramidSequence pyramid_sequence_;
};
private:

Powered by Google App Engine
This is Rietveld 408576698