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_PICTURE_LAYER_TILING_SET_H_ | 5 #ifndef CC_PICTURE_LAYER_TILING_SET_H_ |
6 #define CC_PICTURE_LAYER_TILING_SET_H_ | 6 #define CC_PICTURE_LAYER_TILING_SET_H_ |
7 | 7 |
8 #include "cc/picture_layer_tiling.h" | 8 #include "cc/picture_layer_tiling.h" |
9 #include "cc/region.h" | 9 #include "cc/region.h" |
10 #include "cc/scoped_ptr_vector.h" | 10 #include "cc/scoped_ptr_vector.h" |
11 #include "ui/gfx/size.h" | 11 #include "ui/gfx/size.h" |
12 | 12 |
13 namespace cc { | 13 namespace cc { |
14 | 14 |
15 class CC_EXPORT PictureLayerTilingSet { | 15 class CC_EXPORT PictureLayerTilingSet { |
16 public: | 16 public: |
17 PictureLayerTilingSet(PictureLayerTilingClient* client); | 17 PictureLayerTilingSet(PictureLayerTilingClient* client); |
18 ~PictureLayerTilingSet(); | 18 ~PictureLayerTilingSet(); |
19 | 19 |
20 // Shallow copies all data (except client and bounds from other). | 20 // Shallow copies all data (except client and bounds from other). |
21 void CloneAll( | 21 void CloneAll( |
22 const PictureLayerTilingSet& other, | 22 const PictureLayerTilingSet& other, |
23 const Region& invalidation); | 23 const Region& invalidation); |
24 void Clone(const PictureLayerTiling* tiling, const Region& invalidation); | 24 void Clone(const PictureLayerTiling* tiling, const Region& invalidation); |
25 | 25 |
26 void SetLayerBounds(gfx::Size layer_bounds); | 26 void SetLayerBounds(gfx::Size layer_bounds); |
27 gfx::Size LayerBounds() const; | 27 gfx::Size LayerBounds() const; |
28 | 28 |
29 const PictureLayerTiling* AddTiling( | 29 PictureLayerTiling* AddTiling( |
30 float contents_scale, | 30 float contents_scale, |
31 gfx::Size tile_size); | 31 gfx::Size tile_size); |
32 size_t num_tilings() const { return tilings_.size(); } | 32 size_t num_tilings() const { return tilings_.size(); } |
33 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; } | 33 PictureLayerTiling* tiling_at(size_t idx) { return tilings_[idx]; } |
34 | 34 |
35 // Remove all tilings. | |
36 void RemoveAll(); | |
danakj
2013/01/08 23:27:16
How about RemoveAllTilings() and RemoveTiling(Tili
enne (OOO)
2013/01/08 23:54:38
Done.
| |
37 | |
38 void Remove(PictureLayerTiling* tiling); | |
39 | |
40 // Remove all tiles, but keep all tilings. | |
35 void Reset(); | 41 void Reset(); |
danakj
2013/01/07 22:35:56
Maybe for separate CL, but this function name coul
enne (OOO)
2013/01/08 01:08:00
Which function? Reset does say what it does. I ca
danakj
2013/01/08 23:27:16
// Remove all tiles, but keep all tilings.
void Re
| |
36 | 42 |
37 void UpdateTilePriorities( | 43 void UpdateTilePriorities( |
38 WhichTree tree, | 44 WhichTree tree, |
39 const gfx::Size& device_viewport, | 45 const gfx::Size& device_viewport, |
40 float layer_content_scale_x, | 46 float layer_content_scale_x, |
41 float layer_content_scale_y, | 47 float layer_content_scale_y, |
42 const gfx::Transform& last_screen_transform, | 48 const gfx::Transform& last_screen_transform, |
43 const gfx::Transform& current_screen_transform, | 49 const gfx::Transform& current_screen_transform, |
44 double time_delta); | 50 double time_delta); |
45 | 51 |
46 // For a given rect, iterates through tiles that can fill it. If no | 52 // For a given rect, iterates through tiles that can fill it. If no |
47 // set of tiles with resources can fill the rect, then it will iterate | 53 // set of tiles with resources can fill the rect, then it will iterate |
48 // through null tiles with valid geometry_rect() until the rect is full. | 54 // through null tiles with valid geometry_rect() until the rect is full. |
49 // If all tiles have resources, the union of all geometry_rects will | 55 // If all tiles have resources, the union of all geometry_rects will |
50 // exactly fill rect with no overlap. | 56 // exactly fill rect with no overlap. |
51 class CC_EXPORT Iterator { | 57 class CC_EXPORT Iterator { |
52 public: | 58 public: |
53 Iterator( | 59 Iterator( |
54 const PictureLayerTilingSet* set, | 60 const PictureLayerTilingSet* set, |
55 float contents_scale, | 61 float contents_scale, |
56 gfx::Rect rect); | 62 gfx::Rect content_rect, |
63 float ideal_contents_scale); | |
57 ~Iterator(); | 64 ~Iterator(); |
58 | 65 |
59 // Visible rect (no borders), always in the space of rect, | 66 // Visible rect (no borders), always in the space of rect, |
60 // regardless of the relative contents scale of the tiling. | 67 // regardless of the relative contents scale of the tiling. |
61 gfx::Rect geometry_rect() const; | 68 gfx::Rect geometry_rect() const; |
62 // Texture rect (in texels) for geometry_rect | 69 // Texture rect (in texels) for geometry_rect |
63 gfx::RectF texture_rect() const; | 70 gfx::RectF texture_rect() const; |
64 // Texture size in texels | 71 // Texture size in texels |
65 gfx::Size texture_size() const; | 72 gfx::Size texture_size() const; |
66 | 73 |
67 Tile* operator->() const; | 74 Tile* operator->() const; |
68 Tile* operator*() const; | 75 Tile* operator*() const; |
69 | 76 |
70 Iterator& operator++(); | 77 Iterator& operator++(); |
71 operator bool() const; | 78 operator bool() const; |
72 | 79 |
80 PictureLayerTiling* CurrentTiling(); | |
81 | |
73 private: | 82 private: |
83 int NextTiling() const; | |
84 | |
74 const PictureLayerTilingSet* set_; | 85 const PictureLayerTilingSet* set_; |
75 float contents_scale_; | 86 float contents_scale_; |
87 float ideal_contents_scale_; | |
76 PictureLayerTiling::Iterator tiling_iter_; | 88 PictureLayerTiling::Iterator tiling_iter_; |
77 int current_tiling_; | 89 int current_tiling_; |
90 int ideal_tiling_; | |
78 | 91 |
79 Region current_region_; | 92 Region current_region_; |
80 Region missing_region_; | 93 Region missing_region_; |
81 Region::Iterator region_iter_; | 94 Region::Iterator region_iter_; |
82 }; | 95 }; |
83 | 96 |
84 private: | 97 private: |
85 PictureLayerTilingClient* client_; | 98 PictureLayerTilingClient* client_; |
86 gfx::Size layer_bounds_; | 99 gfx::Size layer_bounds_; |
87 ScopedPtrVector<PictureLayerTiling> tilings_; | 100 ScopedPtrVector<PictureLayerTiling> tilings_; |
88 Region invalidation_; | 101 Region invalidation_; |
89 | 102 |
90 friend class Iterator; | 103 friend class Iterator; |
91 }; | 104 }; |
92 | 105 |
93 } // namespace cc | 106 } // namespace cc |
94 | 107 |
95 #endif // CC_PICTURE_LAYER_TILING_SET_H_ | 108 #endif // CC_PICTURE_LAYER_TILING_SET_H_ |
OLD | NEW |