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_H_ | 5 #ifndef CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
6 #define CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 6 #define CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 static gfx::Rect ExpandRectEquallyToAreaBoundedBy( | 74 static gfx::Rect ExpandRectEquallyToAreaBoundedBy( |
75 gfx::Rect starting_rect, | 75 gfx::Rect starting_rect, |
76 int64 target_area, | 76 int64 target_area, |
77 gfx::Rect bounding_rect); | 77 gfx::Rect bounding_rect); |
78 | 78 |
79 // Iterate over all tiles to fill content_rect. Even if tiles are invalid | 79 // Iterate over all tiles to fill content_rect. Even if tiles are invalid |
80 // (i.e. no valid resource) this tiling should still iterate over them. | 80 // (i.e. no valid resource) this tiling should still iterate over them. |
81 // The union of all geometry_rect calls for each element iterated over should | 81 // The union of all geometry_rect calls for each element iterated over should |
82 // exactly equal content_rect and no two geometry_rects should intersect. | 82 // exactly equal content_rect and no two geometry_rects should intersect. |
83 class CC_EXPORT Iterator { | 83 class CC_EXPORT CoverageIterator { |
84 public: | 84 public: |
85 Iterator(); | 85 CoverageIterator(); |
86 Iterator(const PictureLayerTiling* tiling, | 86 CoverageIterator(const PictureLayerTiling* tiling, |
87 float dest_scale, | 87 float dest_scale, |
88 gfx::Rect rect); | 88 gfx::Rect rect); |
89 ~Iterator(); | 89 ~CoverageIterator(); |
90 | 90 |
91 // Visible rect (no borders), always in the space of content_rect, | 91 // Visible rect (no borders), always in the space of content_rect, |
92 // regardless of the contents scale of the tiling. | 92 // regardless of the contents scale of the tiling. |
93 gfx::Rect geometry_rect() const; | 93 gfx::Rect geometry_rect() const; |
94 // Texture rect (in texels) for geometry_rect | 94 // Texture rect (in texels) for geometry_rect |
95 gfx::RectF texture_rect() const; | 95 gfx::RectF texture_rect() const; |
96 gfx::Size texture_size() const; | 96 gfx::Size texture_size() const; |
97 | 97 |
98 // Full rect (including borders) of the current tile, always in the space | 98 // Full rect (including borders) of the current tile, always in the space |
99 // of content_rect, regardless of the contents scale of the tiling. | 99 // of content_rect, regardless of the contents scale of the tiling. |
100 gfx::Rect full_tile_geometry_rect() const; | 100 gfx::Rect full_tile_geometry_rect() const; |
101 | 101 |
102 Tile* operator->() const { return current_tile_; } | 102 Tile* operator->() const { return current_tile_; } |
103 Tile* operator*() const { return current_tile_; } | 103 Tile* operator*() const { return current_tile_; } |
104 | 104 |
105 Iterator& operator++(); | 105 CoverageIterator& operator++(); |
106 operator bool() const { return tile_j_ <= bottom_; } | 106 operator bool() const { return tile_j_ <= bottom_; } |
107 | 107 |
108 private: | 108 private: |
109 const PictureLayerTiling* tiling_; | 109 const PictureLayerTiling* tiling_; |
110 gfx::Rect dest_rect_; | 110 gfx::Rect dest_rect_; |
111 float dest_to_content_scale_; | 111 float dest_to_content_scale_; |
112 | 112 |
113 Tile* current_tile_; | 113 Tile* current_tile_; |
114 gfx::Rect current_geometry_rect_; | 114 gfx::Rect current_geometry_rect_; |
115 int tile_i_; | 115 int tile_i_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 float contents_scale_; | 161 float contents_scale_; |
162 gfx::Size layer_bounds_; | 162 gfx::Size layer_bounds_; |
163 gfx::Rect last_prioritized_rect_; | 163 gfx::Rect last_prioritized_rect_; |
164 // It is not legal to have a NULL tile in the tiles_ map. | 164 // It is not legal to have a NULL tile in the tiles_ map. |
165 TileMap tiles_; | 165 TileMap tiles_; |
166 TilingData tiling_data_; | 166 TilingData tiling_data_; |
167 TileResolution resolution_; | 167 TileResolution resolution_; |
168 int last_source_frame_number_; | 168 int last_source_frame_number_; |
169 double last_impl_frame_time_; | 169 double last_impl_frame_time_; |
170 | 170 |
171 friend class Iterator; | 171 friend class CoverageIterator; |
172 | 172 |
173 private: | 173 private: |
174 DISALLOW_ASSIGN(PictureLayerTiling); | 174 DISALLOW_ASSIGN(PictureLayerTiling); |
175 }; | 175 }; |
176 | 176 |
177 } // namespace cc | 177 } // namespace cc |
178 | 178 |
179 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ | 179 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_H_ |
OLD | NEW |