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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 bool CanHaveTilings() const; | 91 bool CanHaveTilings() const; |
92 | 92 |
93 PictureLayerTilingSet* picture_layer_tiling_set() { return tilings_.get(); } | 93 PictureLayerTilingSet* picture_layer_tiling_set() { return tilings_.get(); } |
94 | 94 |
95 // Functions used by tile manager. | 95 // Functions used by tile manager. |
96 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; | 96 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; |
97 bool IsOnActiveOrPendingTree() const; | 97 bool IsOnActiveOrPendingTree() const; |
98 // Virtual for testing. | 98 // Virtual for testing. |
99 virtual bool HasValidTilePriorities() const; | 99 virtual bool HasValidTilePriorities() const; |
100 bool AllTilesRequiredForActivationAreReadyToDraw() const; | |
101 bool AllTilesRequiredForDrawAreReadyToDraw() const; | |
102 | 100 |
103 // Used for benchmarking | 101 // Used for benchmarking |
104 RasterSource* GetRasterSource() const { return raster_source_.get(); } | 102 RasterSource* GetRasterSource() const { return raster_source_.get(); } |
105 | 103 |
106 protected: | 104 protected: |
107 friend class LayerRasterTileIterator; | 105 friend class LayerRasterTileIterator; |
108 using TileRequirementCheck = bool (PictureLayerTiling::*)(const Tile*) const; | 106 using TileRequirementCheck = bool (PictureLayerTiling::*)(const Tile*) const; |
109 | 107 |
110 PictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask); | 108 PictureLayerImpl(LayerTreeImpl* tree_impl, int id, bool is_mask); |
111 PictureLayerTiling* AddTiling(float contents_scale); | 109 PictureLayerTiling* AddTiling(float contents_scale); |
112 void RemoveAllTilings(); | 110 void RemoveAllTilings(); |
113 void AddTilingsForRasterScale(); | 111 void AddTilingsForRasterScale(); |
114 bool UpdateTilePriorities(const Occlusion& occlusion_in_content_space); | 112 bool UpdateTilePriorities(const Occlusion& occlusion_in_content_space); |
115 virtual bool ShouldAdjustRasterScale() const; | 113 virtual bool ShouldAdjustRasterScale() const; |
116 virtual void RecalculateRasterScales(); | 114 virtual void RecalculateRasterScales(); |
117 void CleanUpTilingsOnActiveLayer( | 115 void CleanUpTilingsOnActiveLayer( |
118 std::vector<PictureLayerTiling*> used_tilings); | 116 std::vector<PictureLayerTiling*> used_tilings); |
119 float MinimumContentsScale() const; | 117 float MinimumContentsScale() const; |
120 float MaximumContentsScale() const; | 118 float MaximumContentsScale() const; |
121 void ResetRasterScale(); | 119 void ResetRasterScale(); |
122 void UpdateViewportRectForTilePriorityInContentSpace(); | 120 void UpdateViewportRectForTilePriorityInContentSpace(); |
123 PictureLayerImpl* GetRecycledTwinLayer() const; | 121 PictureLayerImpl* GetRecycledTwinLayer() const; |
124 | 122 |
125 void SanityCheckTilingState() const; | 123 void SanityCheckTilingState() const; |
126 // Checks if all tiles required for a certain action (e.g. activation) are | |
127 // ready to draw. is_tile_required_callback gets called on all candidate | |
128 // tiles and returns true if the tile is required for the action. | |
129 bool AllTilesRequiredAreReadyToDraw( | |
130 TileRequirementCheck is_tile_required_callback) const; | |
131 | |
132 bool ShouldAdjustRasterScaleDuringScaleAnimations() const; | 124 bool ShouldAdjustRasterScaleDuringScaleAnimations() const; |
133 | 125 |
134 void GetDebugBorderProperties(SkColor* color, float* width) const override; | 126 void GetDebugBorderProperties(SkColor* color, float* width) const override; |
135 void GetAllTilesForTracing(std::set<const Tile*>* tiles) const override; | 127 void GetAllTilesForTracing(std::set<const Tile*>* tiles) const override; |
136 void AsValueInto(base::debug::TracedValue* dict) const override; | 128 void AsValueInto(base::debug::TracedValue* dict) const override; |
137 | 129 |
138 virtual void UpdateIdealScales(); | 130 virtual void UpdateIdealScales(); |
139 float MaximumTilingContentsScale() const; | 131 float MaximumTilingContentsScale() const; |
140 scoped_ptr<PictureLayerTilingSet> CreatePictureLayerTilingSet(); | 132 scoped_ptr<PictureLayerTilingSet> CreatePictureLayerTilingSet(); |
141 | 133 |
(...skipping 29 matching lines...) Expand all Loading... |
171 // frame that has a valid viewport for prioritizing tiles. | 163 // frame that has a valid viewport for prioritizing tiles. |
172 gfx::Rect visible_rect_for_tile_priority_; | 164 gfx::Rect visible_rect_for_tile_priority_; |
173 gfx::Rect viewport_rect_for_tile_priority_in_content_space_; | 165 gfx::Rect viewport_rect_for_tile_priority_in_content_space_; |
174 | 166 |
175 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 167 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
176 }; | 168 }; |
177 | 169 |
178 } // namespace cc | 170 } // namespace cc |
179 | 171 |
180 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 172 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
OLD | NEW |