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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 TilePriority::PriorityBin tile_type; | 61 TilePriority::PriorityBin tile_type; |
62 }; | 62 }; |
63 | 63 |
64 size_t current_stage_; | 64 size_t current_stage_; |
65 | 65 |
66 // One low res stage, and three high res stages. | 66 // One low res stage, and three high res stages. |
67 IterationStage stages_[4]; | 67 IterationStage stages_[4]; |
68 PictureLayerTiling::TilingRasterTileIterator iterators_[NUM_ITERATORS]; | 68 PictureLayerTiling::TilingRasterTileIterator iterators_[NUM_ITERATORS]; |
69 }; | 69 }; |
70 | 70 |
71 static scoped_ptr<PictureLayerImpl> Create(LayerTreeImpl* tree_impl, int id) { | 71 static scoped_ptr<PictureLayerImpl> Create(LayerTreeImpl* tree_impl, |
72 return make_scoped_ptr(new PictureLayerImpl(tree_impl, id)); | 72 int id, |
| 73 bool is_mask) { |
| 74 return make_scoped_ptr(new PictureLayerImpl(tree_impl, id, is_mask)); |
73 } | 75 } |
74 ~PictureLayerImpl() override; | 76 ~PictureLayerImpl() override; |
75 | 77 |
76 scoped_ptr<TilingSetEvictionQueue> CreateEvictionQueue( | 78 scoped_ptr<TilingSetEvictionQueue> CreateEvictionQueue( |
77 TreePriority tree_priority); | 79 TreePriority tree_priority); |
78 | 80 |
79 // LayerImpl overrides. | 81 // LayerImpl overrides. |
80 const char* LayerTypeAsString() const override; | 82 const char* LayerTypeAsString() const override; |
81 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 83 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
82 void PushPropertiesTo(LayerImpl* layer) override; | 84 void PushPropertiesTo(LayerImpl* layer) override; |
(...skipping 23 matching lines...) Expand all Loading... |
106 int GetSkewportExtrapolationLimitInContentPixels() const override; | 108 int GetSkewportExtrapolationLimitInContentPixels() const override; |
107 WhichTree GetTree() const override; | 109 WhichTree GetTree() const override; |
108 bool RequiresHighResToDraw() const override; | 110 bool RequiresHighResToDraw() const override; |
109 | 111 |
110 // PushPropertiesTo active tree => pending tree. | 112 // PushPropertiesTo active tree => pending tree. |
111 void SyncTiling(const PictureLayerTiling* tiling); | 113 void SyncTiling(const PictureLayerTiling* tiling); |
112 | 114 |
113 // Mask-related functions. | 115 // Mask-related functions. |
114 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, | 116 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, |
115 gfx::Size* resource_size) const override; | 117 gfx::Size* resource_size) const override; |
116 void set_is_mask(bool is_mask) { is_mask_ = is_mask; } | |
117 | 118 |
118 size_t GPUMemoryUsageInBytes() const override; | 119 size_t GPUMemoryUsageInBytes() const override; |
119 | 120 |
120 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; | 121 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; |
121 | 122 |
122 bool CanHaveTilings() const; | 123 bool CanHaveTilings() const; |
123 | 124 |
124 // Functions used by tile manager. | 125 // Functions used by tile manager. |
125 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; | 126 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; |
126 bool IsOnActiveOrPendingTree() const; | 127 bool IsOnActiveOrPendingTree() const; |
127 // Virtual for testing. | 128 // Virtual for testing. |
128 virtual bool HasValidTilePriorities() const; | 129 virtual bool HasValidTilePriorities() const; |
129 bool AllTilesRequiredForActivationAreReadyToDraw() const; | 130 bool AllTilesRequiredForActivationAreReadyToDraw() const; |
130 bool AllTilesRequiredForDrawAreReadyToDraw() const; | 131 bool AllTilesRequiredForDrawAreReadyToDraw() const; |
131 | 132 |
132 // Used for benchmarking | 133 // Used for benchmarking |
133 const RasterSource* GetRasterSource() const { return raster_source_.get(); } | 134 const RasterSource* GetRasterSource() const { return raster_source_.get(); } |
134 | 135 |
135 protected: | 136 protected: |
136 friend class LayerRasterTileIterator; | 137 friend class LayerRasterTileIterator; |
137 using TileRequirementCheck = bool (PictureLayerTiling::*)(const Tile*) const; | 138 using TileRequirementCheck = bool (PictureLayerTiling::*)(const Tile*) const; |
138 | 139 |
139 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); | 140 PictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask); |
140 PictureLayerTiling* AddTiling(float contents_scale); | 141 PictureLayerTiling* AddTiling(float contents_scale); |
141 void RemoveAllTilings(); | 142 void RemoveAllTilings(); |
142 void SyncFromActiveLayer(const PictureLayerImpl* other); | |
143 void AddTilingsForRasterScale(); | 143 void AddTilingsForRasterScale(); |
144 void UpdateTilePriorities(const Occlusion& occlusion_in_content_space); | 144 void UpdateTilePriorities(const Occlusion& occlusion_in_content_space); |
145 virtual bool ShouldAdjustRasterScale() const; | 145 virtual bool ShouldAdjustRasterScale() const; |
146 virtual void RecalculateRasterScales(); | 146 virtual void RecalculateRasterScales(); |
147 void CleanUpTilingsOnActiveLayer( | 147 void CleanUpTilingsOnActiveLayer( |
148 std::vector<PictureLayerTiling*> used_tilings); | 148 std::vector<PictureLayerTiling*> used_tilings); |
149 float MinimumContentsScale() const; | 149 float MinimumContentsScale() const; |
150 void ResetRasterScale(); | 150 void ResetRasterScale(); |
151 gfx::Rect GetViewportForTilePriorityInContentSpace() const; | 151 gfx::Rect GetViewportForTilePriorityInContentSpace() const; |
152 PictureLayerImpl* GetRecycledTwinLayer() const; | 152 PictureLayerImpl* GetRecycledTwinLayer() const; |
153 void UpdateRasterSource(scoped_refptr<RasterSource> raster_source); | 153 void UpdateRasterSource(scoped_refptr<RasterSource> raster_source, |
| 154 Region* new_invalidation, |
| 155 const PictureLayerTilingSet* pending_set); |
154 | 156 |
155 void DoPostCommitInitializationIfNeeded() { | 157 void DoPostCommitInitializationIfNeeded() { |
156 if (needs_post_commit_initialization_) | 158 if (needs_post_commit_initialization_) |
157 DoPostCommitInitialization(); | 159 DoPostCommitInitialization(); |
158 } | 160 } |
159 void DoPostCommitInitialization(); | 161 void DoPostCommitInitialization(); |
160 | 162 |
161 bool CanHaveTilingWithScale(float contents_scale) const; | 163 bool CanHaveTilingWithScale(float contents_scale) const; |
162 void SanityCheckTilingState() const; | 164 void SanityCheckTilingState() const; |
163 // Checks if all tiles required for a certain action (e.g. activation) are | 165 // Checks if all tiles required for a certain action (e.g. activation) are |
(...skipping 28 matching lines...) Expand all Loading... |
192 float raster_contents_scale_; | 194 float raster_contents_scale_; |
193 float low_res_raster_contents_scale_; | 195 float low_res_raster_contents_scale_; |
194 | 196 |
195 bool raster_source_scale_is_fixed_; | 197 bool raster_source_scale_is_fixed_; |
196 bool was_screen_space_transform_animating_; | 198 bool was_screen_space_transform_animating_; |
197 bool needs_post_commit_initialization_; | 199 bool needs_post_commit_initialization_; |
198 // A sanity state check to make sure UpdateTilePriorities only gets called | 200 // A sanity state check to make sure UpdateTilePriorities only gets called |
199 // after a CalculateContentsScale/ManageTilings. | 201 // after a CalculateContentsScale/ManageTilings. |
200 bool should_update_tile_priorities_; | 202 bool should_update_tile_priorities_; |
201 bool only_used_low_res_last_append_quads_; | 203 bool only_used_low_res_last_append_quads_; |
202 bool is_mask_; | 204 const bool is_mask_; |
203 | 205 |
204 // Any draw properties derived from |transform|, |viewport|, and |clip| | 206 // Any draw properties derived from |transform|, |viewport|, and |clip| |
205 // parameters in LayerTreeHostImpl::SetExternalDrawConstraints are not valid | 207 // parameters in LayerTreeHostImpl::SetExternalDrawConstraints are not valid |
206 // for prioritizing tiles during resourceless software draws. This is because | 208 // for prioritizing tiles during resourceless software draws. This is because |
207 // resourceless software draws can have wildly different transforms/viewports | 209 // resourceless software draws can have wildly different transforms/viewports |
208 // from regular draws. Save a copy of the required draw properties of the last | 210 // from regular draws. Save a copy of the required draw properties of the last |
209 // frame that has a valid viewport for prioritizing tiles. | 211 // frame that has a valid viewport for prioritizing tiles. |
210 gfx::Rect visible_rect_for_tile_priority_; | 212 gfx::Rect visible_rect_for_tile_priority_; |
211 | 213 |
212 friend class PictureLayer; | 214 friend class PictureLayer; |
213 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 215 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
214 }; | 216 }; |
215 | 217 |
216 } // namespace cc | 218 } // namespace cc |
217 | 219 |
218 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 220 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |