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 "cc/base/ref_counted_managed.h" | 9 #include "cc/base/ref_counted_managed.h" |
10 #include "cc/resources/raster_source.h" | 10 #include "cc/resources/raster_source.h" |
11 #include "cc/resources/tile_draw_info.h" | 11 #include "cc/resources/tile_draw_info.h" |
12 #include "cc/resources/tile_priority.h" | |
13 #include "ui/gfx/geometry/rect.h" | 12 #include "ui/gfx/geometry/rect.h" |
14 #include "ui/gfx/geometry/size.h" | 13 #include "ui/gfx/geometry/size.h" |
15 | 14 |
16 namespace cc { | 15 namespace cc { |
17 | 16 |
18 class TileManager; | 17 class TileManager; |
| 18 struct TilePriority; |
19 | 19 |
20 class CC_EXPORT Tile : public RefCountedManaged<Tile> { | 20 class CC_EXPORT Tile : public RefCountedManaged<Tile> { |
21 public: | 21 public: |
22 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0 }; | 22 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0 }; |
23 | 23 |
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 RasterSource* raster_source() { return raster_source_.get(); } | 30 RasterSource* raster_source() { return raster_source_.get(); } |
31 | 31 |
32 const RasterSource* raster_source() const { return raster_source_.get(); } | 32 const RasterSource* raster_source() const { return raster_source_.get(); } |
33 | 33 |
34 const TilePriority& priority() const { return priority_; } | |
35 | |
36 void set_priority(const TilePriority& priority) { priority_ = priority; } | |
37 | |
38 // TODO(vmpstr): Move this to the iterators. | |
39 void set_is_occluded(bool is_occluded) { is_occluded_ = is_occluded; } | |
40 bool is_occluded() const { return is_occluded_; } | |
41 | |
42 // TODO(vmpstr): Move this to the iterators. | 34 // TODO(vmpstr): Move this to the iterators. |
43 bool required_for_activation() const { return required_for_activation_; } | 35 bool required_for_activation() const { return required_for_activation_; } |
44 void set_required_for_activation(bool is_required) { | 36 void set_required_for_activation(bool is_required) { |
45 required_for_activation_ = is_required; | 37 required_for_activation_ = is_required; |
46 } | 38 } |
47 bool required_for_draw() const { return required_for_draw_; } | 39 bool required_for_draw() const { return required_for_draw_; } |
48 void set_required_for_draw(bool is_required) { | 40 void set_required_for_draw(bool is_required) { |
49 required_for_draw_ = is_required; | 41 required_for_draw_ = is_required; |
50 } | 42 } |
51 | 43 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 81 |
90 void set_tiling_index(int i, int j) { | 82 void set_tiling_index(int i, int j) { |
91 tiling_i_index_ = i; | 83 tiling_i_index_ = i; |
92 tiling_j_index_ = j; | 84 tiling_j_index_ = j; |
93 } | 85 } |
94 int tiling_i_index() const { return tiling_i_index_; } | 86 int tiling_i_index() const { return tiling_i_index_; } |
95 int tiling_j_index() const { return tiling_j_index_; } | 87 int tiling_j_index() const { return tiling_j_index_; } |
96 | 88 |
97 private: | 89 private: |
98 friend class TileManager; | 90 friend class TileManager; |
99 friend class PrioritizedTileSet; | |
100 friend class FakeTileManager; | 91 friend class FakeTileManager; |
101 friend class BinComparator; | |
102 friend class FakePictureLayerImpl; | 92 friend class FakePictureLayerImpl; |
103 | 93 |
104 // Methods called by by tile manager. | 94 // Methods called by by tile manager. |
105 Tile(TileManager* tile_manager, | 95 Tile(TileManager* tile_manager, |
106 RasterSource* raster_source, | 96 RasterSource* raster_source, |
107 const gfx::Size& desired_texture_size, | 97 const gfx::Size& desired_texture_size, |
108 const gfx::Rect& content_rect, | 98 const gfx::Rect& content_rect, |
109 float contents_scale, | 99 float contents_scale, |
110 int layer_id, | 100 int layer_id, |
111 int source_frame_number, | 101 int source_frame_number, |
112 int flags); | 102 int flags); |
113 ~Tile(); | 103 ~Tile(); |
114 | 104 |
115 bool HasRasterTask() const { return !!raster_task_.get(); } | 105 bool HasRasterTask() const { return !!raster_task_.get(); } |
116 | 106 |
117 scoped_refptr<RasterSource> raster_source_; | 107 scoped_refptr<RasterSource> raster_source_; |
118 gfx::Size desired_texture_size_; | 108 gfx::Size desired_texture_size_; |
119 gfx::Rect content_rect_; | 109 gfx::Rect content_rect_; |
120 float contents_scale_; | 110 float contents_scale_; |
121 bool is_occluded_; | |
122 | 111 |
123 TilePriority priority_; | |
124 TileDrawInfo draw_info_; | 112 TileDrawInfo draw_info_; |
125 | 113 |
126 int layer_id_; | 114 int layer_id_; |
127 int source_frame_number_; | 115 int source_frame_number_; |
128 int flags_; | 116 int flags_; |
129 int tiling_i_index_; | 117 int tiling_i_index_; |
130 int tiling_j_index_; | 118 int tiling_j_index_; |
131 bool required_for_activation_ : 1; | 119 bool required_for_activation_ : 1; |
132 bool required_for_draw_ : 1; | 120 bool required_for_draw_ : 1; |
133 | 121 |
134 Id id_; | 122 Id id_; |
135 static Id s_next_id_; | 123 static Id s_next_id_; |
136 | 124 |
137 unsigned scheduled_priority_; | 125 unsigned scheduled_priority_; |
138 | 126 |
139 scoped_refptr<RasterTask> raster_task_; | 127 scoped_refptr<RasterTask> raster_task_; |
140 | 128 |
141 DISALLOW_COPY_AND_ASSIGN(Tile); | 129 DISALLOW_COPY_AND_ASSIGN(Tile); |
142 }; | 130 }; |
143 | 131 |
144 } // namespace cc | 132 } // namespace cc |
145 | 133 |
146 #endif // CC_RESOURCES_TILE_H_ | 134 #endif // CC_RESOURCES_TILE_H_ |
OLD | NEW |