| 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" |
| 11 #include "cc/base/ref_counted_managed.h" | 11 #include "cc/base/ref_counted_managed.h" |
| 12 #include "cc/resources/managed_tile_state.h" | 12 #include "cc/resources/managed_tile_state.h" |
| 13 #include "cc/resources/raster_mode.h" | 13 #include "cc/resources/raster_mode.h" |
| 14 #include "cc/resources/tile_priority.h" | 14 #include "cc/resources/tile_bundle.h" |
| 15 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
| 16 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
| 17 | 17 |
| 18 namespace cc { | 18 namespace cc { |
| 19 | 19 |
| 20 class PicturePileImpl; | 20 class PicturePileImpl; |
| 21 | 21 |
| 22 class CC_EXPORT Tile : public RefCountedManaged<Tile> { | 22 class CC_EXPORT Tile : public RefCountedManaged<Tile> { |
| 23 public: | 23 public: |
| 24 typedef uint64 Id; | 24 typedef uint64 Id; |
| 25 | 25 |
| 26 Id id() const { | 26 Id id() const { |
| 27 return id_; | 27 return id_; |
| 28 } | 28 } |
| 29 | 29 |
| 30 PicturePileImpl* picture_pile() { | 30 PicturePileImpl* picture_pile() { |
| 31 return picture_pile_.get(); | 31 return picture_pile_.get(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 const PicturePileImpl* picture_pile() const { | 34 const PicturePileImpl* picture_pile() const { |
| 35 return picture_pile_.get(); | 35 return picture_pile_.get(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 const TilePriority& priority(WhichTree tree) const { | |
| 39 return priority_[tree]; | |
| 40 } | |
| 41 | |
| 42 TilePriority combined_priority() const { | |
| 43 return TilePriority(priority_[ACTIVE_TREE], | |
| 44 priority_[PENDING_TREE]); | |
| 45 } | |
| 46 | |
| 47 void SetPriority(WhichTree tree, const TilePriority& priority); | |
| 48 | |
| 49 void MarkRequiredForActivation(); | 38 void MarkRequiredForActivation(); |
| 50 | 39 |
| 51 bool required_for_activation() const { | 40 bool required_for_activation() const { |
| 52 return priority_[PENDING_TREE].required_for_activation; | 41 return required_for_activation_; |
| 53 } | 42 } |
| 54 | 43 |
| 55 void set_can_use_lcd_text(bool can_use_lcd_text) { | 44 void set_can_use_lcd_text(bool can_use_lcd_text) { |
| 56 can_use_lcd_text_ = can_use_lcd_text; | 45 can_use_lcd_text_ = can_use_lcd_text; |
| 57 } | 46 } |
| 58 | 47 |
| 59 bool can_use_lcd_text() const { | 48 bool can_use_lcd_text() const { |
| 60 return can_use_lcd_text_; | 49 return can_use_lcd_text_; |
| 61 } | 50 } |
| 62 | 51 |
| 52 bool is_visible() const { |
| 53 return is_visible_; |
| 54 } |
| 55 |
| 56 void set_is_visible(bool is_visible) { |
| 57 is_visible_ = is_visible; |
| 58 } |
| 59 |
| 63 scoped_ptr<base::Value> AsValue() const; | 60 scoped_ptr<base::Value> AsValue() const; |
| 64 | 61 |
| 65 inline bool IsReadyToDraw() const { | 62 inline bool IsReadyToDraw() const { |
| 66 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { | 63 for (int mode = 0; mode < NUM_RASTER_MODES; ++mode) { |
| 67 if (managed_state_.tile_versions[mode].IsReadyToDraw()) | 64 if (managed_state_.tile_versions[mode].IsReadyToDraw()) |
| 68 return true; | 65 return true; |
| 69 } | 66 } |
| 70 return false; | 67 return false; |
| 71 } | 68 } |
| 72 | 69 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 ManagedTileState& managed_state() { return managed_state_; } | 124 ManagedTileState& managed_state() { return managed_state_; } |
| 128 const ManagedTileState& managed_state() const { return managed_state_; } | 125 const ManagedTileState& managed_state() const { return managed_state_; } |
| 129 | 126 |
| 130 TileManager* tile_manager_; | 127 TileManager* tile_manager_; |
| 131 scoped_refptr<PicturePileImpl> picture_pile_; | 128 scoped_refptr<PicturePileImpl> picture_pile_; |
| 132 gfx::Rect tile_size_; | 129 gfx::Rect tile_size_; |
| 133 gfx::Rect content_rect_; | 130 gfx::Rect content_rect_; |
| 134 float contents_scale_; | 131 float contents_scale_; |
| 135 gfx::Rect opaque_rect_; | 132 gfx::Rect opaque_rect_; |
| 136 | 133 |
| 137 TilePriority priority_[NUM_TREES]; | |
| 138 ManagedTileState managed_state_; | 134 ManagedTileState managed_state_; |
| 139 int layer_id_; | 135 int layer_id_; |
| 140 int source_frame_number_; | 136 int source_frame_number_; |
| 141 bool can_use_lcd_text_; | 137 bool can_use_lcd_text_; |
| 138 bool required_for_activation_; |
| 139 bool is_visible_; |
| 142 | 140 |
| 143 Id id_; | 141 Id id_; |
| 144 static Id s_next_id_; | 142 static Id s_next_id_; |
| 145 | 143 |
| 146 DISALLOW_COPY_AND_ASSIGN(Tile); | 144 DISALLOW_COPY_AND_ASSIGN(Tile); |
| 147 }; | 145 }; |
| 148 | 146 |
| 149 } // namespace cc | 147 } // namespace cc |
| 150 | 148 |
| 151 #endif // CC_RESOURCES_TILE_H_ | 149 #endif // CC_RESOURCES_TILE_H_ |
| OLD | NEW |