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 MarkRequiredForActivation(); | 63 void set_required_for_activation(bool is_required); |
64 | 64 |
65 bool required_for_activation() const { | 65 bool required_for_activation() const { return required_for_activation_; } |
66 return priority_[PENDING_TREE].required_for_activation; | |
67 } | |
68 | 66 |
69 bool use_picture_analysis() const { | 67 bool use_picture_analysis() const { |
70 return !!(flags_ & USE_PICTURE_ANALYSIS); | 68 return !!(flags_ & USE_PICTURE_ANALYSIS); |
71 } | 69 } |
72 | 70 |
73 bool NeedsRasterForMode(RasterMode mode) const { | 71 bool NeedsRasterForMode(RasterMode mode) const { |
74 return !managed_state_.tile_versions[mode].IsReadyToDraw(); | 72 return !managed_state_.tile_versions[mode].IsReadyToDraw(); |
75 } | 73 } |
76 | 74 |
77 bool HasResources() const { | 75 bool HasResources() const { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 picture_pile_ = pile; | 111 picture_pile_ = pile; |
114 } | 112 } |
115 | 113 |
116 size_t GPUMemoryUsageInBytes() const; | 114 size_t GPUMemoryUsageInBytes() const; |
117 | 115 |
118 gfx::Size size() const { return tile_size_.size(); } | 116 gfx::Size size() const { return tile_size_.size(); } |
119 | 117 |
120 RasterMode DetermineRasterModeForTree(WhichTree tree) const; | 118 RasterMode DetermineRasterModeForTree(WhichTree tree) const; |
121 RasterMode DetermineOverallRasterMode() const; | 119 RasterMode DetermineOverallRasterMode() const; |
122 | 120 |
| 121 void set_tiling_index(int row, int column) { |
| 122 tiling_i_index_ = row; |
| 123 tiling_j_index_ = column; |
| 124 } |
| 125 |
| 126 int tiling_i_index() const { |
| 127 DCHECK_GE(tiling_i_index_, 0); |
| 128 return tiling_i_index_; |
| 129 } |
| 130 int tiling_j_index() const { |
| 131 DCHECK_GE(tiling_j_index_, 0); |
| 132 return tiling_j_index_; |
| 133 } |
| 134 |
123 // Functionality used in tests. | 135 // Functionality used in tests. |
124 RasterMode GetRasterModeForTesting() const { | 136 RasterMode GetRasterModeForTesting() const { |
125 return managed_state().raster_mode; | 137 return managed_state().raster_mode; |
126 } | 138 } |
127 ManagedTileState::TileVersion& GetTileVersionForTesting(RasterMode mode) { | 139 ManagedTileState::TileVersion& GetTileVersionForTesting(RasterMode mode) { |
128 return managed_state_.tile_versions[mode]; | 140 return managed_state_.tile_versions[mode]; |
129 } | 141 } |
130 | 142 |
131 void set_is_occluded(WhichTree tree, bool is_occluded) { | 143 void set_is_occluded(WhichTree tree, bool is_occluded) { |
132 is_occluded_[tree] = is_occluded; | 144 is_occluded_[tree] = is_occluded; |
(...skipping 17 matching lines...) Expand all Loading... |
150 float contents_scale, | 162 float contents_scale, |
151 int layer_id, | 163 int layer_id, |
152 int source_frame_number, | 164 int source_frame_number, |
153 int flags); | 165 int flags); |
154 ~Tile(); | 166 ~Tile(); |
155 | 167 |
156 ManagedTileState& managed_state() { return managed_state_; } | 168 ManagedTileState& managed_state() { return managed_state_; } |
157 const ManagedTileState& managed_state() const { return managed_state_; } | 169 const ManagedTileState& managed_state() const { return managed_state_; } |
158 RasterMode DetermineRasterModeForResolution(TileResolution resolution) const; | 170 RasterMode DetermineRasterModeForResolution(TileResolution resolution) const; |
159 | 171 |
160 TileManager* tile_manager_; | |
161 scoped_refptr<PicturePileImpl> picture_pile_; | 172 scoped_refptr<PicturePileImpl> picture_pile_; |
162 gfx::Rect tile_size_; | 173 gfx::Rect tile_size_; |
163 gfx::Rect content_rect_; | 174 gfx::Rect content_rect_; |
164 float contents_scale_; | 175 float contents_scale_; |
165 gfx::Rect opaque_rect_; | 176 gfx::Rect opaque_rect_; |
166 bool is_occluded_[NUM_TREES]; | 177 bool is_occluded_[NUM_TREES]; |
167 | 178 |
168 TilePriority priority_[NUM_TREES]; | 179 TilePriority priority_[NUM_TREES]; |
169 ManagedTileState managed_state_; | 180 ManagedTileState managed_state_; |
170 int layer_id_; | 181 int layer_id_; |
171 int source_frame_number_; | 182 int source_frame_number_; |
172 int flags_; | 183 int flags_; |
| 184 int tiling_i_index_; |
| 185 int tiling_j_index_; |
| 186 bool required_for_activation_; |
173 | 187 |
174 Id id_; | 188 Id id_; |
175 static Id s_next_id_; | 189 static Id s_next_id_; |
176 | 190 |
177 DISALLOW_COPY_AND_ASSIGN(Tile); | 191 DISALLOW_COPY_AND_ASSIGN(Tile); |
178 }; | 192 }; |
179 | 193 |
180 } // namespace cc | 194 } // namespace cc |
181 | 195 |
182 #endif // CC_RESOURCES_TILE_H_ | 196 #endif // CC_RESOURCES_TILE_H_ |
OLD | NEW |