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 "skia/ext/refptr.h" | 17 #include "skia/ext/refptr.h" |
18 #include "third_party/skia/include/core/SkPicture.h" | 18 #include "third_party/skia/include/core/SkPicture.h" |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 | 21 |
22 struct AppendQuadsData; | 22 struct AppendQuadsData; |
23 class MicroBenchmarkImpl; | 23 class MicroBenchmarkImpl; |
24 class Tile; | 24 class Tile; |
25 | 25 |
| 26 class PictureLayerImpl; |
| 27 struct CC_EXPORT PairedPictureLayer { |
| 28 PairedPictureLayer(); |
| 29 ~PairedPictureLayer(); |
| 30 |
| 31 PictureLayerImpl* active_layer; |
| 32 PictureLayerImpl* pending_layer; |
| 33 }; |
| 34 |
26 class CC_EXPORT PictureLayerImpl | 35 class CC_EXPORT PictureLayerImpl |
27 : public LayerImpl, | 36 : public LayerImpl, |
28 NON_EXPORTED_BASE(public PictureLayerTilingClient) { | 37 NON_EXPORTED_BASE(public PictureLayerTilingClient) { |
29 public: | 38 public: |
30 class CC_EXPORT LayerRasterTileIterator { | 39 class CC_EXPORT LayerRasterTileIterator { |
31 public: | 40 public: |
32 LayerRasterTileIterator(); | 41 LayerRasterTileIterator(); |
33 LayerRasterTileIterator(PictureLayerImpl* layer, bool prioritize_low_res); | 42 LayerRasterTileIterator(PictureLayerImpl* layer, bool prioritize_low_res); |
34 ~LayerRasterTileIterator(); | 43 ~LayerRasterTileIterator(); |
35 | 44 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 const gfx::Rect& content_rect) OVERRIDE; | 114 const gfx::Rect& content_rect) OVERRIDE; |
106 virtual PicturePileImpl* GetPile() OVERRIDE; | 115 virtual PicturePileImpl* GetPile() OVERRIDE; |
107 virtual gfx::Size CalculateTileSize( | 116 virtual gfx::Size CalculateTileSize( |
108 const gfx::Size& content_bounds) const OVERRIDE; | 117 const gfx::Size& content_bounds) const OVERRIDE; |
109 virtual const Region* GetInvalidation() OVERRIDE; | 118 virtual const Region* GetInvalidation() OVERRIDE; |
110 virtual const PictureLayerTiling* GetTwinTiling( | 119 virtual const PictureLayerTiling* GetTwinTiling( |
111 const PictureLayerTiling* tiling) const OVERRIDE; | 120 const PictureLayerTiling* tiling) const OVERRIDE; |
112 virtual size_t GetMaxTilesForInterestArea() const OVERRIDE; | 121 virtual size_t GetMaxTilesForInterestArea() const OVERRIDE; |
113 virtual float GetSkewportTargetTimeInSeconds() const OVERRIDE; | 122 virtual float GetSkewportTargetTimeInSeconds() const OVERRIDE; |
114 virtual int GetSkewportExtrapolationLimitInContentPixels() const OVERRIDE; | 123 virtual int GetSkewportExtrapolationLimitInContentPixels() const OVERRIDE; |
| 124 virtual WhichTree GetTree() const OVERRIDE; |
| 125 virtual bool RequiresHighResToDraw() const OVERRIDE; |
115 | 126 |
116 // PushPropertiesTo active tree => pending tree. | 127 // PushPropertiesTo active tree => pending tree. |
117 void SyncTiling(const PictureLayerTiling* tiling); | 128 void SyncTiling(const PictureLayerTiling* tiling); |
118 | 129 |
119 // Mask-related functions | 130 // Mask-related functions |
120 void SetIsMask(bool is_mask); | 131 void SetIsMask(bool is_mask); |
121 virtual ResourceProvider::ResourceId ContentsResourceId() const OVERRIDE; | 132 virtual ResourceProvider::ResourceId ContentsResourceId() const OVERRIDE; |
122 | 133 |
123 virtual size_t GPUMemoryUsageInBytes() const OVERRIDE; | 134 virtual size_t GPUMemoryUsageInBytes() const OVERRIDE; |
124 | 135 |
125 virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) OVERRIDE; | 136 virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) OVERRIDE; |
126 | 137 |
127 // Functions used by tile manager. | 138 // Functions used by tile manager. |
128 PictureLayerImpl* GetTwinLayer() { return twin_layer_; } | 139 PictureLayerImpl* GetTwinLayer() { return twin_layer_; } |
129 WhichTree GetTree() const; | |
130 bool IsOnActiveOrPendingTree() const; | 140 bool IsOnActiveOrPendingTree() const; |
131 bool HasValidTilePriorities() const; | 141 bool HasValidTilePriorities() const; |
132 bool AllTilesRequiredForActivationAreReadyToDraw() const; | 142 bool AllTilesRequiredForActivationAreReadyToDraw() const; |
133 | 143 |
134 protected: | 144 protected: |
135 friend class LayerRasterTileIterator; | 145 friend class LayerRasterTileIterator; |
136 | 146 |
137 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); | 147 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); |
138 PictureLayerTiling* AddTiling(float contents_scale); | 148 PictureLayerTiling* AddTiling(float contents_scale); |
139 void RemoveTiling(float contents_scale); | 149 void RemoveTiling(float contents_scale); |
140 void RemoveAllTilings(); | 150 void RemoveAllTilings(); |
141 void SyncFromActiveLayer(const PictureLayerImpl* other); | 151 void SyncFromActiveLayer(const PictureLayerImpl* other); |
142 void AddTilingsForRasterScale(); | 152 void AddTilingsForRasterScale(); |
143 void UpdateTilePriorities( | 153 void UpdateTilePriorities( |
144 const OcclusionTracker<LayerImpl>* occlusion_tracker); | 154 const OcclusionTracker<LayerImpl>* occlusion_tracker); |
145 virtual bool ShouldAdjustRasterScale() const; | 155 virtual bool ShouldAdjustRasterScale() const; |
146 virtual void RecalculateRasterScales(); | 156 virtual void RecalculateRasterScales(); |
147 void CleanUpTilingsOnActiveLayer( | 157 void CleanUpTilingsOnActiveLayer( |
148 std::vector<PictureLayerTiling*> used_tilings); | 158 std::vector<PictureLayerTiling*> used_tilings); |
149 float MinimumContentsScale() const; | 159 float MinimumContentsScale() const; |
150 float SnappedContentsScale(float new_contents_scale); | 160 float SnappedContentsScale(float new_contents_scale); |
151 void ResetRasterScale(); | 161 void ResetRasterScale(); |
152 void MarkVisibleResourcesAsRequired() const; | |
153 bool MarkVisibleTilesAsRequired( | |
154 PictureLayerTiling* tiling, | |
155 const PictureLayerTiling* optional_twin_tiling, | |
156 float contents_scale, | |
157 const gfx::Rect& rect, | |
158 const Region& missing_region) const; | |
159 | 162 |
160 void DoPostCommitInitializationIfNeeded() { | 163 void DoPostCommitInitializationIfNeeded() { |
161 if (needs_post_commit_initialization_) | 164 if (needs_post_commit_initialization_) |
162 DoPostCommitInitialization(); | 165 DoPostCommitInitialization(); |
163 } | 166 } |
164 void DoPostCommitInitialization(); | 167 void DoPostCommitInitialization(); |
165 | 168 |
166 bool CanHaveTilings() const; | 169 bool CanHaveTilings() const; |
167 bool CanHaveTilingWithScale(float contents_scale) const; | 170 bool CanHaveTilingWithScale(float contents_scale) const; |
168 void SanityCheckTilingState() const; | 171 void SanityCheckTilingState() const; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 gfx::Size viewport_size_for_tile_priority_; | 209 gfx::Size viewport_size_for_tile_priority_; |
207 gfx::Transform screen_space_transform_for_tile_priority_; | 210 gfx::Transform screen_space_transform_for_tile_priority_; |
208 | 211 |
209 friend class PictureLayer; | 212 friend class PictureLayer; |
210 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 213 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
211 }; | 214 }; |
212 | 215 |
213 } // namespace cc | 216 } // namespace cc |
214 | 217 |
215 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 218 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |