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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 NOTREACHED(); | 51 NOTREACHED(); |
52 return TilePriority(); | 52 return TilePriority(); |
53 } | 53 } |
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 priority_[tree] = priority; |
| 63 } |
62 | 64 |
| 65 // TODO(vmpstr): Move this to the iterators. |
63 void set_is_occluded(WhichTree tree, bool is_occluded) { | 66 void set_is_occluded(WhichTree tree, bool is_occluded) { |
64 is_occluded_[tree] = is_occluded; | 67 is_occluded_[tree] = is_occluded; |
65 } | 68 } |
66 | 69 |
67 bool is_occluded(WhichTree tree) const { return is_occluded_[tree]; } | 70 bool is_occluded(WhichTree tree) const { return is_occluded_[tree]; } |
68 | 71 |
69 void set_shared(bool is_shared) { is_shared_ = is_shared; } | 72 void set_shared(bool is_shared) { is_shared_ = is_shared; } |
70 bool is_shared() const { return is_shared_; } | 73 bool is_shared() const { return is_shared_; } |
71 | 74 |
72 bool is_occluded_for_tree_priority(TreePriority tree_priority) const { | 75 bool is_occluded_for_tree_priority(TreePriority tree_priority) const { |
73 switch (tree_priority) { | 76 switch (tree_priority) { |
74 case SMOOTHNESS_TAKES_PRIORITY: | 77 case SMOOTHNESS_TAKES_PRIORITY: |
75 return is_occluded_[ACTIVE_TREE]; | 78 return is_occluded_[ACTIVE_TREE]; |
76 case NEW_CONTENT_TAKES_PRIORITY: | 79 case NEW_CONTENT_TAKES_PRIORITY: |
77 return is_occluded_[PENDING_TREE]; | 80 return is_occluded_[PENDING_TREE]; |
78 case SAME_PRIORITY_FOR_BOTH_TREES: | 81 case SAME_PRIORITY_FOR_BOTH_TREES: |
79 return is_occluded_[ACTIVE_TREE] && is_occluded_[PENDING_TREE]; | 82 return is_occluded_[ACTIVE_TREE] && is_occluded_[PENDING_TREE]; |
80 default: | 83 default: |
81 NOTREACHED(); | 84 NOTREACHED(); |
82 return false; | 85 return false; |
83 } | 86 } |
84 } | 87 } |
85 | 88 |
86 void MarkRequiredForActivation(); | 89 // TODO(vmpstr): Move this to the iterators. |
87 | 90 bool required_for_activation() const { return required_for_activation_; } |
88 bool required_for_activation() const { | 91 void set_required_for_activation(bool is_required) { |
89 return priority_[PENDING_TREE].required_for_activation; | 92 required_for_activation_ = is_required; |
90 } | 93 } |
91 | 94 |
92 bool use_picture_analysis() const { | 95 bool use_picture_analysis() const { |
93 return !!(flags_ & USE_PICTURE_ANALYSIS); | 96 return !!(flags_ & USE_PICTURE_ANALYSIS); |
94 } | 97 } |
95 | 98 |
96 bool HasResources() const { return managed_state_.draw_info.has_resource(); } | 99 bool HasResources() const { return managed_state_.draw_info.has_resource(); } |
| 100 bool NeedsRaster() const { |
| 101 return managed_state_.draw_info.mode() == |
| 102 ManagedTileState::DrawInfo::PICTURE_PILE_MODE || |
| 103 !managed_state_.draw_info.IsReadyToDraw(); |
| 104 } |
97 | 105 |
98 void AsValueInto(base::debug::TracedValue* dict) const; | 106 void AsValueInto(base::debug::TracedValue* dict) const; |
99 | 107 |
100 inline bool IsReadyToDraw() const { | 108 inline bool IsReadyToDraw() const { |
101 return managed_state_.draw_info.IsReadyToDraw(); | 109 return managed_state_.draw_info.IsReadyToDraw(); |
102 } | 110 } |
103 | 111 |
104 const ManagedTileState::DrawInfo& draw_info() const { | 112 const ManagedTileState::DrawInfo& draw_info() const { |
105 return managed_state_.draw_info; | 113 return managed_state_.draw_info; |
106 } | 114 } |
(...skipping 12 matching lines...) Expand all Loading... |
119 << "Recording rect: " | 127 << "Recording rect: " |
120 << gfx::ScaleToEnclosingRect(content_rect_, 1.f / contents_scale_) | 128 << gfx::ScaleToEnclosingRect(content_rect_, 1.f / contents_scale_) |
121 .ToString(); | 129 .ToString(); |
122 picture_pile_ = pile; | 130 picture_pile_ = pile; |
123 } | 131 } |
124 | 132 |
125 size_t GPUMemoryUsageInBytes() const; | 133 size_t GPUMemoryUsageInBytes() const; |
126 | 134 |
127 gfx::Size size() const { return size_; } | 135 gfx::Size size() const { return size_; } |
128 | 136 |
| 137 void set_tiling_index(int i, int j) { |
| 138 tiling_i_index_ = i; |
| 139 tiling_j_index_ = j; |
| 140 } |
| 141 int tiling_i_index() const { return tiling_i_index_; } |
| 142 int tiling_j_index() const { return tiling_j_index_; } |
| 143 |
129 private: | 144 private: |
130 friend class TileManager; | 145 friend class TileManager; |
131 friend class PrioritizedTileSet; | 146 friend class PrioritizedTileSet; |
132 friend class FakeTileManager; | 147 friend class FakeTileManager; |
133 friend class BinComparator; | 148 friend class BinComparator; |
134 friend class FakePictureLayerImpl; | 149 friend class FakePictureLayerImpl; |
135 | 150 |
136 // Methods called by by tile manager. | 151 // Methods called by by tile manager. |
137 Tile(TileManager* tile_manager, | 152 Tile(TileManager* tile_manager, |
138 PicturePileImpl* picture_pile, | 153 PicturePileImpl* picture_pile, |
(...skipping 16 matching lines...) Expand all Loading... |
155 gfx::Rect content_rect_; | 170 gfx::Rect content_rect_; |
156 float contents_scale_; | 171 float contents_scale_; |
157 bool is_occluded_[NUM_TREES]; | 172 bool is_occluded_[NUM_TREES]; |
158 | 173 |
159 TilePriority priority_[NUM_TREES]; | 174 TilePriority priority_[NUM_TREES]; |
160 ManagedTileState managed_state_; | 175 ManagedTileState managed_state_; |
161 int layer_id_; | 176 int layer_id_; |
162 int source_frame_number_; | 177 int source_frame_number_; |
163 int flags_; | 178 int flags_; |
164 bool is_shared_; | 179 bool is_shared_; |
| 180 int tiling_i_index_; |
| 181 int tiling_j_index_; |
| 182 bool required_for_activation_; |
165 | 183 |
166 Id id_; | 184 Id id_; |
167 static Id s_next_id_; | 185 static Id s_next_id_; |
168 | 186 |
169 DISALLOW_COPY_AND_ASSIGN(Tile); | 187 DISALLOW_COPY_AND_ASSIGN(Tile); |
170 }; | 188 }; |
171 | 189 |
172 } // namespace cc | 190 } // namespace cc |
173 | 191 |
174 #endif // CC_RESOURCES_TILE_H_ | 192 #endif // CC_RESOURCES_TILE_H_ |
OLD | NEW |