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 <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 WhichTree tree, | 68 WhichTree tree, |
69 float contents_scale, | 69 float contents_scale, |
70 scoped_refptr<RasterSource> raster_source, | 70 scoped_refptr<RasterSource> raster_source, |
71 PictureLayerTilingClient* client, | 71 PictureLayerTilingClient* client, |
72 size_t max_tiles_for_interest_area, | 72 size_t max_tiles_for_interest_area, |
73 float skewport_target_time_in_seconds, | 73 float skewport_target_time_in_seconds, |
74 int skewport_extrapolation_limit_in_content_pixels); | 74 int skewport_extrapolation_limit_in_content_pixels); |
75 | 75 |
76 void SetRasterSourceAndResize(scoped_refptr<RasterSource> raster_source); | 76 void SetRasterSourceAndResize(scoped_refptr<RasterSource> raster_source); |
77 void Invalidate(const Region& layer_invalidation); | 77 void Invalidate(const Region& layer_invalidation); |
78 void SetRasterSourceOnTiles(); | |
79 void CreateMissingTilesInLiveTilesRect(); | 78 void CreateMissingTilesInLiveTilesRect(); |
80 void TakeTilesAndPropertiesFrom(PictureLayerTiling* pending_twin, | 79 void TakeTilesAndPropertiesFrom(PictureLayerTiling* pending_twin, |
81 const Region& layer_invalidation); | 80 const Region& layer_invalidation); |
82 | 81 |
83 bool IsTileRequiredForActivation(const Tile* tile) const; | 82 bool IsTileRequiredForActivation(const Tile* tile) const; |
84 bool IsTileRequiredForDraw(const Tile* tile) const; | 83 bool IsTileRequiredForDraw(const Tile* tile) const; |
85 | 84 |
86 void set_resolution(TileResolution resolution) { resolution_ = resolution; } | 85 void set_resolution(TileResolution resolution) { resolution_ = resolution; } |
87 TileResolution resolution() const { return resolution_; } | 86 TileResolution resolution() const { return resolution_; } |
88 void set_can_require_tiles_for_activation(bool can_require_tiles) { | 87 void set_can_require_tiles_for_activation(bool can_require_tiles) { |
(...skipping 24 matching lines...) Expand all Loading... |
113 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) | 112 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) |
114 all_tiles.push_back(it->second); | 113 all_tiles.push_back(it->second); |
115 return all_tiles; | 114 return all_tiles; |
116 } | 115 } |
117 | 116 |
118 void UpdateAllRequiredStateForTesting() { | 117 void UpdateAllRequiredStateForTesting() { |
119 for (const auto& key_tile_pair : tiles_) | 118 for (const auto& key_tile_pair : tiles_) |
120 UpdateRequiredStatesOnTile(key_tile_pair.second); | 119 UpdateRequiredStatesOnTile(key_tile_pair.second); |
121 } | 120 } |
122 std::map<const Tile*, PrioritizedTile> | 121 std::map<const Tile*, PrioritizedTile> |
123 UpdateAndGetAllPrioritizedTilesForTesting(); | 122 UpdateAndGetAllPrioritizedTilesForTesting() const; |
124 | 123 |
125 void SetAllTilesOccludedForTesting() { | 124 void SetAllTilesOccludedForTesting() { |
126 gfx::Rect viewport_in_layer_space = | 125 gfx::Rect viewport_in_layer_space = |
127 ScaleToEnclosingRect(current_visible_rect_, 1.0f / contents_scale_); | 126 ScaleToEnclosingRect(current_visible_rect_, 1.0f / contents_scale_); |
128 current_occlusion_in_layer_space_ = | 127 current_occlusion_in_layer_space_ = |
129 Occlusion(gfx::Transform(), | 128 Occlusion(gfx::Transform(), |
130 SimpleEnclosedRegion(viewport_in_layer_space), | 129 SimpleEnclosedRegion(viewport_in_layer_space), |
131 SimpleEnclosedRegion(viewport_in_layer_space)); | 130 SimpleEnclosedRegion(viewport_in_layer_space)); |
132 } | 131 } |
133 const gfx::Rect& GetCurrentVisibleRectForTesting() const { | 132 const gfx::Rect& GetCurrentVisibleRectForTesting() const { |
134 return current_visible_rect_; | 133 return current_visible_rect_; |
135 } | 134 } |
136 | 135 |
137 void VerifyAllTilesHaveCurrentRasterSource() const; | |
138 | |
139 // Iterate over all tiles to fill content_rect. Even if tiles are invalid | 136 // Iterate over all tiles to fill content_rect. Even if tiles are invalid |
140 // (i.e. no valid resource) this tiling should still iterate over them. | 137 // (i.e. no valid resource) this tiling should still iterate over them. |
141 // The union of all geometry_rect calls for each element iterated over should | 138 // The union of all geometry_rect calls for each element iterated over should |
142 // exactly equal content_rect and no two geometry_rects should intersect. | 139 // exactly equal content_rect and no two geometry_rects should intersect. |
143 class CC_EXPORT CoverageIterator { | 140 class CC_EXPORT CoverageIterator { |
144 public: | 141 public: |
145 CoverageIterator(); | 142 CoverageIterator(); |
146 CoverageIterator(const PictureLayerTiling* tiling, | 143 CoverageIterator(const PictureLayerTiling* tiling, |
147 float dest_scale, | 144 float dest_scale, |
148 const gfx::Rect& rect); | 145 const gfx::Rect& rect); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 friend class PictureLayerTiling; | 177 friend class PictureLayerTiling; |
181 }; | 178 }; |
182 | 179 |
183 void Reset(); | 180 void Reset(); |
184 | 181 |
185 bool ComputeTilePriorityRects(const gfx::Rect& viewport_in_layer_space, | 182 bool ComputeTilePriorityRects(const gfx::Rect& viewport_in_layer_space, |
186 float ideal_contents_scale, | 183 float ideal_contents_scale, |
187 double current_frame_time_in_seconds, | 184 double current_frame_time_in_seconds, |
188 const Occlusion& occlusion_in_layer_space); | 185 const Occlusion& occlusion_in_layer_space); |
189 | 186 |
190 void GetAllTilesAndPrioritiesForTracing( | 187 void GetAllPrioritizedTilesForTracing( |
191 std::map<const Tile*, TilePriority>* tile_map) const; | 188 std::vector<PrioritizedTile>* prioritized_tiles) const; |
192 void AsValueInto(base::trace_event::TracedValue* array) const; | 189 void AsValueInto(base::trace_event::TracedValue* array) const; |
193 size_t GPUMemoryUsageInBytes() const; | 190 size_t GPUMemoryUsageInBytes() const; |
194 | 191 |
195 struct RectExpansionCache { | 192 struct RectExpansionCache { |
196 RectExpansionCache(); | 193 RectExpansionCache(); |
197 | 194 |
198 gfx::Rect previous_start; | 195 gfx::Rect previous_start; |
199 gfx::Rect previous_bounds; | 196 gfx::Rect previous_bounds; |
200 gfx::Rect previous_result; | 197 gfx::Rect previous_result; |
201 int64 previous_target; | 198 int64 previous_target; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 | 344 |
348 private: | 345 private: |
349 DISALLOW_ASSIGN(PictureLayerTiling); | 346 DISALLOW_ASSIGN(PictureLayerTiling); |
350 | 347 |
351 RectExpansionCache expansion_cache_; | 348 RectExpansionCache expansion_cache_; |
352 }; | 349 }; |
353 | 350 |
354 } // namespace cc | 351 } // namespace cc |
355 | 352 |
356 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 353 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
OLD | NEW |