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_RESOURCES_PICTURE_LAYER_TILING_SET_H_ | 5 #ifndef CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ |
6 #define CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ | 6 #define CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 const PictureLayerTilingClient* client() const { return client_; } | 48 const PictureLayerTilingClient* client() const { return client_; } |
49 | 49 |
50 void CleanUpTilings(float min_acceptable_high_res_scale, | 50 void CleanUpTilings(float min_acceptable_high_res_scale, |
51 float max_acceptable_high_res_scale, | 51 float max_acceptable_high_res_scale, |
52 const std::vector<PictureLayerTiling*>& needed_tilings, | 52 const std::vector<PictureLayerTiling*>& needed_tilings, |
53 bool should_have_low_res, | 53 bool should_have_low_res, |
54 PictureLayerTilingSet* twin_set, | 54 PictureLayerTilingSet* twin_set, |
55 PictureLayerTilingSet* recycled_twin_set); | 55 PictureLayerTilingSet* recycled_twin_set); |
56 void RemoveNonIdealTilings(); | 56 void RemoveNonIdealTilings(); |
57 // Make this set of tilings match the same set of content scales from |other|. | |
58 // Delete any tilings that don't meet |minimum_contents_scale|. Recreate | |
59 // any tiles that intersect |layer_invalidation|. Update the size of all | |
60 // tilings to |new_layer_bounds|. | |
61 // Returns true if we had at least one high res tiling synced. | |
62 // TODO(danakj): Remove this !!! | |
63 bool SyncTilingsForTesting(const PictureLayerTilingSet& other, | |
64 const gfx::Size& new_layer_bounds, | |
65 const Region& layer_invalidation, | |
66 float minimum_contents_scale, | |
67 RasterSource* raster_source); | |
68 | 57 |
69 void UpdateTilingsToCurrentRasterSource( | 58 void UpdateTilingsToCurrentRasterSource( |
70 RasterSource* raster_source, | 59 scoped_refptr<RasterSource> raster_source, |
71 const PictureLayerTilingSet* twin_set, | 60 const PictureLayerTilingSet* twin_set, |
72 const Region& layer_invalidation, | 61 const Region& layer_invalidation, |
73 float minimum_contents_scale); | 62 float minimum_contents_scale, |
| 63 float maximum_contents_scale); |
74 | 64 |
75 PictureLayerTiling* AddTiling(float contents_scale, | 65 PictureLayerTiling* AddTiling(float contents_scale, |
76 const gfx::Size& layer_bounds); | 66 scoped_refptr<RasterSource> raster_source); |
77 size_t num_tilings() const { return tilings_.size(); } | 67 size_t num_tilings() const { return tilings_.size(); } |
78 int NumHighResTilings() const; | 68 int NumHighResTilings() const; |
79 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; } | 69 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; } |
80 const PictureLayerTiling* tiling_at(size_t idx) const { | 70 const PictureLayerTiling* tiling_at(size_t idx) const { |
81 return tilings_[idx]; | 71 return tilings_[idx]; |
82 } | 72 } |
83 | 73 |
84 PictureLayerTiling* FindTilingWithScale(float scale) const; | 74 PictureLayerTiling* FindTilingWithScale(float scale) const; |
85 PictureLayerTiling* FindTilingWithResolution(TileResolution resolution) const; | 75 PictureLayerTiling* FindTilingWithResolution(TileResolution resolution) const; |
86 | 76 |
87 void MarkAllTilingsNonIdeal(); | 77 void MarkAllTilingsNonIdeal(); |
88 | 78 |
89 // If a tiling exists whose scale is within |snap_to_existing_tiling_ratio| | 79 // If a tiling exists whose scale is within |snap_to_existing_tiling_ratio| |
90 // ratio of |start_scale|, then return that tiling's scale. Otherwise, return | 80 // ratio of |start_scale|, then return that tiling's scale. Otherwise, return |
91 // |start_scale|. If multiple tilings match the criteria, return the one with | 81 // |start_scale|. If multiple tilings match the criteria, return the one with |
92 // the least ratio to |start_scale|. | 82 // the least ratio to |start_scale|. |
93 float GetSnappedContentsScale(float start_scale, | 83 float GetSnappedContentsScale(float start_scale, |
94 float snap_to_existing_tiling_ratio) const; | 84 float snap_to_existing_tiling_ratio) const; |
95 | 85 |
96 // Returns the maximum contents scale of all tilings, or 0 if no tilings | 86 // Returns the maximum contents scale of all tilings, or 0 if no tilings |
97 // exist. | 87 // exist. |
98 float GetMaximumContentsScale() const; | 88 float GetMaximumContentsScale() const; |
99 | 89 |
100 // Removes all tilings with a contents scale < |minimum_scale|. | 90 // Removes all tilings with a contents scale < |minimum_scale|. |
101 void RemoveTilingsBelowScale(float minimum_scale); | 91 void RemoveTilingsBelowScale(float minimum_scale); |
102 | 92 |
| 93 // Removes all tilings with a contents scale > |maximum_scale|. |
| 94 void RemoveTilingsAboveScale(float maximum_scale); |
| 95 |
103 // Remove all tilings. | 96 // Remove all tilings. |
104 void RemoveAllTilings(); | 97 void RemoveAllTilings(); |
105 | 98 |
106 // Remove all tiles; keep all tilings. | 99 // Remove all tiles; keep all tilings. |
107 void RemoveAllTiles(); | 100 void RemoveAllTiles(); |
108 | 101 |
109 // Update the rects and priorities for tiles based on the given information. | 102 // Update the rects and priorities for tiles based on the given information. |
110 bool UpdateTilePriorities(const gfx::Rect& required_rect_in_layer_space, | 103 bool UpdateTilePriorities(const gfx::Rect& required_rect_in_layer_space, |
111 float ideal_contents_scale, | 104 float ideal_contents_scale, |
112 double current_frame_time_in_seconds, | 105 double current_frame_time_in_seconds, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 const int skewport_extrapolation_limit_in_content_pixels_; | 175 const int skewport_extrapolation_limit_in_content_pixels_; |
183 PictureLayerTilingClient* client_; | 176 PictureLayerTilingClient* client_; |
184 | 177 |
185 friend class Iterator; | 178 friend class Iterator; |
186 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); | 179 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); |
187 }; | 180 }; |
188 | 181 |
189 } // namespace cc | 182 } // namespace cc |
190 | 183 |
191 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ | 184 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ |
OLD | NEW |