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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 void SyncTiling(const PictureLayerTiling* tiling); | 124 void SyncTiling(const PictureLayerTiling* tiling); |
125 | 125 |
126 // Mask-related functions | 126 // Mask-related functions |
127 void SetIsMask(bool is_mask); | 127 void SetIsMask(bool is_mask); |
128 virtual ResourceProvider::ResourceId ContentsResourceId() const OVERRIDE; | 128 virtual ResourceProvider::ResourceId ContentsResourceId() const OVERRIDE; |
129 | 129 |
130 virtual size_t GPUMemoryUsageInBytes() const OVERRIDE; | 130 virtual size_t GPUMemoryUsageInBytes() const OVERRIDE; |
131 | 131 |
132 virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) OVERRIDE; | 132 virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) OVERRIDE; |
133 | 133 |
134 void SetUseGpuRasterization(bool use_gpu); | 134 bool UseGpuRasterization() const; |
reveman
2014/05/08 21:51:30
should we just get rid of this completely and use
alokp
2014/05/08 22:44:41
I will prefer to keep this convenience function fo
reveman
2014/05/08 23:08:33
Ok in that case, could it be inlined and named use
alokp
2014/05/08 23:34:43
Done.
| |
135 bool ShouldUseGpuRasterization() const { return use_gpu_rasterization_; } | |
136 | 135 |
137 // Functions used by tile manager. | 136 // Functions used by tile manager. |
138 void DidUnregisterLayer(); | 137 void DidUnregisterLayer(); |
139 PictureLayerImpl* GetTwinLayer() { return twin_layer_; } | 138 PictureLayerImpl* GetTwinLayer() { return twin_layer_; } |
140 WhichTree GetTree() const; | 139 WhichTree GetTree() const; |
141 bool IsOnActiveOrPendingTree() const; | 140 bool IsOnActiveOrPendingTree() const; |
142 | 141 |
143 protected: | 142 protected: |
144 friend class LayerRasterTileIterator; | 143 friend class LayerRasterTileIterator; |
145 | 144 |
146 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); | 145 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); |
147 PictureLayerTiling* AddTiling(float contents_scale); | 146 PictureLayerTiling* AddTiling(float contents_scale); |
148 void RemoveTiling(float contents_scale); | 147 void RemoveTiling(float contents_scale); |
149 void RemoveAllTilings(); | 148 void RemoveAllTilings(); |
150 void SyncFromActiveLayer(const PictureLayerImpl* other); | 149 void SyncFromActiveLayer(const PictureLayerImpl* other); |
151 void ManageTilings(bool animating_transform_to_screen, | 150 void ManageTilings(bool animating_transform_to_screen, |
152 float maximum_animation_contents_scale); | 151 float maximum_animation_contents_scale); |
153 bool ShouldHaveLowResTiling() const { | 152 bool ShouldHaveLowResTiling() const { |
154 return should_use_low_res_tiling_ && !ShouldUseGpuRasterization(); | 153 return should_use_low_res_tiling_ && !UseGpuRasterization(); |
155 } | 154 } |
156 virtual bool ShouldAdjustRasterScale( | 155 virtual bool ShouldAdjustRasterScale( |
157 bool animating_transform_to_screen) const; | 156 bool animating_transform_to_screen) const; |
158 virtual void RecalculateRasterScales(bool animating_transform_to_screen, | 157 virtual void RecalculateRasterScales(bool animating_transform_to_screen, |
159 float maximum_animation_contents_scale); | 158 float maximum_animation_contents_scale); |
160 void CleanUpTilingsOnActiveLayer( | 159 void CleanUpTilingsOnActiveLayer( |
161 std::vector<PictureLayerTiling*> used_tilings); | 160 std::vector<PictureLayerTiling*> used_tilings); |
162 float MinimumContentsScale() const; | 161 float MinimumContentsScale() const; |
163 float SnappedContentsScale(float new_contents_scale); | 162 float SnappedContentsScale(float new_contents_scale); |
164 void UpdateLCDTextStatus(bool new_status); | 163 void UpdateLCDTextStatus(bool new_status); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 float low_res_raster_contents_scale_; | 204 float low_res_raster_contents_scale_; |
206 | 205 |
207 bool raster_source_scale_is_fixed_; | 206 bool raster_source_scale_is_fixed_; |
208 bool was_animating_transform_to_screen_; | 207 bool was_animating_transform_to_screen_; |
209 bool is_using_lcd_text_; | 208 bool is_using_lcd_text_; |
210 bool needs_post_commit_initialization_; | 209 bool needs_post_commit_initialization_; |
211 // A sanity state check to make sure UpdateTilePriorities only gets called | 210 // A sanity state check to make sure UpdateTilePriorities only gets called |
212 // after a CalculateContentsScale/ManageTilings. | 211 // after a CalculateContentsScale/ManageTilings. |
213 bool should_update_tile_priorities_; | 212 bool should_update_tile_priorities_; |
214 bool should_use_low_res_tiling_; | 213 bool should_use_low_res_tiling_; |
215 bool use_gpu_rasterization_; | |
216 | 214 |
217 bool layer_needs_to_register_itself_; | 215 bool layer_needs_to_register_itself_; |
218 | 216 |
219 // Save a copy of the visible rect and viewport size of the last frame that | 217 // Save a copy of the visible rect and viewport size of the last frame that |
220 // has a valid viewport for prioritizing tiles. | 218 // has a valid viewport for prioritizing tiles. |
221 gfx::Rect visible_rect_for_tile_priority_; | 219 gfx::Rect visible_rect_for_tile_priority_; |
222 gfx::Size viewport_size_for_tile_priority_; | 220 gfx::Size viewport_size_for_tile_priority_; |
223 gfx::Transform screen_space_transform_for_tile_priority_; | 221 gfx::Transform screen_space_transform_for_tile_priority_; |
224 | 222 |
225 friend class PictureLayer; | 223 friend class PictureLayer; |
226 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 224 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
227 }; | 225 }; |
228 | 226 |
229 } // namespace cc | 227 } // namespace cc |
230 | 228 |
231 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 229 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |