| 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(bool is_occluded) { is_occluded_ = is_occluded; } | 143 void set_is_occluded(bool is_occluded) { is_occluded_ = is_occluded; } |
| 132 bool is_occluded() const { return is_occluded_; } | 144 bool is_occluded() const { return is_occluded_; } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 147 float contents_scale, | 159 float contents_scale, |
| 148 int layer_id, | 160 int layer_id, |
| 149 int source_frame_number, | 161 int source_frame_number, |
| 150 int flags); | 162 int flags); |
| 151 ~Tile(); | 163 ~Tile(); |
| 152 | 164 |
| 153 ManagedTileState& managed_state() { return managed_state_; } | 165 ManagedTileState& managed_state() { return managed_state_; } |
| 154 const ManagedTileState& managed_state() const { return managed_state_; } | 166 const ManagedTileState& managed_state() const { return managed_state_; } |
| 155 RasterMode DetermineRasterModeForResolution(TileResolution resolution) const; | 167 RasterMode DetermineRasterModeForResolution(TileResolution resolution) const; |
| 156 | 168 |
| 157 TileManager* tile_manager_; | |
| 158 scoped_refptr<PicturePileImpl> picture_pile_; | 169 scoped_refptr<PicturePileImpl> picture_pile_; |
| 159 gfx::Rect tile_size_; | 170 gfx::Rect tile_size_; |
| 160 gfx::Rect content_rect_; | 171 gfx::Rect content_rect_; |
| 161 float contents_scale_; | 172 float contents_scale_; |
| 162 gfx::Rect opaque_rect_; | 173 gfx::Rect opaque_rect_; |
| 163 bool is_occluded_; | 174 bool is_occluded_; |
| 164 | 175 |
| 165 TilePriority priority_[NUM_TREES]; | 176 TilePriority priority_[NUM_TREES]; |
| 166 ManagedTileState managed_state_; | 177 ManagedTileState managed_state_; |
| 167 int layer_id_; | 178 int layer_id_; |
| 168 int source_frame_number_; | 179 int source_frame_number_; |
| 169 int flags_; | 180 int flags_; |
| 181 int tiling_i_index_; |
| 182 int tiling_j_index_; |
| 183 bool required_for_activation_; |
| 170 | 184 |
| 171 Id id_; | 185 Id id_; |
| 172 static Id s_next_id_; | 186 static Id s_next_id_; |
| 173 | 187 |
| 174 DISALLOW_COPY_AND_ASSIGN(Tile); | 188 DISALLOW_COPY_AND_ASSIGN(Tile); |
| 175 }; | 189 }; |
| 176 | 190 |
| 177 } // namespace cc | 191 } // namespace cc |
| 178 | 192 |
| 179 #endif // CC_RESOURCES_TILE_H_ | 193 #endif // CC_RESOURCES_TILE_H_ |
| OLD | NEW |