| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void DidBeginTracing() override; | 115 void DidBeginTracing() override; |
| 116 void ReleaseResources() override; | 116 void ReleaseResources() override; |
| 117 skia::RefPtr<SkPicture> GetPicture() override; | 117 skia::RefPtr<SkPicture> GetPicture() override; |
| 118 | 118 |
| 119 // PictureLayerTilingClient overrides. | 119 // PictureLayerTilingClient overrides. |
| 120 scoped_refptr<Tile> CreateTile(PictureLayerTiling* tiling, | 120 scoped_refptr<Tile> CreateTile(PictureLayerTiling* tiling, |
| 121 const gfx::Rect& content_rect) override; | 121 const gfx::Rect& content_rect) override; |
| 122 PicturePileImpl* GetPile() override; | 122 PicturePileImpl* GetPile() override; |
| 123 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; | 123 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; |
| 124 const Region* GetPendingInvalidation() override; | 124 const Region* GetPendingInvalidation() override; |
| 125 const PictureLayerTiling* GetTwinTiling( | 125 const PictureLayerTiling* GetPendingOrActiveTwinTiling( |
| 126 const PictureLayerTiling* tiling) const override; | 126 const PictureLayerTiling* tiling) const override; |
| 127 PictureLayerTiling* GetRecycledTwinTiling( | 127 PictureLayerTiling* GetRecycledTwinTiling( |
| 128 const PictureLayerTiling* tiling) override; | 128 const PictureLayerTiling* tiling) override; |
| 129 size_t GetMaxTilesForInterestArea() const override; | 129 size_t GetMaxTilesForInterestArea() const override; |
| 130 float GetSkewportTargetTimeInSeconds() const override; | 130 float GetSkewportTargetTimeInSeconds() const override; |
| 131 int GetSkewportExtrapolationLimitInContentPixels() const override; | 131 int GetSkewportExtrapolationLimitInContentPixels() const override; |
| 132 WhichTree GetTree() const override; | 132 WhichTree GetTree() const override; |
| 133 bool RequiresHighResToDraw() const override; | 133 bool RequiresHighResToDraw() const override; |
| 134 | 134 |
| 135 // PushPropertiesTo active tree => pending tree. | 135 // PushPropertiesTo active tree => pending tree. |
| 136 void SyncTiling(const PictureLayerTiling* tiling); | 136 void SyncTiling(const PictureLayerTiling* tiling); |
| 137 | 137 |
| 138 // Mask-related functions. | 138 // Mask-related functions. |
| 139 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, | 139 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, |
| 140 gfx::Size* resource_size) const override; | 140 gfx::Size* resource_size) const override; |
| 141 | 141 |
| 142 size_t GPUMemoryUsageInBytes() const override; | 142 size_t GPUMemoryUsageInBytes() const override; |
| 143 | 143 |
| 144 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; | 144 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; |
| 145 | 145 |
| 146 // Functions used by tile manager. | 146 // Functions used by tile manager. |
| 147 PictureLayerImpl* GetTwinLayer() { return twin_layer_; } | 147 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; |
| 148 bool IsOnActiveOrPendingTree() const; | 148 bool IsOnActiveOrPendingTree() const; |
| 149 // Virtual for testing. | 149 // Virtual for testing. |
| 150 virtual bool HasValidTilePriorities() const; | 150 virtual bool HasValidTilePriorities() const; |
| 151 bool AllTilesRequiredForActivationAreReadyToDraw() const; | 151 bool AllTilesRequiredForActivationAreReadyToDraw() const; |
| 152 | 152 |
| 153 protected: | 153 protected: |
| 154 friend class LayerRasterTileIterator; | 154 friend class LayerRasterTileIterator; |
| 155 | 155 |
| 156 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); | 156 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); |
| 157 PictureLayerTiling* AddTiling(float contents_scale); | 157 PictureLayerTiling* AddTiling(float contents_scale); |
| 158 void RemoveTiling(float contents_scale); | 158 void RemoveTiling(float contents_scale); |
| 159 void RemoveAllTilings(); | 159 void RemoveAllTilings(); |
| 160 void SyncFromActiveLayer(const PictureLayerImpl* other); | 160 void SyncFromActiveLayer(const PictureLayerImpl* other); |
| 161 void AddTilingsForRasterScale(); | 161 void AddTilingsForRasterScale(); |
| 162 void UpdateTilePriorities(const Occlusion& occlusion_in_content_space); | 162 void UpdateTilePriorities(const Occlusion& occlusion_in_content_space); |
| 163 virtual bool ShouldAdjustRasterScale() const; | 163 virtual bool ShouldAdjustRasterScale() const; |
| 164 virtual void RecalculateRasterScales(); | 164 virtual void RecalculateRasterScales(); |
| 165 void CleanUpTilingsOnActiveLayer( | 165 void CleanUpTilingsOnActiveLayer( |
| 166 std::vector<PictureLayerTiling*> used_tilings); | 166 std::vector<PictureLayerTiling*> used_tilings); |
| 167 float MinimumContentsScale() const; | 167 float MinimumContentsScale() const; |
| 168 float SnappedContentsScale(float new_contents_scale); | 168 float SnappedContentsScale(float new_contents_scale); |
| 169 void ResetRasterScale(); | 169 void ResetRasterScale(); |
| 170 gfx::Rect GetViewportForTilePriorityInContentSpace() const; | 170 gfx::Rect GetViewportForTilePriorityInContentSpace() const; |
| 171 PictureLayerImpl* GetRecycledTwinLayer(); | 171 PictureLayerImpl* GetRecycledTwinLayer() const; |
| 172 | 172 |
| 173 void DoPostCommitInitializationIfNeeded() { | 173 void DoPostCommitInitializationIfNeeded() { |
| 174 if (needs_post_commit_initialization_) | 174 if (needs_post_commit_initialization_) |
| 175 DoPostCommitInitialization(); | 175 DoPostCommitInitialization(); |
| 176 } | 176 } |
| 177 void DoPostCommitInitialization(); | 177 void DoPostCommitInitialization(); |
| 178 | 178 |
| 179 bool CanHaveTilings() const; | 179 bool CanHaveTilings() const; |
| 180 bool CanHaveTilingWithScale(float contents_scale) const; | 180 bool CanHaveTilingWithScale(float contents_scale) const; |
| 181 void SanityCheckTilingState() const; | 181 void SanityCheckTilingState() const; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // frame that has a valid viewport for prioritizing tiles. | 222 // frame that has a valid viewport for prioritizing tiles. |
| 223 gfx::Rect visible_rect_for_tile_priority_; | 223 gfx::Rect visible_rect_for_tile_priority_; |
| 224 | 224 |
| 225 friend class PictureLayer; | 225 friend class PictureLayer; |
| 226 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 226 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
| 227 }; | 227 }; |
| 228 | 228 |
| 229 } // namespace cc | 229 } // namespace cc |
| 230 | 230 |
| 231 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 231 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
| OLD | NEW |