OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 5 #ifndef CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
6 #define CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 6 #define CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 public: | 50 public: |
51 class CC_EXPORT TilingRasterTileIterator { | 51 class CC_EXPORT TilingRasterTileIterator { |
52 public: | 52 public: |
53 TilingRasterTileIterator(); | 53 TilingRasterTileIterator(); |
54 TilingRasterTileIterator(PictureLayerTiling* tiling, WhichTree tree); | 54 TilingRasterTileIterator(PictureLayerTiling* tiling, WhichTree tree); |
55 ~TilingRasterTileIterator(); | 55 ~TilingRasterTileIterator(); |
56 | 56 |
57 operator bool() const { return !!current_tile_; } | 57 operator bool() const { return !!current_tile_; } |
58 const Tile* operator*() const { return current_tile_; } | 58 const Tile* operator*() const { return current_tile_; } |
59 Tile* operator*() { return current_tile_; } | 59 Tile* operator*() { return current_tile_; } |
60 TilePriority::PriorityBin get_type() const { return type_; } | 60 TilePriority::PriorityBin get_type() const { |
| 61 switch (phase_) { |
| 62 case VISIBLE_RECT: |
| 63 return TilePriority::NOW; |
| 64 case SKEWPORT_RECT: |
| 65 case SOON_BORDER_RECT: |
| 66 return TilePriority::SOON; |
| 67 case EVENTUALLY_RECT: |
| 68 return TilePriority::EVENTUALLY; |
| 69 } |
| 70 NOTREACHED(); |
| 71 return TilePriority::EVENTUALLY; |
| 72 } |
61 | 73 |
62 TilingRasterTileIterator& operator++(); | 74 TilingRasterTileIterator& operator++(); |
63 | 75 |
64 gfx::Rect TileBounds() const { | 76 gfx::Rect TileBounds() const { |
65 DCHECK(*this); | 77 DCHECK(*this); |
66 if (type_ == TilePriority::NOW) { | 78 if (phase_ == VISIBLE_RECT) { |
67 return tiling_->tiling_data_.TileBounds(visible_iterator_.index_x(), | 79 return tiling_->tiling_data_.TileBounds(visible_iterator_.index_x(), |
68 visible_iterator_.index_y()); | 80 visible_iterator_.index_y()); |
69 } | 81 } |
70 return tiling_->tiling_data_.TileBounds(spiral_iterator_.index_x(), | 82 return tiling_->tiling_data_.TileBounds(spiral_iterator_.index_x(), |
71 spiral_iterator_.index_y()); | 83 spiral_iterator_.index_y()); |
72 } | 84 } |
73 | 85 |
74 private: | 86 private: |
| 87 enum Phase { |
| 88 VISIBLE_RECT, |
| 89 SKEWPORT_RECT, |
| 90 SOON_BORDER_RECT, |
| 91 EVENTUALLY_RECT |
| 92 }; |
| 93 |
75 void AdvancePhase(); | 94 void AdvancePhase(); |
76 bool TileNeedsRaster(Tile* tile) const { | 95 bool TileNeedsRaster(Tile* tile) const { |
77 RasterMode mode = tile->DetermineRasterModeForTree(tree_); | 96 RasterMode mode = tile->DetermineRasterModeForTree(tree_); |
78 return tile->NeedsRasterForMode(mode); | 97 return tile->NeedsRasterForMode(mode); |
79 } | 98 } |
80 | 99 |
81 PictureLayerTiling* tiling_; | 100 PictureLayerTiling* tiling_; |
82 | 101 |
83 TilePriority::PriorityBin type_; | 102 Phase phase_; |
84 gfx::Rect visible_rect_in_content_space_; | 103 gfx::Rect visible_rect_in_content_space_; |
85 gfx::Rect skewport_in_content_space_; | 104 gfx::Rect skewport_in_content_space_; |
86 gfx::Rect eventually_rect_in_content_space_; | 105 gfx::Rect eventually_rect_in_content_space_; |
87 gfx::Rect soon_border_rect_in_content_space_; | 106 gfx::Rect soon_border_rect_in_content_space_; |
88 WhichTree tree_; | 107 WhichTree tree_; |
89 | 108 |
90 Tile* current_tile_; | 109 Tile* current_tile_; |
91 TilingData::Iterator visible_iterator_; | 110 TilingData::Iterator visible_iterator_; |
92 TilingData::SpiralDifferenceIterator spiral_iterator_; | 111 TilingData::SpiralDifferenceIterator spiral_iterator_; |
93 bool skewport_processed_; | |
94 }; | 112 }; |
95 | 113 |
96 class CC_EXPORT TilingEvictionTileIterator { | 114 class CC_EXPORT TilingEvictionTileIterator { |
97 public: | 115 public: |
98 TilingEvictionTileIterator(); | 116 TilingEvictionTileIterator(); |
99 TilingEvictionTileIterator(PictureLayerTiling* tiling, | 117 TilingEvictionTileIterator(PictureLayerTiling* tiling, |
100 TreePriority tree_priority); | 118 TreePriority tree_priority); |
101 ~TilingEvictionTileIterator(); | 119 ~TilingEvictionTileIterator(); |
102 | 120 |
103 operator bool() const; | 121 operator bool() const; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 330 |
313 private: | 331 private: |
314 DISALLOW_ASSIGN(PictureLayerTiling); | 332 DISALLOW_ASSIGN(PictureLayerTiling); |
315 | 333 |
316 RectExpansionCache expansion_cache_; | 334 RectExpansionCache expansion_cache_; |
317 }; | 335 }; |
318 | 336 |
319 } // namespace cc | 337 } // namespace cc |
320 | 338 |
321 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 339 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
OLD | NEW |