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 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 Region missing_region_; | 119 Region missing_region_; |
117 Region::Iterator region_iter_; | 120 Region::Iterator region_iter_; |
118 }; | 121 }; |
119 | 122 |
120 void AsValueInto(base::debug::TracedValue* array) const; | 123 void AsValueInto(base::debug::TracedValue* array) const; |
121 size_t GPUMemoryUsageInBytes() const; | 124 size_t GPUMemoryUsageInBytes() const; |
122 | 125 |
123 TilingRange GetTilingRange(TilingRangeType type) const; | 126 TilingRange GetTilingRange(TilingRangeType type) const; |
124 | 127 |
125 private: | 128 private: |
| 129 explicit PictureLayerTilingSet(PictureLayerTilingClient* client); |
| 130 |
126 PictureLayerTilingClient* client_; | 131 PictureLayerTilingClient* client_; |
127 ScopedPtrVector<PictureLayerTiling> tilings_; | 132 ScopedPtrVector<PictureLayerTiling> tilings_; |
128 | 133 |
129 friend class Iterator; | 134 friend class Iterator; |
130 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); | 135 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); |
131 }; | 136 }; |
132 | 137 |
133 } // namespace cc | 138 } // namespace cc |
134 | 139 |
135 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ | 140 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ |
OLD | NEW |