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_LAYERS_PICTURE_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
6 #define CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 6 #define CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 void SetUseGpuRasterization(bool use_gpu); | 134 void SetUseGpuRasterization(bool use_gpu); |
135 bool ShouldUseGpuRasterization() const { return use_gpu_rasterization_; } | 135 bool ShouldUseGpuRasterization() const { return use_gpu_rasterization_; } |
136 | 136 |
137 // Functions used by tile manager. | 137 // Functions used by tile manager. |
138 void DidUnregisterLayer(); | 138 void DidUnregisterLayer(); |
139 PictureLayerImpl* GetTwinLayer() { return twin_layer_; } | 139 PictureLayerImpl* GetTwinLayer() { return twin_layer_; } |
140 WhichTree GetTree() const; | 140 WhichTree GetTree() const; |
141 bool IsOnActiveOrPendingTree() const; | 141 bool IsOnActiveOrPendingTree() const; |
142 | 142 |
| 143 // Return the count of tiles on this layer that meet both of the following |
| 144 // conditions: |
| 145 // 1. The tile is required for activation. |
| 146 // 2. The tile needs initialization (ie, it's not ready to draw). |
| 147 int UninitializedTilesRequiredForActivationCount() const { |
| 148 return uninitialized_tiles_required_for_activation_count_; |
| 149 } |
| 150 |
143 protected: | 151 protected: |
144 friend class LayerRasterTileIterator; | 152 friend class LayerRasterTileIterator; |
145 | 153 |
146 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); | 154 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); |
147 PictureLayerTiling* AddTiling(float contents_scale); | 155 PictureLayerTiling* AddTiling(float contents_scale); |
148 void RemoveTiling(float contents_scale); | 156 void RemoveTiling(float contents_scale); |
149 void RemoveAllTilings(); | 157 void RemoveAllTilings(); |
150 void SyncFromActiveLayer(const PictureLayerImpl* other); | 158 void SyncFromActiveLayer(const PictureLayerImpl* other); |
151 void ManageTilings(bool animating_transform_to_screen, | 159 void ManageTilings(bool animating_transform_to_screen, |
152 float maximum_animation_contents_scale); | 160 float maximum_animation_contents_scale); |
153 bool ShouldHaveLowResTiling() const { | 161 bool ShouldHaveLowResTiling() const { |
154 return should_use_low_res_tiling_ && !ShouldUseGpuRasterization(); | 162 return should_use_low_res_tiling_ && !ShouldUseGpuRasterization(); |
155 } | 163 } |
156 virtual bool ShouldAdjustRasterScale( | 164 virtual bool ShouldAdjustRasterScale( |
157 bool animating_transform_to_screen) const; | 165 bool animating_transform_to_screen) const; |
158 virtual void RecalculateRasterScales(bool animating_transform_to_screen, | 166 virtual void RecalculateRasterScales(bool animating_transform_to_screen, |
159 float maximum_animation_contents_scale); | 167 float maximum_animation_contents_scale); |
160 void CleanUpTilingsOnActiveLayer( | 168 void CleanUpTilingsOnActiveLayer( |
161 std::vector<PictureLayerTiling*> used_tilings); | 169 std::vector<PictureLayerTiling*> used_tilings); |
162 float MinimumContentsScale() const; | 170 float MinimumContentsScale() const; |
163 float SnappedContentsScale(float new_contents_scale); | 171 float SnappedContentsScale(float new_contents_scale); |
164 void UpdateLCDTextStatus(bool new_status); | 172 void UpdateLCDTextStatus(bool new_status); |
165 void ResetRasterScale(); | 173 void ResetRasterScale(); |
166 void MarkVisibleResourcesAsRequired() const; | 174 void MarkVisibleResourcesAsRequired(); |
167 bool MarkVisibleTilesAsRequired( | 175 bool MarkVisibleTilesAsRequired( |
168 PictureLayerTiling* tiling, | 176 PictureLayerTiling* tiling, |
169 const PictureLayerTiling* optional_twin_tiling, | 177 const PictureLayerTiling* optional_twin_tiling, |
170 float contents_scale, | 178 float contents_scale, |
171 const gfx::Rect& rect, | 179 const gfx::Rect& rect, |
172 const Region& missing_region) const; | 180 const Region& missing_region); |
173 | 181 |
174 void DoPostCommitInitializationIfNeeded() { | 182 void DoPostCommitInitializationIfNeeded() { |
175 if (needs_post_commit_initialization_) | 183 if (needs_post_commit_initialization_) |
176 DoPostCommitInitialization(); | 184 DoPostCommitInitialization(); |
177 } | 185 } |
178 void DoPostCommitInitialization(); | 186 void DoPostCommitInitialization(); |
179 | 187 |
180 bool CanHaveTilings() const; | 188 bool CanHaveTilings() const; |
181 bool CanHaveTilingWithScale(float contents_scale) const; | 189 bool CanHaveTilingWithScale(float contents_scale) const; |
182 void SanityCheckTilingState() const; | 190 void SanityCheckTilingState() const; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 bool use_gpu_rasterization_; | 222 bool use_gpu_rasterization_; |
215 | 223 |
216 bool layer_needs_to_register_itself_; | 224 bool layer_needs_to_register_itself_; |
217 | 225 |
218 // Save a copy of the visible rect and viewport size of the last frame that | 226 // Save a copy of the visible rect and viewport size of the last frame that |
219 // has a valid viewport for prioritizing tiles. | 227 // has a valid viewport for prioritizing tiles. |
220 gfx::Rect visible_rect_for_tile_priority_; | 228 gfx::Rect visible_rect_for_tile_priority_; |
221 gfx::Size viewport_size_for_tile_priority_; | 229 gfx::Size viewport_size_for_tile_priority_; |
222 gfx::Transform screen_space_transform_for_tile_priority_; | 230 gfx::Transform screen_space_transform_for_tile_priority_; |
223 | 231 |
| 232 int uninitialized_tiles_required_for_activation_count_; |
| 233 |
224 friend class PictureLayer; | 234 friend class PictureLayer; |
225 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 235 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
226 }; | 236 }; |
227 | 237 |
228 } // namespace cc | 238 } // namespace cc |
229 | 239 |
230 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 240 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |