| 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 RasterSource* raster_source); |
| 40 |
| 38 ~PictureLayerTilingSet(); | 41 ~PictureLayerTilingSet(); |
| 39 | 42 |
| 40 void SetClient(PictureLayerTilingClient* client); | 43 void SetClient(PictureLayerTilingClient* client); |
| 41 const PictureLayerTilingClient* client() const { return client_; } | 44 const PictureLayerTilingClient* client() const { return client_; } |
| 42 | 45 |
| 43 void RemoveTilesInRegion(const Region& region); | 46 void RemoveTilesInRegion(const Region& region); |
| 44 | 47 |
| 45 // Make this set of tilings match the same set of content scales from |other|. | 48 // 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 | 49 // Delete any tilings that don't meet |minimum_contents_scale|. Recreate |
| 47 // any tiles that intersect |layer_invalidation|. Update the size of all | 50 // any tiles that intersect |layer_invalidation|. Update the size of all |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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 void SetRasterSource(RasterSource* raster_source); |
| 79 |
| 75 // For a given rect, iterates through tiles that can fill it. If no | 80 // 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 | 81 // 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. | 82 // 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 | 83 // If all tiles have resources, the union of all geometry_rects will |
| 79 // exactly fill rect with no overlap. | 84 // exactly fill rect with no overlap. |
| 80 class CC_EXPORT CoverageIterator { | 85 class CC_EXPORT CoverageIterator { |
| 81 public: | 86 public: |
| 82 CoverageIterator(const PictureLayerTilingSet* set, | 87 CoverageIterator(const PictureLayerTilingSet* set, |
| 83 float contents_scale, | 88 float contents_scale, |
| 84 const gfx::Rect& content_rect, | 89 const gfx::Rect& content_rect, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 Region missing_region_; | 121 Region missing_region_; |
| 117 Region::Iterator region_iter_; | 122 Region::Iterator region_iter_; |
| 118 }; | 123 }; |
| 119 | 124 |
| 120 void AsValueInto(base::debug::TracedValue* array) const; | 125 void AsValueInto(base::debug::TracedValue* array) const; |
| 121 size_t GPUMemoryUsageInBytes() const; | 126 size_t GPUMemoryUsageInBytes() const; |
| 122 | 127 |
| 123 TilingRange GetTilingRange(TilingRangeType type) const; | 128 TilingRange GetTilingRange(TilingRangeType type) const; |
| 124 | 129 |
| 125 private: | 130 private: |
| 131 PictureLayerTilingSet(PictureLayerTilingClient* client, |
| 132 RasterSource* raster_source); |
| 133 |
| 126 PictureLayerTilingClient* client_; | 134 PictureLayerTilingClient* client_; |
| 127 ScopedPtrVector<PictureLayerTiling> tilings_; | 135 ScopedPtrVector<PictureLayerTiling> tilings_; |
| 136 RasterSource* raster_source_; |
| 128 | 137 |
| 129 friend class Iterator; | 138 friend class Iterator; |
| 130 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); | 139 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); |
| 131 }; | 140 }; |
| 132 | 141 |
| 133 } // namespace cc | 142 } // namespace cc |
| 134 | 143 |
| 135 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ | 144 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ |
| OLD | NEW |