| 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 PictureLayerTilingSet(PictureLayerTilingClient* client, | 37 explicit PictureLayerTilingSet(PictureLayerTilingClient* client); |
| 38 const gfx::Size& layer_bounds); | |
| 39 ~PictureLayerTilingSet(); | 38 ~PictureLayerTilingSet(); |
| 40 | 39 |
| 41 void SetClient(PictureLayerTilingClient* client); | 40 void SetClient(PictureLayerTilingClient* client); |
| 42 const PictureLayerTilingClient* client() const { return client_; } | 41 const PictureLayerTilingClient* client() const { return client_; } |
| 43 | 42 |
| 44 void RemoveTilesInRegion(const Region& region); | 43 void RemoveTilesInRegion(const Region& region); |
| 45 | 44 |
| 46 // Make this set of tilings match the same set of content scales from |other|. | 45 // Make this set of tilings match the same set of content scales from |other|. |
| 47 // Delete any tilings that don't meet |minimum_contents_scale|. Recreate | 46 // Delete any tilings that don't meet |minimum_contents_scale|. Recreate |
| 48 // any tiles that intersect |layer_invalidation|. Update the size of all | 47 // any tiles that intersect |layer_invalidation|. Update the size of all |
| 49 // tilings to |new_layer_bounds|. | 48 // tilings to |new_layer_bounds|. |
| 50 // Returns true if we had at least one high res tiling synced. | 49 // Returns true if we had at least one high res tiling synced. |
| 51 bool SyncTilings(const PictureLayerTilingSet& other, | 50 bool SyncTilings(const PictureLayerTilingSet& other, |
| 52 const gfx::Size& new_layer_bounds, | 51 const gfx::Size& new_layer_bounds, |
| 53 const Region& layer_invalidation, | 52 const Region& layer_invalidation, |
| 54 float minimum_contents_scale); | 53 float minimum_contents_scale); |
| 55 | 54 |
| 56 gfx::Size layer_bounds() const { return layer_bounds_; } | 55 PictureLayerTiling* AddTiling(float contents_scale, |
| 57 | 56 const gfx::Size& layer_bounds); |
| 58 PictureLayerTiling* AddTiling(float contents_scale); | |
| 59 size_t num_tilings() const { return tilings_.size(); } | 57 size_t num_tilings() const { return tilings_.size(); } |
| 60 int NumHighResTilings() const; | 58 int NumHighResTilings() const; |
| 61 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; } | 59 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; } |
| 62 const PictureLayerTiling* tiling_at(size_t idx) const { | 60 const PictureLayerTiling* tiling_at(size_t idx) const { |
| 63 return tilings_[idx]; | 61 return tilings_[idx]; |
| 64 } | 62 } |
| 65 | 63 |
| 66 PictureLayerTiling* TilingAtScale(float scale) const; | 64 PictureLayerTiling* TilingAtScale(float scale) const; |
| 67 | 65 |
| 68 // Remove all tilings. | 66 // Remove all tilings. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 Region::Iterator region_iter_; | 117 Region::Iterator region_iter_; |
| 120 }; | 118 }; |
| 121 | 119 |
| 122 void AsValueInto(base::debug::TracedValue* array) const; | 120 void AsValueInto(base::debug::TracedValue* array) const; |
| 123 size_t GPUMemoryUsageInBytes() const; | 121 size_t GPUMemoryUsageInBytes() const; |
| 124 | 122 |
| 125 TilingRange GetTilingRange(TilingRangeType type) const; | 123 TilingRange GetTilingRange(TilingRangeType type) const; |
| 126 | 124 |
| 127 private: | 125 private: |
| 128 PictureLayerTilingClient* client_; | 126 PictureLayerTilingClient* client_; |
| 129 gfx::Size layer_bounds_; | |
| 130 ScopedPtrVector<PictureLayerTiling> tilings_; | 127 ScopedPtrVector<PictureLayerTiling> tilings_; |
| 131 | 128 |
| 132 friend class Iterator; | 129 friend class Iterator; |
| 133 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); | 130 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); |
| 134 }; | 131 }; |
| 135 | 132 |
| 136 } // namespace cc | 133 } // namespace cc |
| 137 | 134 |
| 138 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ | 135 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ |
| OLD | NEW |