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