| 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_TILE_H_ | 5 #ifndef CC_TILE_H_ |
| 6 #define CC_TILE_H_ | 6 #define CC_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/layer_tree_host_impl.h" | 11 #include "cc/layer_tree_host_impl.h" |
| 12 #include "cc/picture_pile_impl.h" | 12 #include "cc/picture_pile_impl.h" |
| 13 #include "cc/resource_provider.h" | |
| 14 #include "cc/tile_manager.h" | 13 #include "cc/tile_manager.h" |
| 15 #include "cc/tile_priority.h" | 14 #include "cc/tile_priority.h" |
| 16 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
| 17 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
| 18 | 17 |
| 19 namespace cc { | 18 namespace cc { |
| 20 | 19 |
| 21 class Tile; | 20 class Tile; |
| 22 | 21 |
| 23 class CC_EXPORT Tile : public base::RefCounted<Tile> { | 22 class CC_EXPORT Tile : public base::RefCounted<Tile> { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 44 priority_[PENDING_TREE]); | 43 priority_[PENDING_TREE]); |
| 45 } | 44 } |
| 46 | 45 |
| 47 void set_priority(WhichTree tree, const TilePriority& priority) { | 46 void set_priority(WhichTree tree, const TilePriority& priority) { |
| 48 tile_manager_->WillModifyTilePriority(this, tree, priority); | 47 tile_manager_->WillModifyTilePriority(this, tree, priority); |
| 49 priority_[tree] = priority; | 48 priority_[tree] = priority; |
| 50 } | 49 } |
| 51 | 50 |
| 52 scoped_ptr<base::Value> AsValue() const; | 51 scoped_ptr<base::Value> AsValue() const; |
| 53 | 52 |
| 54 // Returns 0 if not drawable. | 53 const TileDrawingInfo& drawing_info() const { |
| 55 ResourceProvider::ResourceId GetResourceId() const { | 54 return managed_state_.drawing_info; |
| 56 if (!managed_state_.resource) | 55 } |
| 57 return 0; | 56 TileDrawingInfo& drawing_info() { |
| 58 if (managed_state_.resource_is_being_initialized) | 57 return managed_state_.drawing_info; |
| 59 return 0; | |
| 60 | |
| 61 return managed_state_.resource->id(); | |
| 62 } | 58 } |
| 63 | 59 |
| 64 const gfx::Rect& opaque_rect() const { return opaque_rect_; } | 60 const gfx::Rect& opaque_rect() const { return opaque_rect_; } |
| 65 | 61 |
| 66 bool contents_swizzled() const { return managed_state_.contents_swizzled; } | |
| 67 | |
| 68 float contents_scale() const { return contents_scale_; } | 62 float contents_scale() const { return contents_scale_; } |
| 69 gfx::Rect content_rect() const { return content_rect_; } | 63 gfx::Rect content_rect() const { return content_rect_; } |
| 70 | 64 |
| 71 int layer_id() const { return layer_id_; } | 65 int layer_id() const { return layer_id_; } |
| 72 | 66 |
| 73 void set_picture_pile(scoped_refptr<PicturePileImpl> pile) { | 67 void set_picture_pile(scoped_refptr<PicturePileImpl> pile) { |
| 74 DCHECK(pile->CanRaster(contents_scale_, content_rect_)); | 68 DCHECK(pile->CanRaster(contents_scale_, content_rect_)); |
| 75 picture_pile_ = pile; | 69 picture_pile_ = pile; |
| 76 } | 70 } |
| 77 | 71 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 103 gfx::Rect opaque_rect_; | 97 gfx::Rect opaque_rect_; |
| 104 | 98 |
| 105 TilePriority priority_[NUM_BIN_PRIORITIES]; | 99 TilePriority priority_[NUM_BIN_PRIORITIES]; |
| 106 ManagedTileState managed_state_; | 100 ManagedTileState managed_state_; |
| 107 int layer_id_; | 101 int layer_id_; |
| 108 }; | 102 }; |
| 109 | 103 |
| 110 } // namespace cc | 104 } // namespace cc |
| 111 | 105 |
| 112 #endif // CC_TILE_H_ | 106 #endif // CC_TILE_H_ |
| OLD | NEW |