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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 virtual ~PictureLayerImpl(); | 85 virtual ~PictureLayerImpl(); |
86 | 86 |
87 // LayerImpl overrides. | 87 // LayerImpl overrides. |
88 virtual const char* LayerTypeAsString() const OVERRIDE; | 88 virtual const char* LayerTypeAsString() const OVERRIDE; |
89 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 89 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
90 OVERRIDE; | 90 OVERRIDE; |
91 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; | 91 virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; |
92 virtual void AppendQuads(QuadSink* quad_sink, | 92 virtual void AppendQuads(QuadSink* quad_sink, |
93 AppendQuadsData* append_quads_data) OVERRIDE; | 93 AppendQuadsData* append_quads_data) OVERRIDE; |
94 virtual void UpdateTilePriorities() OVERRIDE; | 94 virtual void UpdateTilePriorities() OVERRIDE; |
95 virtual void NotifyTileInitialized(const Tile* tile) OVERRIDE; | |
95 virtual void DidBecomeActive() OVERRIDE; | 96 virtual void DidBecomeActive() OVERRIDE; |
96 virtual void DidBeginTracing() OVERRIDE; | 97 virtual void DidBeginTracing() OVERRIDE; |
97 virtual void ReleaseResources() OVERRIDE; | 98 virtual void ReleaseResources() OVERRIDE; |
98 virtual void CalculateContentsScale(float ideal_contents_scale, | 99 virtual void CalculateContentsScale(float ideal_contents_scale, |
99 float device_scale_factor, | 100 float device_scale_factor, |
100 float page_scale_factor, | 101 float page_scale_factor, |
101 float maximum_animation_contents_scale, | 102 float maximum_animation_contents_scale, |
102 bool animating_transform_to_screen, | 103 bool animating_transform_to_screen, |
103 float* contents_scale_x, | 104 float* contents_scale_x, |
104 float* contents_scale_y, | 105 float* contents_scale_y, |
(...skipping 27 matching lines...) Expand all Loading... | |
132 | 133 |
133 void SetUseGpuRasterization(bool use_gpu); | 134 void SetUseGpuRasterization(bool use_gpu); |
134 bool ShouldUseGpuRasterization() const { return use_gpu_rasterization_; } | 135 bool ShouldUseGpuRasterization() const { return use_gpu_rasterization_; } |
135 | 136 |
136 // Functions used by tile manager. | 137 // Functions used by tile manager. |
137 void DidUnregisterLayer(); | 138 void DidUnregisterLayer(); |
138 PictureLayerImpl* GetTwinLayer() { return twin_layer_; } | 139 PictureLayerImpl* GetTwinLayer() { return twin_layer_; } |
139 WhichTree GetTree() const; | 140 WhichTree GetTree() const; |
140 bool IsOnActiveOrPendingTree() const; | 141 bool IsOnActiveOrPendingTree() const; |
141 | 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 rasterization (ie, it's not ready to draw). | |
147 size_t TilesRequiredForActivationThatNeedsRasterCount() const { | |
reveman
2014/04/25 22:23:59
Sorry, term "Initialized" or "ReadyToDraw" is prob
vmpstr
2014/04/25 23:16:15
Makes sense. Done.
| |
148 return required_for_activation_tile_needs_raster_count_; | |
149 } | |
150 | |
142 protected: | 151 protected: |
143 friend class LayerRasterTileIterator; | 152 friend class LayerRasterTileIterator; |
144 | 153 |
145 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); | 154 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); |
146 PictureLayerTiling* AddTiling(float contents_scale); | 155 PictureLayerTiling* AddTiling(float contents_scale); |
147 void RemoveTiling(float contents_scale); | 156 void RemoveTiling(float contents_scale); |
148 void RemoveAllTilings(); | 157 void RemoveAllTilings(); |
149 void SyncFromActiveLayer(const PictureLayerImpl* other); | 158 void SyncFromActiveLayer(const PictureLayerImpl* other); |
150 void ManageTilings(bool animating_transform_to_screen, | 159 void ManageTilings(bool animating_transform_to_screen, |
151 float maximum_animation_contents_scale); | 160 float maximum_animation_contents_scale); |
152 bool ShouldHaveLowResTiling() const { | 161 bool ShouldHaveLowResTiling() const { |
153 return should_use_low_res_tiling_ && !ShouldUseGpuRasterization(); | 162 return should_use_low_res_tiling_ && !ShouldUseGpuRasterization(); |
154 } | 163 } |
155 virtual bool ShouldAdjustRasterScale( | 164 virtual bool ShouldAdjustRasterScale( |
156 bool animating_transform_to_screen) const; | 165 bool animating_transform_to_screen) const; |
157 virtual void RecalculateRasterScales(bool animating_transform_to_screen, | 166 virtual void RecalculateRasterScales(bool animating_transform_to_screen, |
158 float maximum_animation_contents_scale); | 167 float maximum_animation_contents_scale); |
159 void CleanUpTilingsOnActiveLayer( | 168 void CleanUpTilingsOnActiveLayer( |
160 std::vector<PictureLayerTiling*> used_tilings); | 169 std::vector<PictureLayerTiling*> used_tilings); |
161 float MinimumContentsScale() const; | 170 float MinimumContentsScale() const; |
162 float SnappedContentsScale(float new_contents_scale); | 171 float SnappedContentsScale(float new_contents_scale); |
163 void UpdateLCDTextStatus(bool new_status); | 172 void UpdateLCDTextStatus(bool new_status); |
164 void ResetRasterScale(); | 173 void ResetRasterScale(); |
165 void MarkVisibleResourcesAsRequired() const; | 174 void MarkVisibleResourcesAsRequired(); |
166 bool MarkVisibleTilesAsRequired( | 175 bool MarkVisibleTilesAsRequired( |
167 PictureLayerTiling* tiling, | 176 PictureLayerTiling* tiling, |
168 const PictureLayerTiling* optional_twin_tiling, | 177 const PictureLayerTiling* optional_twin_tiling, |
169 float contents_scale, | 178 float contents_scale, |
170 const gfx::Rect& rect, | 179 const gfx::Rect& rect, |
171 const Region& missing_region) const; | 180 const Region& missing_region); |
172 | 181 |
173 void DoPostCommitInitializationIfNeeded() { | 182 void DoPostCommitInitializationIfNeeded() { |
174 if (needs_post_commit_initialization_) | 183 if (needs_post_commit_initialization_) |
175 DoPostCommitInitialization(); | 184 DoPostCommitInitialization(); |
176 } | 185 } |
177 void DoPostCommitInitialization(); | 186 void DoPostCommitInitialization(); |
178 | 187 |
179 bool CanHaveTilings() const; | 188 bool CanHaveTilings() const; |
180 bool CanHaveTilingWithScale(float contents_scale) const; | 189 bool CanHaveTilingWithScale(float contents_scale) const; |
181 void SanityCheckTilingState() const; | 190 void SanityCheckTilingState() const; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 bool use_gpu_rasterization_; | 222 bool use_gpu_rasterization_; |
214 | 223 |
215 bool layer_needs_to_register_itself_; | 224 bool layer_needs_to_register_itself_; |
216 | 225 |
217 // 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 |
218 // has a valid viewport for prioritizing tiles. | 227 // has a valid viewport for prioritizing tiles. |
219 gfx::Rect visible_rect_for_tile_priority_; | 228 gfx::Rect visible_rect_for_tile_priority_; |
220 gfx::Size viewport_size_for_tile_priority_; | 229 gfx::Size viewport_size_for_tile_priority_; |
221 gfx::Transform screen_space_transform_for_tile_priority_; | 230 gfx::Transform screen_space_transform_for_tile_priority_; |
222 | 231 |
232 size_t required_for_activation_tile_needs_raster_count_; | |
233 | |
223 friend class PictureLayer; | 234 friend class PictureLayer; |
224 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 235 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
225 }; | 236 }; |
226 | 237 |
227 } // namespace cc | 238 } // namespace cc |
228 | 239 |
229 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 240 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |