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/resources/raster_source.h" | 9 #include "cc/resources/raster_source.h" |
10 #include "cc/resources/tile_draw_info.h" | 10 #include "cc/resources/tile_draw_info.h" |
11 #include "cc/resources/tile_priority.h" | |
12 #include "ui/gfx/geometry/rect.h" | 11 #include "ui/gfx/geometry/rect.h" |
13 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
14 | 13 |
15 namespace cc { | 14 namespace cc { |
16 | 15 |
17 class TileManager; | 16 class TileManager; |
| 17 struct TilePriority; |
18 | 18 |
19 class CC_EXPORT Tile { | 19 class CC_EXPORT Tile { |
20 public: | 20 public: |
21 class CC_EXPORT Deleter { | 21 class CC_EXPORT Deleter { |
22 public: | 22 public: |
23 void operator()(Tile* tile) const; | 23 void operator()(Tile* tile) const; |
24 }; | 24 }; |
25 | 25 |
26 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0 }; | 26 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0 }; |
27 | 27 |
28 typedef uint64 Id; | 28 typedef uint64 Id; |
29 | 29 |
30 Id id() const { | 30 Id id() const { |
31 return id_; | 31 return id_; |
32 } | 32 } |
33 | 33 |
34 RasterSource* raster_source() { return raster_source_.get(); } | 34 RasterSource* raster_source() { return raster_source_.get(); } |
35 | 35 |
36 const RasterSource* raster_source() const { return raster_source_.get(); } | 36 const RasterSource* raster_source() const { return raster_source_.get(); } |
37 | 37 |
38 const TilePriority& priority() const { return priority_; } | |
39 | |
40 void set_priority(const TilePriority& priority) { priority_ = priority; } | |
41 | |
42 // TODO(vmpstr): Move this to the iterators. | |
43 void set_is_occluded(bool is_occluded) { is_occluded_ = is_occluded; } | |
44 bool is_occluded() const { return is_occluded_; } | |
45 | |
46 // TODO(vmpstr): Move this to the iterators. | 38 // TODO(vmpstr): Move this to the iterators. |
47 bool required_for_activation() const { return required_for_activation_; } | 39 bool required_for_activation() const { return required_for_activation_; } |
48 void set_required_for_activation(bool is_required) { | 40 void set_required_for_activation(bool is_required) { |
49 required_for_activation_ = is_required; | 41 required_for_activation_ = is_required; |
50 } | 42 } |
51 bool required_for_draw() const { return required_for_draw_; } | 43 bool required_for_draw() const { return required_for_draw_; } |
52 void set_required_for_draw(bool is_required) { | 44 void set_required_for_draw(bool is_required) { |
53 required_for_draw_ = is_required; | 45 required_for_draw_ = is_required; |
54 } | 46 } |
55 | 47 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 int flags); | 106 int flags); |
115 ~Tile(); | 107 ~Tile(); |
116 | 108 |
117 bool HasRasterTask() const { return !!raster_task_.get(); } | 109 bool HasRasterTask() const { return !!raster_task_.get(); } |
118 | 110 |
119 TileManager* tile_manager_; | 111 TileManager* tile_manager_; |
120 scoped_refptr<RasterSource> raster_source_; | 112 scoped_refptr<RasterSource> raster_source_; |
121 gfx::Size desired_texture_size_; | 113 gfx::Size desired_texture_size_; |
122 gfx::Rect content_rect_; | 114 gfx::Rect content_rect_; |
123 float contents_scale_; | 115 float contents_scale_; |
124 bool is_occluded_; | |
125 | 116 |
126 TilePriority priority_; | |
127 TileDrawInfo draw_info_; | 117 TileDrawInfo draw_info_; |
128 | 118 |
129 int layer_id_; | 119 int layer_id_; |
130 int source_frame_number_; | 120 int source_frame_number_; |
131 int flags_; | 121 int flags_; |
132 int tiling_i_index_; | 122 int tiling_i_index_; |
133 int tiling_j_index_; | 123 int tiling_j_index_; |
134 bool required_for_activation_ : 1; | 124 bool required_for_activation_ : 1; |
135 bool required_for_draw_ : 1; | 125 bool required_for_draw_ : 1; |
136 | 126 |
137 Id id_; | 127 Id id_; |
138 static Id s_next_id_; | 128 static Id s_next_id_; |
139 | 129 |
140 unsigned scheduled_priority_; | 130 unsigned scheduled_priority_; |
141 | 131 |
142 scoped_refptr<RasterTask> raster_task_; | 132 scoped_refptr<RasterTask> raster_task_; |
143 | 133 |
144 DISALLOW_COPY_AND_ASSIGN(Tile); | 134 DISALLOW_COPY_AND_ASSIGN(Tile); |
145 }; | 135 }; |
146 | 136 |
147 using ScopedTilePtr = scoped_ptr<Tile, Tile::Deleter>; | 137 using ScopedTilePtr = scoped_ptr<Tile, Tile::Deleter>; |
148 | 138 |
149 } // namespace cc | 139 } // namespace cc |
150 | 140 |
151 #endif // CC_RESOURCES_TILE_H_ | 141 #endif // CC_RESOURCES_TILE_H_ |
OLD | NEW |