| 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> |
| 9 |
| 8 #include "cc/base/region.h" | 10 #include "cc/base/region.h" |
| 9 #include "cc/base/scoped_ptr_vector.h" | 11 #include "cc/base/scoped_ptr_vector.h" |
| 10 #include "cc/resources/picture_layer_tiling.h" | 12 #include "cc/resources/picture_layer_tiling.h" |
| 11 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
| 12 | 14 |
| 13 namespace base { | 15 namespace base { |
| 14 namespace debug { | 16 namespace debug { |
| 15 class TracedValue; | 17 class TracedValue; |
| 16 } | 18 } |
| 17 } | 19 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 59 |
| 58 PictureLayerTiling* AddTiling(float contents_scale, | 60 PictureLayerTiling* AddTiling(float contents_scale, |
| 59 const gfx::Size& layer_bounds); | 61 const gfx::Size& layer_bounds); |
| 60 size_t num_tilings() const { return tilings_.size(); } | 62 size_t num_tilings() const { return tilings_.size(); } |
| 61 int NumHighResTilings() const; | 63 int NumHighResTilings() const; |
| 62 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; } | 64 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; } |
| 63 const PictureLayerTiling* tiling_at(size_t idx) const { | 65 const PictureLayerTiling* tiling_at(size_t idx) const { |
| 64 return tilings_[idx]; | 66 return tilings_[idx]; |
| 65 } | 67 } |
| 66 | 68 |
| 67 PictureLayerTiling* TilingAtScale(float scale) const; | 69 PictureLayerTiling* FindTilingWithScale(float scale) const; |
| 70 PictureLayerTiling* FindTilingWithResolution(TileResolution resolution) const; |
| 71 |
| 72 void MarkAllTilingsNonIdeal(); |
| 73 |
| 74 // If a tiling exists whose scale is within |snap_to_existing_tiling_ratio| |
| 75 // ratio of |start_scale|, then return that tiling's scale. Otherwise, return |
| 76 // |start_scale|. If multiple tilings match the criteria, return the one with |
| 77 // the least ratio to |start_scale|. |
| 78 float GetSnappedContentsScale(float start_scale, |
| 79 float snap_to_existing_tiling_ratio) const; |
| 80 |
| 81 // Returns the maximum contents scale of all tilings, or 0 if no tilings |
| 82 // exist. |
| 83 float GetMaximumContentsScale() const; |
| 68 | 84 |
| 69 // Remove all tilings. | 85 // Remove all tilings. |
| 70 void RemoveAllTilings(); | 86 void RemoveAllTilings(); |
| 71 | 87 |
| 72 // Remove one tiling. | 88 // Remove one tiling. |
| 73 void Remove(PictureLayerTiling* tiling); | 89 void Remove(PictureLayerTiling* tiling); |
| 90 void RemoveTilingWithScale(float scale); |
| 74 | 91 |
| 75 // Remove all tiles; keep all tilings. | 92 // Remove all tiles; keep all tilings. |
| 76 void RemoveAllTiles(); | 93 void RemoveAllTiles(); |
| 77 | 94 |
| 78 // Update the rects and priorities for tiles based on the given information. | 95 // Update the rects and priorities for tiles based on the given information. |
| 79 bool UpdateTilePriorities(const gfx::Rect& required_rect_in_layer_space, | 96 bool UpdateTilePriorities(const gfx::Rect& required_rect_in_layer_space, |
| 80 float ideal_contents_scale, | 97 float ideal_contents_scale, |
| 81 double current_frame_time_in_seconds, | 98 double current_frame_time_in_seconds, |
| 82 const Occlusion& occlusion_in_layer_space, | 99 const Occlusion& occlusion_in_layer_space, |
| 83 bool can_require_tiles_for_activation); | 100 bool can_require_tiles_for_activation); |
| 84 | 101 |
| 102 void GetAllTilesForTracing(std::set<const Tile*>* tiles) const; |
| 103 |
| 85 // For a given rect, iterates through tiles that can fill it. If no | 104 // For a given rect, iterates through tiles that can fill it. If no |
| 86 // set of tiles with resources can fill the rect, then it will iterate | 105 // set of tiles with resources can fill the rect, then it will iterate |
| 87 // through null tiles with valid geometry_rect() until the rect is full. | 106 // through null tiles with valid geometry_rect() until the rect is full. |
| 88 // If all tiles have resources, the union of all geometry_rects will | 107 // If all tiles have resources, the union of all geometry_rects will |
| 89 // exactly fill rect with no overlap. | 108 // exactly fill rect with no overlap. |
| 90 class CC_EXPORT CoverageIterator { | 109 class CC_EXPORT CoverageIterator { |
| 91 public: | 110 public: |
| 92 CoverageIterator(const PictureLayerTilingSet* set, | 111 CoverageIterator(const PictureLayerTilingSet* set, |
| 93 float contents_scale, | 112 float contents_scale, |
| 94 const gfx::Rect& content_rect, | 113 const gfx::Rect& content_rect, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 PictureLayerTilingClient* client_; | 157 PictureLayerTilingClient* client_; |
| 139 ScopedPtrVector<PictureLayerTiling> tilings_; | 158 ScopedPtrVector<PictureLayerTiling> tilings_; |
| 140 | 159 |
| 141 friend class Iterator; | 160 friend class Iterator; |
| 142 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); | 161 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); |
| 143 }; | 162 }; |
| 144 | 163 |
| 145 } // namespace cc | 164 } // namespace cc |
| 146 | 165 |
| 147 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ | 166 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ |
| OLD | NEW |