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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 bool store_screen_space_quads_on_tiles, | 65 bool store_screen_space_quads_on_tiles, |
66 size_t max_tiles_for_interest_area); | 66 size_t max_tiles_for_interest_area); |
67 | 67 |
68 void DidBecomeActive(); | 68 void DidBecomeActive(); |
69 | 69 |
70 // For a given rect, iterates through tiles that can fill it. If no | 70 // For a given rect, iterates through tiles that can fill it. If no |
71 // set of tiles with resources can fill the rect, then it will iterate | 71 // set of tiles with resources can fill the rect, then it will iterate |
72 // through null tiles with valid geometry_rect() until the rect is full. | 72 // through null tiles with valid geometry_rect() until the rect is full. |
73 // If all tiles have resources, the union of all geometry_rects will | 73 // If all tiles have resources, the union of all geometry_rects will |
74 // exactly fill rect with no overlap. | 74 // exactly fill rect with no overlap. |
75 class CC_EXPORT Iterator { | 75 class CC_EXPORT CoverageIterator { |
76 public: | 76 public: |
77 Iterator(const PictureLayerTilingSet* set, | 77 CoverageIterator(const PictureLayerTilingSet* set, |
78 float contents_scale, | 78 float contents_scale, |
79 gfx::Rect content_rect, | 79 gfx::Rect content_rect, |
80 float ideal_contents_scale); | 80 float ideal_contents_scale); |
81 ~Iterator(); | 81 ~CoverageIterator(); |
82 | 82 |
83 // Visible rect (no borders), always in the space of rect, | 83 // Visible rect (no borders), always in the space of rect, |
84 // regardless of the relative contents scale of the tiling. | 84 // regardless of the relative contents scale of the tiling. |
85 gfx::Rect geometry_rect() const; | 85 gfx::Rect geometry_rect() const; |
86 // Texture rect (in texels) for geometry_rect | 86 // Texture rect (in texels) for geometry_rect |
87 gfx::RectF texture_rect() const; | 87 gfx::RectF texture_rect() const; |
88 // Texture size in texels | 88 // Texture size in texels |
89 gfx::Size texture_size() const; | 89 gfx::Size texture_size() const; |
90 | 90 |
91 Tile* operator->() const; | 91 Tile* operator->() const; |
92 Tile* operator*() const; | 92 Tile* operator*() const; |
93 | 93 |
94 Iterator& operator++(); | 94 CoverageIterator& operator++(); |
95 operator bool() const; | 95 operator bool() const; |
96 | 96 |
97 PictureLayerTiling* CurrentTiling(); | 97 PictureLayerTiling* CurrentTiling(); |
98 | 98 |
99 private: | 99 private: |
100 int NextTiling() const; | 100 int NextTiling() const; |
101 | 101 |
102 const PictureLayerTilingSet* set_; | 102 const PictureLayerTilingSet* set_; |
103 float contents_scale_; | 103 float contents_scale_; |
104 float ideal_contents_scale_; | 104 float ideal_contents_scale_; |
105 PictureLayerTiling::Iterator tiling_iter_; | 105 PictureLayerTiling::CoverageIterator tiling_iter_; |
106 int current_tiling_; | 106 int current_tiling_; |
107 int ideal_tiling_; | 107 int ideal_tiling_; |
108 | 108 |
109 Region current_region_; | 109 Region current_region_; |
110 Region missing_region_; | 110 Region missing_region_; |
111 Region::Iterator region_iter_; | 111 Region::Iterator region_iter_; |
112 }; | 112 }; |
113 | 113 |
114 scoped_ptr<base::Value> AsValue() const; | 114 scoped_ptr<base::Value> AsValue() const; |
115 | 115 |
116 private: | 116 private: |
117 PictureLayerTilingClient* client_; | 117 PictureLayerTilingClient* client_; |
118 gfx::Size layer_bounds_; | 118 gfx::Size layer_bounds_; |
119 ScopedPtrVector<PictureLayerTiling> tilings_; | 119 ScopedPtrVector<PictureLayerTiling> tilings_; |
120 | 120 |
121 friend class Iterator; | 121 friend class Iterator; |
122 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); | 122 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); |
123 }; | 123 }; |
124 | 124 |
125 } // namespace cc | 125 } // namespace cc |
126 | 126 |
127 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ | 127 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ |
OLD | NEW |