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 28 matching lines...) Expand all Loading... |
39 PictureLayerImpl* pending; | 39 PictureLayerImpl* pending; |
40 }; | 40 }; |
41 | 41 |
42 static scoped_ptr<PictureLayerImpl> Create(LayerTreeImpl* tree_impl, | 42 static scoped_ptr<PictureLayerImpl> Create(LayerTreeImpl* tree_impl, |
43 int id, | 43 int id, |
44 bool is_mask) { | 44 bool is_mask) { |
45 return make_scoped_ptr(new PictureLayerImpl(tree_impl, id, is_mask)); | 45 return make_scoped_ptr(new PictureLayerImpl(tree_impl, id, is_mask)); |
46 } | 46 } |
47 ~PictureLayerImpl() override; | 47 ~PictureLayerImpl() override; |
48 | 48 |
| 49 bool is_mask() const { return is_mask_; } |
| 50 |
49 scoped_ptr<TilingSetEvictionQueue> CreateEvictionQueue( | 51 scoped_ptr<TilingSetEvictionQueue> CreateEvictionQueue( |
50 TreePriority tree_priority); | 52 TreePriority tree_priority); |
51 scoped_ptr<TilingSetRasterQueue> CreateRasterQueue(bool prioritize_low_res); | 53 scoped_ptr<TilingSetRasterQueue> CreateRasterQueue(bool prioritize_low_res); |
52 | 54 |
53 // LayerImpl overrides. | 55 // LayerImpl overrides. |
54 const char* LayerTypeAsString() const override; | 56 const char* LayerTypeAsString() const override; |
55 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 57 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
56 void PushPropertiesTo(LayerImpl* layer) override; | 58 void PushPropertiesTo(LayerImpl* layer) override; |
57 void AppendQuads(RenderPass* render_pass, | 59 void AppendQuads(RenderPass* render_pass, |
58 const Occlusion& occlusion_in_content_space, | 60 const Occlusion& occlusion_in_content_space, |
(...skipping 12 matching lines...) Expand all Loading... |
71 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; | 73 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; |
72 const Region* GetPendingInvalidation() override; | 74 const Region* GetPendingInvalidation() override; |
73 const PictureLayerTiling* GetPendingOrActiveTwinTiling( | 75 const PictureLayerTiling* GetPendingOrActiveTwinTiling( |
74 const PictureLayerTiling* tiling) const override; | 76 const PictureLayerTiling* tiling) const override; |
75 PictureLayerTiling* GetRecycledTwinTiling( | 77 PictureLayerTiling* GetRecycledTwinTiling( |
76 const PictureLayerTiling* tiling) override; | 78 const PictureLayerTiling* tiling) override; |
77 TilePriority::PriorityBin GetMaxTilePriorityBin() const override; | 79 TilePriority::PriorityBin GetMaxTilePriorityBin() const override; |
78 WhichTree GetTree() const override; | 80 WhichTree GetTree() const override; |
79 bool RequiresHighResToDraw() const override; | 81 bool RequiresHighResToDraw() const override; |
80 | 82 |
81 // PushPropertiesTo active tree => pending tree. | 83 void UpdateRasterSource(scoped_refptr<RasterSource> raster_source, |
82 void SyncTiling(const PictureLayerTiling* tiling); | 84 Region* new_invalidation, |
| 85 const PictureLayerTilingSet* pending_set); |
83 | 86 |
84 // Mask-related functions. | 87 // Mask-related functions. |
85 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, | 88 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, |
86 gfx::Size* resource_size) const override; | 89 gfx::Size* resource_size) const override; |
87 | 90 |
88 void SetNearestNeighbor(bool nearest_neighbor); | 91 void SetNearestNeighbor(bool nearest_neighbor); |
89 | 92 |
90 size_t GPUMemoryUsageInBytes() const override; | 93 size_t GPUMemoryUsageInBytes() const override; |
91 | 94 |
92 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; | 95 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; |
(...skipping 21 matching lines...) Expand all Loading... |
114 void AddTilingsForRasterScale(); | 117 void AddTilingsForRasterScale(); |
115 void UpdateTilePriorities(const Occlusion& occlusion_in_content_space); | 118 void UpdateTilePriorities(const Occlusion& occlusion_in_content_space); |
116 virtual bool ShouldAdjustRasterScale() const; | 119 virtual bool ShouldAdjustRasterScale() const; |
117 virtual void RecalculateRasterScales(); | 120 virtual void RecalculateRasterScales(); |
118 void CleanUpTilingsOnActiveLayer( | 121 void CleanUpTilingsOnActiveLayer( |
119 std::vector<PictureLayerTiling*> used_tilings); | 122 std::vector<PictureLayerTiling*> used_tilings); |
120 float MinimumContentsScale() const; | 123 float MinimumContentsScale() const; |
121 void ResetRasterScale(); | 124 void ResetRasterScale(); |
122 gfx::Rect GetViewportForTilePriorityInContentSpace() const; | 125 gfx::Rect GetViewportForTilePriorityInContentSpace() const; |
123 PictureLayerImpl* GetRecycledTwinLayer() const; | 126 PictureLayerImpl* GetRecycledTwinLayer() const; |
124 void UpdateRasterSource(scoped_refptr<RasterSource> raster_source, | |
125 Region* new_invalidation, | |
126 const PictureLayerTilingSet* pending_set); | |
127 | |
128 void DoPostCommitInitializationIfNeeded() { | |
129 if (needs_post_commit_initialization_) | |
130 DoPostCommitInitialization(); | |
131 } | |
132 void DoPostCommitInitialization(); | |
133 | 127 |
134 bool CanHaveTilingWithScale(float contents_scale) const; | 128 bool CanHaveTilingWithScale(float contents_scale) const; |
135 void SanityCheckTilingState() const; | 129 void SanityCheckTilingState() const; |
136 // Checks if all tiles required for a certain action (e.g. activation) are | 130 // Checks if all tiles required for a certain action (e.g. activation) are |
137 // ready to draw. is_tile_required_callback gets called on all candidate | 131 // ready to draw. is_tile_required_callback gets called on all candidate |
138 // tiles and returns true if the tile is required for the action. | 132 // tiles and returns true if the tile is required for the action. |
139 bool AllTilesRequiredAreReadyToDraw( | 133 bool AllTilesRequiredAreReadyToDraw( |
140 TileRequirementCheck is_tile_required_callback) const; | 134 TileRequirementCheck is_tile_required_callback) const; |
141 | 135 |
142 bool ShouldAdjustRasterScaleDuringScaleAnimations() const; | 136 bool ShouldAdjustRasterScaleDuringScaleAnimations() const; |
(...skipping 18 matching lines...) Expand all Loading... |
161 float ideal_contents_scale_; | 155 float ideal_contents_scale_; |
162 | 156 |
163 float raster_page_scale_; | 157 float raster_page_scale_; |
164 float raster_device_scale_; | 158 float raster_device_scale_; |
165 float raster_source_scale_; | 159 float raster_source_scale_; |
166 float raster_contents_scale_; | 160 float raster_contents_scale_; |
167 float low_res_raster_contents_scale_; | 161 float low_res_raster_contents_scale_; |
168 | 162 |
169 bool raster_source_scale_is_fixed_; | 163 bool raster_source_scale_is_fixed_; |
170 bool was_screen_space_transform_animating_; | 164 bool was_screen_space_transform_animating_; |
171 bool needs_post_commit_initialization_; | |
172 // A sanity state check to make sure UpdateTilePriorities only gets called | 165 // A sanity state check to make sure UpdateTilePriorities only gets called |
173 // after a CalculateContentsScale/ManageTilings. | 166 // after a CalculateContentsScale/ManageTilings. |
174 bool should_update_tile_priorities_; | 167 bool should_update_tile_priorities_; |
175 bool only_used_low_res_last_append_quads_; | 168 bool only_used_low_res_last_append_quads_; |
176 const bool is_mask_; | 169 const bool is_mask_; |
177 | 170 |
178 bool nearest_neighbor_; | 171 bool nearest_neighbor_; |
179 | 172 |
180 // Any draw properties derived from |transform|, |viewport|, and |clip| | 173 // Any draw properties derived from |transform|, |viewport|, and |clip| |
181 // parameters in LayerTreeHostImpl::SetExternalDrawConstraints are not valid | 174 // parameters in LayerTreeHostImpl::SetExternalDrawConstraints are not valid |
182 // for prioritizing tiles during resourceless software draws. This is because | 175 // for prioritizing tiles during resourceless software draws. This is because |
183 // resourceless software draws can have wildly different transforms/viewports | 176 // resourceless software draws can have wildly different transforms/viewports |
184 // from regular draws. Save a copy of the required draw properties of the last | 177 // from regular draws. Save a copy of the required draw properties of the last |
185 // frame that has a valid viewport for prioritizing tiles. | 178 // frame that has a valid viewport for prioritizing tiles. |
186 gfx::Rect visible_rect_for_tile_priority_; | 179 gfx::Rect visible_rect_for_tile_priority_; |
187 | 180 |
188 friend class PictureLayer; | |
189 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 181 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
190 }; | 182 }; |
191 | 183 |
192 } // namespace cc | 184 } // namespace cc |
193 | 185 |
194 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 186 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |