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