| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 64 |
| 65 bool required_for_activation() const { | 65 bool required_for_activation() const { |
| 66 return priority_[PENDING_TREE].required_for_activation; | 66 return priority_[PENDING_TREE].required_for_activation; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void SetIsOccluded(WhichTree tree, bool occluded); |
| 70 |
| 69 bool use_picture_analysis() const { | 71 bool use_picture_analysis() const { |
| 70 return !!(flags_ & USE_PICTURE_ANALYSIS); | 72 return !!(flags_ & USE_PICTURE_ANALYSIS); |
| 71 } | 73 } |
| 72 | 74 |
| 73 bool NeedsRasterForMode(RasterMode mode) const { | 75 bool NeedsRasterForMode(RasterMode mode) const { |
| 74 return !managed_state_.tile_versions[mode].IsReadyToDraw(); | 76 return !managed_state_.tile_versions[mode].IsReadyToDraw(); |
| 75 } | 77 } |
| 76 | 78 |
| 77 bool HasResources() const { | 79 bool HasResources() const { |
| 78 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { | 80 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 RasterMode DetermineOverallRasterMode() const; | 127 RasterMode DetermineOverallRasterMode() const; |
| 126 | 128 |
| 127 // Functionality used in tests. | 129 // Functionality used in tests. |
| 128 RasterMode GetRasterModeForTesting() const { | 130 RasterMode GetRasterModeForTesting() const { |
| 129 return managed_state().raster_mode; | 131 return managed_state().raster_mode; |
| 130 } | 132 } |
| 131 ManagedTileState::TileVersion& GetTileVersionForTesting(RasterMode mode) { | 133 ManagedTileState::TileVersion& GetTileVersionForTesting(RasterMode mode) { |
| 132 return managed_state_.tile_versions[mode]; | 134 return managed_state_.tile_versions[mode]; |
| 133 } | 135 } |
| 134 | 136 |
| 135 void set_is_occluded(bool is_occluded) { is_occluded_ = is_occluded; } | |
| 136 bool is_occluded() const { return is_occluded_; } | |
| 137 | |
| 138 private: | 137 private: |
| 139 friend class TileManager; | 138 friend class TileManager; |
| 140 friend class PrioritizedTileSet; | 139 friend class PrioritizedTileSet; |
| 141 friend class FakeTileManager; | 140 friend class FakeTileManager; |
| 142 friend class BinComparator; | 141 friend class BinComparator; |
| 143 friend class FakePictureLayerImpl; | 142 friend class FakePictureLayerImpl; |
| 144 | 143 |
| 145 // Methods called by by tile manager. | 144 // Methods called by by tile manager. |
| 146 Tile(TileManager* tile_manager, | 145 Tile(TileManager* tile_manager, |
| 147 PicturePileImpl* picture_pile, | 146 PicturePileImpl* picture_pile, |
| 148 const gfx::Size& tile_size, | 147 const gfx::Size& tile_size, |
| 149 const gfx::Rect& content_rect, | 148 const gfx::Rect& content_rect, |
| 150 const gfx::Rect& opaque_rect, | 149 const gfx::Rect& opaque_rect, |
| 151 float contents_scale, | 150 float contents_scale, |
| 152 int layer_id, | 151 int layer_id, |
| 153 int source_frame_number, | 152 int source_frame_number, |
| 154 int flags); | 153 int flags); |
| 155 ~Tile(); | 154 ~Tile(); |
| 156 | 155 |
| 157 ManagedTileState& managed_state() { return managed_state_; } | 156 ManagedTileState& managed_state() { return managed_state_; } |
| 158 const ManagedTileState& managed_state() const { return managed_state_; } | 157 const ManagedTileState& managed_state() const { return managed_state_; } |
| 159 RasterMode DetermineRasterModeForResolution(TileResolution resolution) const; | 158 RasterMode DetermineRasterModeForResolution(TileResolution resolution) const; |
| 160 | 159 |
| 161 TileManager* tile_manager_; | 160 TileManager* tile_manager_; |
| 162 scoped_refptr<PicturePileImpl> picture_pile_; | 161 scoped_refptr<PicturePileImpl> picture_pile_; |
| 163 gfx::Rect tile_size_; | 162 gfx::Rect tile_size_; |
| 164 gfx::Rect content_rect_; | 163 gfx::Rect content_rect_; |
| 165 float contents_scale_; | 164 float contents_scale_; |
| 166 gfx::Rect opaque_rect_; | 165 gfx::Rect opaque_rect_; |
| 167 bool is_occluded_; | |
| 168 | 166 |
| 169 TilePriority priority_[NUM_TREES]; | 167 TilePriority priority_[NUM_TREES]; |
| 170 ManagedTileState managed_state_; | 168 ManagedTileState managed_state_; |
| 171 int layer_id_; | 169 int layer_id_; |
| 172 int source_frame_number_; | 170 int source_frame_number_; |
| 173 int flags_; | 171 int flags_; |
| 174 | 172 |
| 175 Id id_; | 173 Id id_; |
| 176 static Id s_next_id_; | 174 static Id s_next_id_; |
| 177 | 175 |
| 178 DISALLOW_COPY_AND_ASSIGN(Tile); | 176 DISALLOW_COPY_AND_ASSIGN(Tile); |
| 179 }; | 177 }; |
| 180 | 178 |
| 181 } // namespace cc | 179 } // namespace cc |
| 182 | 180 |
| 183 #endif // CC_RESOURCES_TILE_H_ | 181 #endif // CC_RESOURCES_TILE_H_ |
| OLD | NEW |