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