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 24 matching lines...) Expand all Loading... |
35 | 35 |
36 size_t start; | 36 size_t start; |
37 size_t end; | 37 size_t end; |
38 }; | 38 }; |
39 | 39 |
40 static scoped_ptr<PictureLayerTilingSet> Create( | 40 static scoped_ptr<PictureLayerTilingSet> Create( |
41 PictureLayerTilingClient* client); | 41 PictureLayerTilingClient* client); |
42 | 42 |
43 ~PictureLayerTilingSet(); | 43 ~PictureLayerTilingSet(); |
44 | 44 |
45 void SetClient(PictureLayerTilingClient* client); | |
46 const PictureLayerTilingClient* client() const { return client_; } | 45 const PictureLayerTilingClient* client() const { return client_; } |
47 | 46 |
48 void RemoveTilesInRegion(const Region& region); | |
49 void CleanUpTilings(float min_acceptable_high_res_scale, | 47 void CleanUpTilings(float min_acceptable_high_res_scale, |
50 float max_acceptable_high_res_scale, | 48 float max_acceptable_high_res_scale, |
51 const std::vector<PictureLayerTiling*>& needed_tilings, | 49 const std::vector<PictureLayerTiling*>& needed_tilings, |
52 bool should_have_low_res, | 50 bool should_have_low_res, |
53 PictureLayerTilingSet* twin_set, | 51 PictureLayerTilingSet* twin_set, |
54 PictureLayerTilingSet* recycled_twin_set); | 52 PictureLayerTilingSet* recycled_twin_set); |
55 | 53 void RemoveNonIdealTilings(); |
56 // Make this set of tilings match the same set of content scales from |other|. | 54 // Make this set of tilings match the same set of content scales from |other|. |
57 // Delete any tilings that don't meet |minimum_contents_scale|. Recreate | 55 // Delete any tilings that don't meet |minimum_contents_scale|. Recreate |
58 // any tiles that intersect |layer_invalidation|. Update the size of all | 56 // any tiles that intersect |layer_invalidation|. Update the size of all |
59 // tilings to |new_layer_bounds|. | 57 // tilings to |new_layer_bounds|. |
60 // Returns true if we had at least one high res tiling synced. | 58 // Returns true if we had at least one high res tiling synced. |
61 bool SyncTilings(const PictureLayerTilingSet& other, | 59 // TODO(danakj): Remove this !!! |
62 const gfx::Size& new_layer_bounds, | 60 bool SyncTilingsForTesting(const PictureLayerTilingSet& other, |
63 const Region& layer_invalidation, | 61 const gfx::Size& new_layer_bounds, |
64 float minimum_contents_scale, | 62 const Region& layer_invalidation, |
65 RasterSource* raster_source); | 63 float minimum_contents_scale, |
| 64 RasterSource* raster_source); |
| 65 |
| 66 void UpdateTilingsToCurrentRasterSource( |
| 67 RasterSource* raster_source, |
| 68 const PictureLayerTilingSet* twin_set, |
| 69 // TODO(danakj): Don't need to pass layer bounds here, we have the raster |
| 70 // source already, and they are the same as the raster source size. |
| 71 const gfx::Size& layer_bounds, |
| 72 const Region& layer_invalidation, |
| 73 float minimum_contents_scale); |
66 | 74 |
67 PictureLayerTiling* AddTiling(float contents_scale, | 75 PictureLayerTiling* AddTiling(float contents_scale, |
68 const gfx::Size& layer_bounds); | 76 const gfx::Size& layer_bounds); |
69 size_t num_tilings() const { return tilings_.size(); } | 77 size_t num_tilings() const { return tilings_.size(); } |
70 int NumHighResTilings() const; | 78 int NumHighResTilings() const; |
71 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; } | 79 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; } |
72 const PictureLayerTiling* tiling_at(size_t idx) const { | 80 const PictureLayerTiling* tiling_at(size_t idx) const { |
73 return tilings_[idx]; | 81 return tilings_[idx]; |
74 } | 82 } |
75 | 83 |
76 PictureLayerTiling* FindTilingWithScale(float scale) const; | 84 PictureLayerTiling* FindTilingWithScale(float scale) const; |
77 PictureLayerTiling* FindTilingWithResolution(TileResolution resolution) const; | 85 PictureLayerTiling* FindTilingWithResolution(TileResolution resolution) const; |
78 | 86 |
79 void MarkAllTilingsNonIdeal(); | 87 void MarkAllTilingsNonIdeal(); |
80 | 88 |
81 // If a tiling exists whose scale is within |snap_to_existing_tiling_ratio| | 89 // If a tiling exists whose scale is within |snap_to_existing_tiling_ratio| |
82 // ratio of |start_scale|, then return that tiling's scale. Otherwise, return | 90 // ratio of |start_scale|, then return that tiling's scale. Otherwise, return |
83 // |start_scale|. If multiple tilings match the criteria, return the one with | 91 // |start_scale|. If multiple tilings match the criteria, return the one with |
84 // the least ratio to |start_scale|. | 92 // the least ratio to |start_scale|. |
85 float GetSnappedContentsScale(float start_scale, | 93 float GetSnappedContentsScale(float start_scale, |
86 float snap_to_existing_tiling_ratio) const; | 94 float snap_to_existing_tiling_ratio) const; |
87 | 95 |
88 // Returns the maximum contents scale of all tilings, or 0 if no tilings | 96 // Returns the maximum contents scale of all tilings, or 0 if no tilings |
89 // exist. | 97 // exist. |
90 float GetMaximumContentsScale() const; | 98 float GetMaximumContentsScale() const; |
91 | 99 |
| 100 // Removes all tilings with a contents scale < |minimum_scale|. |
| 101 void RemoveTilingsBelowScale(float minimum_scale); |
| 102 |
92 // Remove all tilings. | 103 // Remove all tilings. |
93 void RemoveAllTilings(); | 104 void RemoveAllTilings(); |
94 | 105 |
95 // Remove all tiles; keep all tilings. | 106 // Remove all tiles; keep all tilings. |
96 void RemoveAllTiles(); | 107 void RemoveAllTiles(); |
97 | 108 |
98 // Update the rects and priorities for tiles based on the given information. | 109 // Update the rects and priorities for tiles based on the given information. |
99 bool UpdateTilePriorities(const gfx::Rect& required_rect_in_layer_space, | 110 bool UpdateTilePriorities(const gfx::Rect& required_rect_in_layer_space, |
100 float ideal_contents_scale, | 111 float ideal_contents_scale, |
101 double current_frame_time_in_seconds, | 112 double current_frame_time_in_seconds, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 PictureLayerTilingClient* client_; | 174 PictureLayerTilingClient* client_; |
164 ScopedPtrVector<PictureLayerTiling> tilings_; | 175 ScopedPtrVector<PictureLayerTiling> tilings_; |
165 | 176 |
166 friend class Iterator; | 177 friend class Iterator; |
167 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); | 178 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); |
168 }; | 179 }; |
169 | 180 |
170 } // namespace cc | 181 } // namespace cc |
171 | 182 |
172 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ | 183 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ |
OLD | NEW |