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