| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 int GetSkewportExtrapolationLimitInContentPixels() const override; | 106 int GetSkewportExtrapolationLimitInContentPixels() const override; |
| 107 WhichTree GetTree() const override; | 107 WhichTree GetTree() const override; |
| 108 bool RequiresHighResToDraw() const override; | 108 bool RequiresHighResToDraw() const override; |
| 109 | 109 |
| 110 // PushPropertiesTo active tree => pending tree. | 110 // PushPropertiesTo active tree => pending tree. |
| 111 void SyncTiling(const PictureLayerTiling* tiling); | 111 void SyncTiling(const PictureLayerTiling* tiling); |
| 112 | 112 |
| 113 // Mask-related functions. | 113 // Mask-related functions. |
| 114 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, | 114 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, |
| 115 gfx::Size* resource_size) const override; | 115 gfx::Size* resource_size) const override; |
| 116 void set_is_mask(bool is_mask) { is_mask_ = is_mask; } | |
| 117 | 116 |
| 118 size_t GPUMemoryUsageInBytes() const override; | 117 size_t GPUMemoryUsageInBytes() const override; |
| 119 | 118 |
| 120 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; | 119 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; |
| 121 | 120 |
| 122 bool CanHaveTilings() const; | 121 bool CanHaveTilings() const; |
| 123 | 122 |
| 124 // Functions used by tile manager. | 123 // Functions used by tile manager. |
| 125 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; | 124 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; |
| 126 bool IsOnActiveOrPendingTree() const; | 125 bool IsOnActiveOrPendingTree() const; |
| 127 // Virtual for testing. | 126 // Virtual for testing. |
| 128 virtual bool HasValidTilePriorities() const; | 127 virtual bool HasValidTilePriorities() const; |
| 129 bool AllTilesRequiredForActivationAreReadyToDraw() const; | 128 bool AllTilesRequiredForActivationAreReadyToDraw() const; |
| 130 bool AllTilesRequiredForDrawAreReadyToDraw() const; | 129 bool AllTilesRequiredForDrawAreReadyToDraw() const; |
| 131 | 130 |
| 132 // Used for benchmarking | 131 // Used for benchmarking |
| 133 const RasterSource* GetRasterSource() const { return raster_source_.get(); } | 132 const RasterSource* GetRasterSource() const { return raster_source_.get(); } |
| 134 | 133 |
| 135 protected: | 134 protected: |
| 136 friend class LayerRasterTileIterator; | 135 friend class LayerRasterTileIterator; |
| 137 using TileRequirementCheck = bool (PictureLayerTiling::*)(const Tile*) const; | 136 using TileRequirementCheck = bool (PictureLayerTiling::*)(const Tile*) const; |
| 138 | 137 |
| 139 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); | 138 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); |
| 140 PictureLayerTiling* AddTiling(float contents_scale); | 139 PictureLayerTiling* AddTiling(float contents_scale); |
| 141 void RemoveAllTilings(); | 140 void RemoveAllTilings(); |
| 142 void SyncFromActiveLayer(const PictureLayerImpl* other); | |
| 143 void AddTilingsForRasterScale(); | 141 void AddTilingsForRasterScale(); |
| 144 void UpdateTilePriorities(const Occlusion& occlusion_in_content_space); | 142 void UpdateTilePriorities(const Occlusion& occlusion_in_content_space); |
| 145 virtual bool ShouldAdjustRasterScale() const; | 143 virtual bool ShouldAdjustRasterScale() const; |
| 146 virtual void RecalculateRasterScales(); | 144 virtual void RecalculateRasterScales(); |
| 147 void CleanUpTilingsOnActiveLayer( | 145 void CleanUpTilingsOnActiveLayer( |
| 148 std::vector<PictureLayerTiling*> used_tilings); | 146 std::vector<PictureLayerTiling*> used_tilings); |
| 149 float MinimumContentsScale() const; | 147 float MinimumContentsScale() const; |
| 150 void ResetRasterScale(); | 148 void ResetRasterScale(); |
| 151 gfx::Rect GetViewportForTilePriorityInContentSpace() const; | 149 gfx::Rect GetViewportForTilePriorityInContentSpace() const; |
| 152 PictureLayerImpl* GetRecycledTwinLayer() const; | 150 PictureLayerImpl* GetRecycledTwinLayer() const; |
| 153 void UpdateRasterSource(scoped_refptr<RasterSource> raster_source); | 151 // TODO(danakj): Make |is_mask| a constructor parameter (for PictureLayer too) |
| 152 // and immutable. |
| 153 void UpdateRasterSource(scoped_refptr<RasterSource> raster_source, |
| 154 Region* new_invalidation, |
| 155 bool is_mask, |
| 156 const PictureLayerTilingSet* pending_set); |
| 154 | 157 |
| 155 void DoPostCommitInitializationIfNeeded() { | 158 void DoPostCommitInitializationIfNeeded() { |
| 156 if (needs_post_commit_initialization_) | 159 if (needs_post_commit_initialization_) |
| 157 DoPostCommitInitialization(); | 160 DoPostCommitInitialization(); |
| 158 } | 161 } |
| 159 void DoPostCommitInitialization(); | 162 void DoPostCommitInitialization(); |
| 160 | 163 |
| 161 bool CanHaveTilingWithScale(float contents_scale) const; | 164 bool CanHaveTilingWithScale(float contents_scale) const; |
| 162 void SanityCheckTilingState() const; | 165 void SanityCheckTilingState() const; |
| 163 // Checks if all tiles required for a certain action (e.g. activation) are | 166 // Checks if all tiles required for a certain action (e.g. activation) are |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 // frame that has a valid viewport for prioritizing tiles. | 212 // frame that has a valid viewport for prioritizing tiles. |
| 210 gfx::Rect visible_rect_for_tile_priority_; | 213 gfx::Rect visible_rect_for_tile_priority_; |
| 211 | 214 |
| 212 friend class PictureLayer; | 215 friend class PictureLayer; |
| 213 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 216 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
| 214 }; | 217 }; |
| 215 | 218 |
| 216 } // namespace cc | 219 } // namespace cc |
| 217 | 220 |
| 218 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 221 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
| OLD | NEW |