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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 // Mask-related functions. | 138 // Mask-related functions. |
139 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, | 139 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, |
140 gfx::Size* resource_size) const override; | 140 gfx::Size* resource_size) const override; |
141 void set_is_mask(bool is_mask) { is_mask_ = is_mask; } | 141 void set_is_mask(bool is_mask) { is_mask_ = is_mask; } |
142 | 142 |
143 size_t GPUMemoryUsageInBytes() const override; | 143 size_t GPUMemoryUsageInBytes() const override; |
144 | 144 |
145 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; | 145 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; |
146 | 146 |
| 147 bool CanHaveTilings() const; |
| 148 |
147 // Functions used by tile manager. | 149 // Functions used by tile manager. |
148 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; | 150 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; |
149 bool IsOnActiveOrPendingTree() const; | 151 bool IsOnActiveOrPendingTree() const; |
150 // Virtual for testing. | 152 // Virtual for testing. |
151 virtual bool HasValidTilePriorities() const; | 153 virtual bool HasValidTilePriorities() const; |
152 bool AllTilesRequiredForActivationAreReadyToDraw() const; | 154 bool AllTilesRequiredForActivationAreReadyToDraw() const; |
153 bool AllTilesRequiredForDrawAreReadyToDraw() const; | 155 bool AllTilesRequiredForDrawAreReadyToDraw() const; |
154 | 156 |
155 protected: | 157 protected: |
156 friend class LayerRasterTileIterator; | 158 friend class LayerRasterTileIterator; |
157 using TileRequirementCheck = bool (PictureLayerTiling::*)(const Tile*) const; | 159 using TileRequirementCheck = bool (PictureLayerTiling::*)(const Tile*) const; |
158 | 160 |
159 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); | 161 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); |
160 PictureLayerTiling* AddTiling(float contents_scale); | 162 PictureLayerTiling* AddTiling(float contents_scale); |
161 void RemoveTiling(float contents_scale); | |
162 void RemoveAllTilings(); | 163 void RemoveAllTilings(); |
163 void SyncFromActiveLayer(const PictureLayerImpl* other); | 164 void SyncFromActiveLayer(const PictureLayerImpl* other); |
164 void AddTilingsForRasterScale(); | 165 void AddTilingsForRasterScale(); |
165 void UpdateTilePriorities(const Occlusion& occlusion_in_content_space); | 166 void UpdateTilePriorities(const Occlusion& occlusion_in_content_space); |
166 virtual bool ShouldAdjustRasterScale() const; | 167 virtual bool ShouldAdjustRasterScale() const; |
167 virtual void RecalculateRasterScales(); | 168 virtual void RecalculateRasterScales(); |
168 void CleanUpTilingsOnActiveLayer( | 169 void CleanUpTilingsOnActiveLayer( |
169 std::vector<PictureLayerTiling*> used_tilings); | 170 std::vector<PictureLayerTiling*> used_tilings); |
170 float MinimumContentsScale() const; | 171 float MinimumContentsScale() const; |
171 void ResetRasterScale(); | 172 void ResetRasterScale(); |
172 gfx::Rect GetViewportForTilePriorityInContentSpace() const; | 173 gfx::Rect GetViewportForTilePriorityInContentSpace() const; |
173 PictureLayerImpl* GetRecycledTwinLayer() const; | 174 PictureLayerImpl* GetRecycledTwinLayer() const; |
174 void UpdateRasterSource(scoped_refptr<RasterSource> raster_source); | 175 void UpdateRasterSource(scoped_refptr<RasterSource> raster_source); |
175 | 176 |
176 void DoPostCommitInitializationIfNeeded() { | 177 void DoPostCommitInitializationIfNeeded() { |
177 if (needs_post_commit_initialization_) | 178 if (needs_post_commit_initialization_) |
178 DoPostCommitInitialization(); | 179 DoPostCommitInitialization(); |
179 } | 180 } |
180 void DoPostCommitInitialization(); | 181 void DoPostCommitInitialization(); |
181 | 182 |
182 bool CanHaveTilings() const; | |
183 bool CanHaveTilingWithScale(float contents_scale) const; | 183 bool CanHaveTilingWithScale(float contents_scale) const; |
184 void SanityCheckTilingState() const; | 184 void SanityCheckTilingState() const; |
185 // Checks if all tiles required for a certain action (e.g. activation) are | 185 // Checks if all tiles required for a certain action (e.g. activation) are |
186 // ready to draw. is_tile_required_callback gets called on all candidate | 186 // ready to draw. is_tile_required_callback gets called on all candidate |
187 // tiles and returns true if the tile is required for the action. | 187 // tiles and returns true if the tile is required for the action. |
188 bool AllTilesRequiredAreReadyToDraw( | 188 bool AllTilesRequiredAreReadyToDraw( |
189 TileRequirementCheck is_tile_required_callback) const; | 189 TileRequirementCheck is_tile_required_callback) const; |
190 | 190 |
191 bool ShouldAdjustRasterScaleDuringScaleAnimations() const; | 191 bool ShouldAdjustRasterScaleDuringScaleAnimations() const; |
192 | 192 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // frame that has a valid viewport for prioritizing tiles. | 231 // frame that has a valid viewport for prioritizing tiles. |
232 gfx::Rect visible_rect_for_tile_priority_; | 232 gfx::Rect visible_rect_for_tile_priority_; |
233 | 233 |
234 friend class PictureLayer; | 234 friend class PictureLayer; |
235 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 235 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
236 }; | 236 }; |
237 | 237 |
238 } // namespace cc | 238 } // namespace cc |
239 | 239 |
240 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 240 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |