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_TILE_H_ | 5 #ifndef CC_RESOURCES_TILE_H_ |
6 #define CC_RESOURCES_TILE_H_ | 6 #define CC_RESOURCES_TILE_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 TilePriority priority_for_tree_priority(TreePriority tree_priority) const { | 43 TilePriority priority_for_tree_priority(TreePriority tree_priority) const { |
44 switch (tree_priority) { | 44 switch (tree_priority) { |
45 case SMOOTHNESS_TAKES_PRIORITY: | 45 case SMOOTHNESS_TAKES_PRIORITY: |
46 return priority_[ACTIVE_TREE]; | 46 return priority_[ACTIVE_TREE]; |
47 case NEW_CONTENT_TAKES_PRIORITY: | 47 case NEW_CONTENT_TAKES_PRIORITY: |
48 return priority_[PENDING_TREE]; | 48 return priority_[PENDING_TREE]; |
49 case SAME_PRIORITY_FOR_BOTH_TREES: | 49 case SAME_PRIORITY_FOR_BOTH_TREES: |
50 return combined_priority(); | 50 return combined_priority(); |
| 51 default: |
| 52 NOTREACHED(); |
| 53 return TilePriority(); |
51 } | 54 } |
52 NOTREACHED(); | |
53 return TilePriority(); | |
54 } | 55 } |
55 | 56 |
56 TilePriority combined_priority() const { | 57 TilePriority combined_priority() const { |
57 return TilePriority(priority_[ACTIVE_TREE], | 58 return TilePriority(priority_[ACTIVE_TREE], |
58 priority_[PENDING_TREE]); | 59 priority_[PENDING_TREE]); |
59 } | 60 } |
60 | 61 |
61 void SetPriority(WhichTree tree, const TilePriority& priority); | 62 void SetPriority(WhichTree tree, const TilePriority& priority); |
62 | 63 |
| 64 void set_is_occluded(WhichTree tree, bool is_occluded) { |
| 65 is_occluded_[tree] = is_occluded; |
| 66 } |
| 67 |
| 68 bool is_occluded(WhichTree tree) const { return is_occluded_[tree]; } |
| 69 |
| 70 bool is_occluded_for_tree_priority(TreePriority tree_priority) const { |
| 71 switch (tree_priority) { |
| 72 case SMOOTHNESS_TAKES_PRIORITY: |
| 73 return is_occluded_[ACTIVE_TREE]; |
| 74 case NEW_CONTENT_TAKES_PRIORITY: |
| 75 return is_occluded_[PENDING_TREE]; |
| 76 case SAME_PRIORITY_FOR_BOTH_TREES: |
| 77 return is_occluded_[ACTIVE_TREE] && is_occluded_[PENDING_TREE]; |
| 78 default: |
| 79 NOTREACHED(); |
| 80 return false; |
| 81 } |
| 82 } |
| 83 |
63 void MarkRequiredForActivation(); | 84 void MarkRequiredForActivation(); |
64 | 85 |
65 bool required_for_activation() const { | 86 bool required_for_activation() const { |
66 return priority_[PENDING_TREE].required_for_activation; | 87 return priority_[PENDING_TREE].required_for_activation; |
67 } | 88 } |
68 | 89 |
69 bool use_picture_analysis() const { | 90 bool use_picture_analysis() const { |
70 return !!(flags_ & USE_PICTURE_ANALYSIS); | 91 return !!(flags_ & USE_PICTURE_ANALYSIS); |
71 } | 92 } |
72 | 93 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 RasterMode DetermineOverallRasterMode() const; | 144 RasterMode DetermineOverallRasterMode() const; |
124 | 145 |
125 // Functionality used in tests. | 146 // Functionality used in tests. |
126 RasterMode GetRasterModeForTesting() const { | 147 RasterMode GetRasterModeForTesting() const { |
127 return managed_state().raster_mode; | 148 return managed_state().raster_mode; |
128 } | 149 } |
129 ManagedTileState::TileVersion& GetTileVersionForTesting(RasterMode mode) { | 150 ManagedTileState::TileVersion& GetTileVersionForTesting(RasterMode mode) { |
130 return managed_state_.tile_versions[mode]; | 151 return managed_state_.tile_versions[mode]; |
131 } | 152 } |
132 | 153 |
133 void set_is_occluded(WhichTree tree, bool is_occluded) { | |
134 is_occluded_[tree] = is_occluded; | |
135 } | |
136 | |
137 bool is_occluded(WhichTree tree) const { return is_occluded_[tree]; } | |
138 | |
139 private: | 154 private: |
140 friend class TileManager; | 155 friend class TileManager; |
141 friend class PrioritizedTileSet; | 156 friend class PrioritizedTileSet; |
142 friend class FakeTileManager; | 157 friend class FakeTileManager; |
143 friend class BinComparator; | 158 friend class BinComparator; |
144 friend class FakePictureLayerImpl; | 159 friend class FakePictureLayerImpl; |
145 | 160 |
146 // Methods called by by tile manager. | 161 // Methods called by by tile manager. |
147 Tile(TileManager* tile_manager, | 162 Tile(TileManager* tile_manager, |
148 PicturePileImpl* picture_pile, | 163 PicturePileImpl* picture_pile, |
(...skipping 26 matching lines...) Expand all Loading... |
175 | 190 |
176 Id id_; | 191 Id id_; |
177 static Id s_next_id_; | 192 static Id s_next_id_; |
178 | 193 |
179 DISALLOW_COPY_AND_ASSIGN(Tile); | 194 DISALLOW_COPY_AND_ASSIGN(Tile); |
180 }; | 195 }; |
181 | 196 |
182 } // namespace cc | 197 } // namespace cc |
183 | 198 |
184 #endif // CC_RESOURCES_TILE_H_ | 199 #endif // CC_RESOURCES_TILE_H_ |
OLD | NEW |