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