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 "cc/base/region.h" | 8 #include "cc/base/region.h" |
9 #include "cc/base/scoped_ptr_vector.h" | 9 #include "cc/base/scoped_ptr_vector.h" |
10 #include "cc/resources/picture_layer_tiling.h" | 10 #include "cc/resources/picture_layer_tiling.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 LOW_RES, | 27 LOW_RES, |
28 LOWER_THAN_LOW_RES | 28 LOWER_THAN_LOW_RES |
29 }; | 29 }; |
30 struct TilingRange { | 30 struct TilingRange { |
31 TilingRange(size_t start, size_t end) : start(start), end(end) {} | 31 TilingRange(size_t start, size_t end) : start(start), end(end) {} |
32 | 32 |
33 size_t start; | 33 size_t start; |
34 size_t end; | 34 size_t end; |
35 }; | 35 }; |
36 | 36 |
37 explicit PictureLayerTilingSet(PictureLayerTilingClient* client); | 37 static scoped_ptr<PictureLayerTilingSet> Create( |
| 38 PictureLayerTilingClient* client); |
| 39 |
38 ~PictureLayerTilingSet(); | 40 ~PictureLayerTilingSet(); |
39 | 41 |
40 void SetClient(PictureLayerTilingClient* client); | 42 void SetClient(PictureLayerTilingClient* client); |
41 const PictureLayerTilingClient* client() const { return client_; } | 43 const PictureLayerTilingClient* client() const { return client_; } |
42 | 44 |
43 void RemoveTilesInRegion(const Region& region); | 45 void RemoveTilesInRegion(const Region& region); |
44 | 46 |
45 // Make this set of tilings match the same set of content scales from |other|. | 47 // Make this set of tilings match the same set of content scales from |other|. |
46 // Delete any tilings that don't meet |minimum_contents_scale|. Recreate | 48 // Delete any tilings that don't meet |minimum_contents_scale|. Recreate |
47 // any tiles that intersect |layer_invalidation|. Update the size of all | 49 // any tiles that intersect |layer_invalidation|. Update the size of all |
48 // tilings to |new_layer_bounds|. | 50 // tilings to |new_layer_bounds|. |
49 // Returns true if we had at least one high res tiling synced. | 51 // Returns true if we had at least one high res tiling synced. |
50 bool SyncTilings(const PictureLayerTilingSet& other, | 52 bool SyncTilings(const PictureLayerTilingSet& other, |
51 const gfx::Size& new_layer_bounds, | 53 const gfx::Size& new_layer_bounds, |
52 const Region& layer_invalidation, | 54 const Region& layer_invalidation, |
53 float minimum_contents_scale); | 55 float minimum_contents_scale, |
| 56 RasterSource* raster_source); |
54 | 57 |
55 PictureLayerTiling* AddTiling(float contents_scale, | 58 PictureLayerTiling* AddTiling(float contents_scale, |
56 const gfx::Size& layer_bounds); | 59 const gfx::Size& layer_bounds); |
57 size_t num_tilings() const { return tilings_.size(); } | 60 size_t num_tilings() const { return tilings_.size(); } |
58 int NumHighResTilings() const; | 61 int NumHighResTilings() const; |
59 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; } | 62 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; } |
60 const PictureLayerTiling* tiling_at(size_t idx) const { | 63 const PictureLayerTiling* tiling_at(size_t idx) const { |
61 return tilings_[idx]; | 64 return tilings_[idx]; |
62 } | 65 } |
63 | 66 |
64 PictureLayerTiling* TilingAtScale(float scale) const; | 67 PictureLayerTiling* TilingAtScale(float scale) const; |
65 | 68 |
66 // Remove all tilings. | 69 // Remove all tilings. |
67 void RemoveAllTilings(); | 70 void RemoveAllTilings(); |
68 | 71 |
69 // Remove one tiling. | 72 // Remove one tiling. |
70 void Remove(PictureLayerTiling* tiling); | 73 void Remove(PictureLayerTiling* tiling); |
71 | 74 |
72 // Remove all tiles; keep all tilings. | 75 // Remove all tiles; keep all tilings. |
73 void RemoveAllTiles(); | 76 void RemoveAllTiles(); |
74 | 77 |
| 78 // Update the rects and priorities for tiles based on the given information. |
| 79 bool UpdateTilePriorities(const gfx::Rect& required_rect_in_layer_space, |
| 80 float ideal_contents_scale, |
| 81 double current_frame_time_in_seconds, |
| 82 const Occlusion& occlusion_in_layer_space, |
| 83 bool can_require_tiles_for_activation); |
| 84 |
75 // For a given rect, iterates through tiles that can fill it. If no | 85 // For a given rect, iterates through tiles that can fill it. If no |
76 // set of tiles with resources can fill the rect, then it will iterate | 86 // set of tiles with resources can fill the rect, then it will iterate |
77 // through null tiles with valid geometry_rect() until the rect is full. | 87 // through null tiles with valid geometry_rect() until the rect is full. |
78 // If all tiles have resources, the union of all geometry_rects will | 88 // If all tiles have resources, the union of all geometry_rects will |
79 // exactly fill rect with no overlap. | 89 // exactly fill rect with no overlap. |
80 class CC_EXPORT CoverageIterator { | 90 class CC_EXPORT CoverageIterator { |
81 public: | 91 public: |
82 CoverageIterator(const PictureLayerTilingSet* set, | 92 CoverageIterator(const PictureLayerTilingSet* set, |
83 float contents_scale, | 93 float contents_scale, |
84 const gfx::Rect& content_rect, | 94 const gfx::Rect& content_rect, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 Region missing_region_; | 126 Region missing_region_; |
117 Region::Iterator region_iter_; | 127 Region::Iterator region_iter_; |
118 }; | 128 }; |
119 | 129 |
120 void AsValueInto(base::debug::TracedValue* array) const; | 130 void AsValueInto(base::debug::TracedValue* array) const; |
121 size_t GPUMemoryUsageInBytes() const; | 131 size_t GPUMemoryUsageInBytes() const; |
122 | 132 |
123 TilingRange GetTilingRange(TilingRangeType type) const; | 133 TilingRange GetTilingRange(TilingRangeType type) const; |
124 | 134 |
125 private: | 135 private: |
| 136 explicit PictureLayerTilingSet(PictureLayerTilingClient* client); |
| 137 |
126 PictureLayerTilingClient* client_; | 138 PictureLayerTilingClient* client_; |
127 ScopedPtrVector<PictureLayerTiling> tilings_; | 139 ScopedPtrVector<PictureLayerTiling> tilings_; |
128 | 140 |
129 friend class Iterator; | 141 friend class Iterator; |
130 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); | 142 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); |
131 }; | 143 }; |
132 | 144 |
133 } // namespace cc | 145 } // namespace cc |
134 | 146 |
135 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ | 147 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ |
OLD | NEW |