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 | |
151 protected: | 143 protected: |
152 friend class LayerRasterTileIterator; | 144 friend class LayerRasterTileIterator; |
153 | 145 |
154 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); | 146 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); |
155 PictureLayerTiling* AddTiling(float contents_scale); | 147 PictureLayerTiling* AddTiling(float contents_scale); |
156 void RemoveTiling(float contents_scale); | 148 void RemoveTiling(float contents_scale); |
157 void RemoveAllTilings(); | 149 void RemoveAllTilings(); |
158 void SyncFromActiveLayer(const PictureLayerImpl* other); | 150 void SyncFromActiveLayer(const PictureLayerImpl* other); |
159 void ManageTilings(bool animating_transform_to_screen, | 151 void ManageTilings(bool animating_transform_to_screen, |
160 float maximum_animation_contents_scale); | 152 float maximum_animation_contents_scale); |
161 bool ShouldHaveLowResTiling() const { | 153 bool ShouldHaveLowResTiling() const { |
162 return should_use_low_res_tiling_ && !ShouldUseGpuRasterization(); | 154 return should_use_low_res_tiling_ && !ShouldUseGpuRasterization(); |
163 } | 155 } |
164 virtual bool ShouldAdjustRasterScale( | 156 virtual bool ShouldAdjustRasterScale( |
165 bool animating_transform_to_screen) const; | 157 bool animating_transform_to_screen) const; |
166 virtual void RecalculateRasterScales(bool animating_transform_to_screen, | 158 virtual void RecalculateRasterScales(bool animating_transform_to_screen, |
167 float maximum_animation_contents_scale); | 159 float maximum_animation_contents_scale); |
168 void CleanUpTilingsOnActiveLayer( | 160 void CleanUpTilingsOnActiveLayer( |
169 std::vector<PictureLayerTiling*> used_tilings); | 161 std::vector<PictureLayerTiling*> used_tilings); |
170 float MinimumContentsScale() const; | 162 float MinimumContentsScale() const; |
171 float SnappedContentsScale(float new_contents_scale); | 163 float SnappedContentsScale(float new_contents_scale); |
172 void UpdateLCDTextStatus(bool new_status); | 164 void UpdateLCDTextStatus(bool new_status); |
173 void ResetRasterScale(); | 165 void ResetRasterScale(); |
174 void MarkVisibleResourcesAsRequired(); | 166 void MarkVisibleResourcesAsRequired() const; |
175 bool MarkVisibleTilesAsRequired( | 167 bool MarkVisibleTilesAsRequired( |
176 PictureLayerTiling* tiling, | 168 PictureLayerTiling* tiling, |
177 const PictureLayerTiling* optional_twin_tiling, | 169 const PictureLayerTiling* optional_twin_tiling, |
178 float contents_scale, | 170 float contents_scale, |
179 const gfx::Rect& rect, | 171 const gfx::Rect& rect, |
180 const Region& missing_region); | 172 const Region& missing_region) const; |
181 | 173 |
182 void DoPostCommitInitializationIfNeeded() { | 174 void DoPostCommitInitializationIfNeeded() { |
183 if (needs_post_commit_initialization_) | 175 if (needs_post_commit_initialization_) |
184 DoPostCommitInitialization(); | 176 DoPostCommitInitialization(); |
185 } | 177 } |
186 void DoPostCommitInitialization(); | 178 void DoPostCommitInitialization(); |
187 | 179 |
188 bool CanHaveTilings() const; | 180 bool CanHaveTilings() const; |
189 bool CanHaveTilingWithScale(float contents_scale) const; | 181 bool CanHaveTilingWithScale(float contents_scale) const; |
190 void SanityCheckTilingState() const; | 182 void SanityCheckTilingState() const; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 bool use_gpu_rasterization_; | 214 bool use_gpu_rasterization_; |
223 | 215 |
224 bool layer_needs_to_register_itself_; | 216 bool layer_needs_to_register_itself_; |
225 | 217 |
226 // Save a copy of the visible rect and viewport size of the last frame that | 218 // Save a copy of the visible rect and viewport size of the last frame that |
227 // has a valid viewport for prioritizing tiles. | 219 // has a valid viewport for prioritizing tiles. |
228 gfx::Rect visible_rect_for_tile_priority_; | 220 gfx::Rect visible_rect_for_tile_priority_; |
229 gfx::Size viewport_size_for_tile_priority_; | 221 gfx::Size viewport_size_for_tile_priority_; |
230 gfx::Transform screen_space_transform_for_tile_priority_; | 222 gfx::Transform screen_space_transform_for_tile_priority_; |
231 | 223 |
232 int uninitialized_tiles_required_for_activation_count_; | |
233 | |
234 friend class PictureLayer; | 224 friend class PictureLayer; |
235 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 225 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
236 }; | 226 }; |
237 | 227 |
238 } // namespace cc | 228 } // namespace cc |
239 | 229 |
240 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 230 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |