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 |
11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
12 #include "cc/base/scoped_ptr_vector.h" | 12 #include "cc/base/scoped_ptr_vector.h" |
13 #include "cc/layers/layer_impl.h" | 13 #include "cc/layers/layer_impl.h" |
14 #include "cc/resources/picture_layer_tiling.h" | 14 #include "cc/resources/picture_layer_tiling.h" |
15 #include "cc/resources/picture_layer_tiling_set.h" | 15 #include "cc/resources/picture_layer_tiling_set.h" |
16 #include "cc/resources/picture_pile_impl.h" | 16 #include "cc/resources/picture_pile_impl.h" |
| 17 #include "cc/trees/layer_tree_impl.h" |
17 #include "skia/ext/refptr.h" | 18 #include "skia/ext/refptr.h" |
18 #include "third_party/skia/include/core/SkPicture.h" | 19 #include "third_party/skia/include/core/SkPicture.h" |
19 | 20 |
20 namespace cc { | 21 namespace cc { |
21 | 22 |
22 struct AppendQuadsData; | 23 struct AppendQuadsData; |
23 class QuadSink; | 24 class QuadSink; |
24 class MicroBenchmarkImpl; | 25 class MicroBenchmarkImpl; |
25 class Tile; | 26 class Tile; |
26 | 27 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 void SyncTiling(const PictureLayerTiling* tiling); | 125 void SyncTiling(const PictureLayerTiling* tiling); |
125 | 126 |
126 // Mask-related functions | 127 // Mask-related functions |
127 void SetIsMask(bool is_mask); | 128 void SetIsMask(bool is_mask); |
128 virtual ResourceProvider::ResourceId ContentsResourceId() const OVERRIDE; | 129 virtual ResourceProvider::ResourceId ContentsResourceId() const OVERRIDE; |
129 | 130 |
130 virtual size_t GPUMemoryUsageInBytes() const OVERRIDE; | 131 virtual size_t GPUMemoryUsageInBytes() const OVERRIDE; |
131 | 132 |
132 virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) OVERRIDE; | 133 virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) OVERRIDE; |
133 | 134 |
134 void SetUseGpuRasterization(bool use_gpu); | 135 bool use_gpu_rasterization() const { |
135 bool ShouldUseGpuRasterization() const { return use_gpu_rasterization_; } | 136 return layer_tree_impl()->use_gpu_rasterization(); |
| 137 } |
136 | 138 |
137 // Functions used by tile manager. | 139 // Functions used by tile manager. |
138 void DidUnregisterLayer(); | 140 void DidUnregisterLayer(); |
139 PictureLayerImpl* GetTwinLayer() { return twin_layer_; } | 141 PictureLayerImpl* GetTwinLayer() { return twin_layer_; } |
140 WhichTree GetTree() const; | 142 WhichTree GetTree() const; |
141 bool IsOnActiveOrPendingTree() const; | 143 bool IsOnActiveOrPendingTree() const; |
142 | 144 |
143 protected: | 145 protected: |
144 friend class LayerRasterTileIterator; | 146 friend class LayerRasterTileIterator; |
145 | 147 |
146 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); | 148 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); |
147 PictureLayerTiling* AddTiling(float contents_scale); | 149 PictureLayerTiling* AddTiling(float contents_scale); |
148 void RemoveTiling(float contents_scale); | 150 void RemoveTiling(float contents_scale); |
149 void RemoveAllTilings(); | 151 void RemoveAllTilings(); |
150 void SyncFromActiveLayer(const PictureLayerImpl* other); | 152 void SyncFromActiveLayer(const PictureLayerImpl* other); |
151 void ManageTilings(bool animating_transform_to_screen, | 153 void ManageTilings(bool animating_transform_to_screen, |
152 float maximum_animation_contents_scale); | 154 float maximum_animation_contents_scale); |
153 bool ShouldHaveLowResTiling() const { | 155 bool ShouldHaveLowResTiling() const { |
154 return should_use_low_res_tiling_ && !ShouldUseGpuRasterization(); | 156 return should_use_low_res_tiling_ && !use_gpu_rasterization(); |
155 } | 157 } |
156 virtual bool ShouldAdjustRasterScale( | 158 virtual bool ShouldAdjustRasterScale( |
157 bool animating_transform_to_screen) const; | 159 bool animating_transform_to_screen) const; |
158 virtual void RecalculateRasterScales(bool animating_transform_to_screen, | 160 virtual void RecalculateRasterScales(bool animating_transform_to_screen, |
159 float maximum_animation_contents_scale); | 161 float maximum_animation_contents_scale); |
160 void CleanUpTilingsOnActiveLayer( | 162 void CleanUpTilingsOnActiveLayer( |
161 std::vector<PictureLayerTiling*> used_tilings); | 163 std::vector<PictureLayerTiling*> used_tilings); |
162 float MinimumContentsScale() const; | 164 float MinimumContentsScale() const; |
163 float SnappedContentsScale(float new_contents_scale); | 165 float SnappedContentsScale(float new_contents_scale); |
164 void UpdateLCDTextStatus(bool new_status); | 166 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_; | 207 float low_res_raster_contents_scale_; |
206 | 208 |
207 bool raster_source_scale_is_fixed_; | 209 bool raster_source_scale_is_fixed_; |
208 bool was_animating_transform_to_screen_; | 210 bool was_animating_transform_to_screen_; |
209 bool is_using_lcd_text_; | 211 bool is_using_lcd_text_; |
210 bool needs_post_commit_initialization_; | 212 bool needs_post_commit_initialization_; |
211 // A sanity state check to make sure UpdateTilePriorities only gets called | 213 // A sanity state check to make sure UpdateTilePriorities only gets called |
212 // after a CalculateContentsScale/ManageTilings. | 214 // after a CalculateContentsScale/ManageTilings. |
213 bool should_update_tile_priorities_; | 215 bool should_update_tile_priorities_; |
214 bool should_use_low_res_tiling_; | 216 bool should_use_low_res_tiling_; |
215 bool use_gpu_rasterization_; | |
216 | 217 |
217 bool layer_needs_to_register_itself_; | 218 bool layer_needs_to_register_itself_; |
218 | 219 |
219 // Save a copy of the visible rect and viewport size of the last frame that | 220 // Save a copy of the visible rect and viewport size of the last frame that |
220 // has a valid viewport for prioritizing tiles. | 221 // has a valid viewport for prioritizing tiles. |
221 gfx::Rect visible_rect_for_tile_priority_; | 222 gfx::Rect visible_rect_for_tile_priority_; |
222 gfx::Size viewport_size_for_tile_priority_; | 223 gfx::Size viewport_size_for_tile_priority_; |
223 gfx::Transform screen_space_transform_for_tile_priority_; | 224 gfx::Transform screen_space_transform_for_tile_priority_; |
224 | 225 |
225 friend class PictureLayer; | 226 friend class PictureLayer; |
226 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 227 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
227 }; | 228 }; |
228 | 229 |
229 } // namespace cc | 230 } // namespace cc |
230 | 231 |
231 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 232 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |