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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 case NEW_CONTENT_TAKES_PRIORITY: | 77 case NEW_CONTENT_TAKES_PRIORITY: |
78 return is_occluded_[PENDING_TREE]; | 78 return is_occluded_[PENDING_TREE]; |
79 case SAME_PRIORITY_FOR_BOTH_TREES: | 79 case SAME_PRIORITY_FOR_BOTH_TREES: |
80 return is_occluded_[ACTIVE_TREE] && is_occluded_[PENDING_TREE]; | 80 return is_occluded_[ACTIVE_TREE] && is_occluded_[PENDING_TREE]; |
81 default: | 81 default: |
82 NOTREACHED(); | 82 NOTREACHED(); |
83 return false; | 83 return false; |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 void MarkRequiredForActivation(); | 87 bool required_for_activation() const { return required_for_activation_; } |
88 | 88 void set_required_for_activation(bool is_required) { |
89 bool required_for_activation() const { | 89 required_for_activation_ = is_required; |
90 return priority_[PENDING_TREE].required_for_activation; | |
91 } | 90 } |
92 | 91 |
93 bool use_picture_analysis() const { | 92 bool use_picture_analysis() const { |
94 return !!(flags_ & USE_PICTURE_ANALYSIS); | 93 return !!(flags_ & USE_PICTURE_ANALYSIS); |
95 } | 94 } |
96 | 95 |
97 bool NeedsRasterForMode(RasterMode mode) const { | 96 bool NeedsRasterForMode(RasterMode mode) const { |
98 return !managed_state_.tile_versions[mode].IsReadyToDraw(); | 97 return managed_state_.tile_versions[mode].mode() == |
| 98 ManagedTileState::TileVersion::PICTURE_PILE_MODE || |
| 99 !managed_state_.tile_versions[mode].IsReadyToDraw(); |
99 } | 100 } |
100 | 101 |
101 bool HasResources() const { | 102 bool HasResources() const { |
102 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { | 103 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { |
103 if (managed_state_.tile_versions[mode].has_resource()) | 104 if (managed_state_.tile_versions[mode].has_resource()) |
104 return true; | 105 return true; |
105 } | 106 } |
106 return false; | 107 return false; |
107 } | 108 } |
108 | 109 |
(...skipping 30 matching lines...) Expand all Loading... |
139 picture_pile_ = pile; | 140 picture_pile_ = pile; |
140 } | 141 } |
141 | 142 |
142 size_t GPUMemoryUsageInBytes() const; | 143 size_t GPUMemoryUsageInBytes() const; |
143 | 144 |
144 gfx::Size size() const { return size_; } | 145 gfx::Size size() const { return size_; } |
145 | 146 |
146 RasterMode DetermineRasterModeForTree(WhichTree tree) const; | 147 RasterMode DetermineRasterModeForTree(WhichTree tree) const; |
147 RasterMode DetermineOverallRasterMode() const; | 148 RasterMode DetermineOverallRasterMode() const; |
148 | 149 |
| 150 void set_tiling_index(int i, int j) { |
| 151 tiling_i_index_ = i; |
| 152 tiling_j_index_ = j; |
| 153 } |
| 154 int tiling_i_index() const { return tiling_i_index_; } |
| 155 int tiling_j_index() const { return tiling_j_index_; } |
| 156 |
149 // Functionality used in tests. | 157 // Functionality used in tests. |
150 RasterMode GetRasterModeForTesting() const { | 158 RasterMode GetRasterModeForTesting() const { |
151 return managed_state().raster_mode; | 159 return managed_state().raster_mode; |
152 } | 160 } |
153 ManagedTileState::TileVersion& GetTileVersionForTesting(RasterMode mode) { | 161 ManagedTileState::TileVersion& GetTileVersionForTesting(RasterMode mode) { |
154 return managed_state_.tile_versions[mode]; | 162 return managed_state_.tile_versions[mode]; |
155 } | 163 } |
156 | 164 |
157 private: | 165 private: |
158 friend class TileManager; | 166 friend class TileManager; |
(...skipping 25 matching lines...) Expand all Loading... |
184 gfx::Rect content_rect_; | 192 gfx::Rect content_rect_; |
185 float contents_scale_; | 193 float contents_scale_; |
186 bool is_occluded_[NUM_TREES]; | 194 bool is_occluded_[NUM_TREES]; |
187 | 195 |
188 TilePriority priority_[NUM_TREES]; | 196 TilePriority priority_[NUM_TREES]; |
189 ManagedTileState managed_state_; | 197 ManagedTileState managed_state_; |
190 int layer_id_; | 198 int layer_id_; |
191 int source_frame_number_; | 199 int source_frame_number_; |
192 int flags_; | 200 int flags_; |
193 bool is_shared_; | 201 bool is_shared_; |
| 202 int tiling_i_index_; |
| 203 int tiling_j_index_; |
| 204 bool required_for_activation_; |
194 | 205 |
195 Id id_; | 206 Id id_; |
196 static Id s_next_id_; | 207 static Id s_next_id_; |
197 | 208 |
198 DISALLOW_COPY_AND_ASSIGN(Tile); | 209 DISALLOW_COPY_AND_ASSIGN(Tile); |
199 }; | 210 }; |
200 | 211 |
201 } // namespace cc | 212 } // namespace cc |
202 | 213 |
203 #endif // CC_RESOURCES_TILE_H_ | 214 #endif // CC_RESOURCES_TILE_H_ |
OLD | NEW |