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/resources/managed_tile_state.h" | 11 #include "cc/resources/managed_tile_state.h" |
12 #include "cc/resources/picture_pile_impl.h" | 12 #include "cc/resources/picture_pile_impl.h" |
13 #include "cc/resources/tile_priority.h" | 13 #include "cc/resources/tile_priority.h" |
14 #include "cc/trees/layer_tree_host_impl.h" | 14 #include "cc/trees/layer_tree_host_impl.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 Tile; | 20 class Tile; |
21 class TileManager; | 21 class TileManager; |
22 | 22 |
23 class CC_EXPORT Tile : public base::RefCounted<Tile> { | 23 class CC_EXPORT Tile : public base::RefCounted<Tile> { |
24 public: | 24 public: |
25 Tile(TileManager* tile_manager, | 25 Tile(TileManager* tile_manager, |
26 PicturePileImpl* picture_pile, | 26 PicturePileImpl* picture_pile, |
27 gfx::Size tile_size, | 27 gfx::Size tile_size, |
28 GLenum format, | |
29 gfx::Rect content_rect, | 28 gfx::Rect content_rect, |
30 gfx::Rect opaque_rect, | 29 gfx::Rect opaque_rect, |
31 float contents_scale, | 30 float contents_scale, |
32 int layer_id); | 31 int layer_id); |
33 | 32 |
34 PicturePileImpl* picture_pile() { | 33 PicturePileImpl* picture_pile() { |
35 return picture_pile_.get(); | 34 return picture_pile_.get(); |
36 } | 35 } |
37 | 36 |
38 const TilePriority& priority(WhichTree tree) const { | 37 const TilePriority& priority(WhichTree tree) const { |
(...skipping 29 matching lines...) Expand all Loading... |
68 } | 67 } |
69 | 68 |
70 private: | 69 private: |
71 // Methods called by by tile manager. | 70 // Methods called by by tile manager. |
72 friend class TileManager; | 71 friend class TileManager; |
73 friend class BinComparator; | 72 friend class BinComparator; |
74 ManagedTileState& managed_state() { return managed_state_; } | 73 ManagedTileState& managed_state() { return managed_state_; } |
75 const ManagedTileState& managed_state() const { return managed_state_; } | 74 const ManagedTileState& managed_state() const { return managed_state_; } |
76 | 75 |
77 inline size_t bytes_consumed_if_allocated() const { | 76 inline size_t bytes_consumed_if_allocated() const { |
78 DCHECK(format_ == GL_RGBA); | |
79 return 4 * tile_size_.width() * tile_size_.height(); | 77 return 4 * tile_size_.width() * tile_size_.height(); |
80 } | 78 } |
81 | 79 |
82 | 80 |
83 // Normal private methods. | 81 // Normal private methods. |
84 friend class base::RefCounted<Tile>; | 82 friend class base::RefCounted<Tile>; |
85 ~Tile(); | 83 ~Tile(); |
86 | 84 |
87 TileManager* tile_manager_; | 85 TileManager* tile_manager_; |
88 scoped_refptr<PicturePileImpl> picture_pile_; | 86 scoped_refptr<PicturePileImpl> picture_pile_; |
89 gfx::Rect tile_size_; | 87 gfx::Rect tile_size_; |
90 GLenum format_; | |
91 gfx::Rect content_rect_; | 88 gfx::Rect content_rect_; |
92 float contents_scale_; | 89 float contents_scale_; |
93 gfx::Rect opaque_rect_; | 90 gfx::Rect opaque_rect_; |
94 | 91 |
95 TilePriority priority_[NUM_BIN_PRIORITIES]; | 92 TilePriority priority_[NUM_BIN_PRIORITIES]; |
96 ManagedTileState managed_state_; | 93 ManagedTileState managed_state_; |
97 int layer_id_; | 94 int layer_id_; |
98 | 95 |
99 DISALLOW_COPY_AND_ASSIGN(Tile); | 96 DISALLOW_COPY_AND_ASSIGN(Tile); |
100 }; | 97 }; |
101 | 98 |
102 } // namespace cc | 99 } // namespace cc |
103 | 100 |
104 #endif // CC_RESOURCES_TILE_H_ | 101 #endif // CC_RESOURCES_TILE_H_ |
OLD | NEW |