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/managed_tile_state.h" | |
11 #include "cc/resources/raster_source.h" | 10 #include "cc/resources/raster_source.h" |
| 11 #include "cc/resources/tile_draw_info.h" |
12 #include "cc/resources/tile_priority.h" | 12 #include "cc/resources/tile_priority.h" |
13 #include "ui/gfx/geometry/rect.h" | 13 #include "ui/gfx/geometry/rect.h" |
14 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
15 | 15 |
16 namespace cc { | 16 namespace cc { |
17 | 17 |
18 class TileManager; | 18 class TileManager; |
19 | 19 |
20 class CC_EXPORT Tile : public RefCountedManaged<Tile> { | 20 class CC_EXPORT Tile : public RefCountedManaged<Tile> { |
21 public: | 21 public: |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 } | 89 } |
90 bool required_for_draw() const { return required_for_draw_; } | 90 bool required_for_draw() const { return required_for_draw_; } |
91 void set_required_for_draw(bool is_required) { | 91 void set_required_for_draw(bool is_required) { |
92 required_for_draw_ = is_required; | 92 required_for_draw_ = is_required; |
93 } | 93 } |
94 | 94 |
95 bool use_picture_analysis() const { | 95 bool use_picture_analysis() const { |
96 return !!(flags_ & USE_PICTURE_ANALYSIS); | 96 return !!(flags_ & USE_PICTURE_ANALYSIS); |
97 } | 97 } |
98 | 98 |
99 bool HasResources() const { return managed_state_.draw_info.has_resource(); } | 99 bool HasResource() const { return draw_info_.has_resource(); } |
100 bool NeedsRaster() const { | 100 bool NeedsRaster() const { |
101 return managed_state_.draw_info.mode() == | 101 return draw_info_.mode() == TileDrawInfo::PICTURE_PILE_MODE || |
102 ManagedTileState::DrawInfo::PICTURE_PILE_MODE || | 102 !draw_info_.IsReadyToDraw(); |
103 !managed_state_.draw_info.IsReadyToDraw(); | |
104 } | 103 } |
105 | 104 |
106 void AsValueInto(base::debug::TracedValue* dict) const; | 105 void AsValueInto(base::debug::TracedValue* dict) const; |
107 | 106 |
108 inline bool IsReadyToDraw() const { | 107 inline bool IsReadyToDraw() const { return draw_info_.IsReadyToDraw(); } |
109 return managed_state_.draw_info.IsReadyToDraw(); | |
110 } | |
111 | 108 |
112 const ManagedTileState::DrawInfo& draw_info() const { | 109 const TileDrawInfo& draw_info() const { return draw_info_; } |
113 return managed_state_.draw_info; | |
114 } | |
115 | 110 |
116 ManagedTileState::DrawInfo& draw_info() { return managed_state_.draw_info; } | 111 TileDrawInfo& draw_info() { return draw_info_; } |
117 | 112 |
118 float contents_scale() const { return contents_scale_; } | 113 float contents_scale() const { return contents_scale_; } |
119 gfx::Rect content_rect() const { return content_rect_; } | 114 gfx::Rect content_rect() const { return content_rect_; } |
120 | 115 |
121 int layer_id() const { return layer_id_; } | 116 int layer_id() const { return layer_id_; } |
122 | 117 |
123 int source_frame_number() const { return source_frame_number_; } | 118 int source_frame_number() const { return source_frame_number_; } |
124 | 119 |
125 void set_raster_source(scoped_refptr<RasterSource> raster_source) { | 120 void set_raster_source(scoped_refptr<RasterSource> raster_source) { |
126 DCHECK(raster_source->CoversRect(content_rect_, contents_scale_)) | 121 DCHECK(raster_source->CoversRect(content_rect_, contents_scale_)) |
(...skipping 25 matching lines...) Expand all Loading... |
152 Tile(TileManager* tile_manager, | 147 Tile(TileManager* tile_manager, |
153 RasterSource* raster_source, | 148 RasterSource* raster_source, |
154 const gfx::Size& tile_size, | 149 const gfx::Size& tile_size, |
155 const gfx::Rect& content_rect, | 150 const gfx::Rect& content_rect, |
156 float contents_scale, | 151 float contents_scale, |
157 int layer_id, | 152 int layer_id, |
158 int source_frame_number, | 153 int source_frame_number, |
159 int flags); | 154 int flags); |
160 ~Tile(); | 155 ~Tile(); |
161 | 156 |
162 ManagedTileState& managed_state() { return managed_state_; } | 157 bool HasRasterTask() const { return !!raster_task_.get(); } |
163 const ManagedTileState& managed_state() const { return managed_state_; } | |
164 | |
165 bool HasRasterTask() const; | |
166 | 158 |
167 TileManager* tile_manager_; | 159 TileManager* tile_manager_; |
168 scoped_refptr<RasterSource> raster_source_; | 160 scoped_refptr<RasterSource> raster_source_; |
169 gfx::Size size_; | 161 gfx::Size size_; |
170 gfx::Rect content_rect_; | 162 gfx::Rect content_rect_; |
171 float contents_scale_; | 163 float contents_scale_; |
172 bool is_occluded_[NUM_TREES]; | 164 bool is_occluded_[NUM_TREES]; |
173 | 165 |
174 TilePriority priority_[NUM_TREES]; | 166 TilePriority priority_[NUM_TREES]; |
175 ManagedTileState managed_state_; | 167 TileDrawInfo draw_info_; |
| 168 |
176 int layer_id_; | 169 int layer_id_; |
177 int source_frame_number_; | 170 int source_frame_number_; |
178 int flags_; | 171 int flags_; |
179 bool is_shared_; | 172 bool is_shared_; |
180 int tiling_i_index_; | 173 int tiling_i_index_; |
181 int tiling_j_index_; | 174 int tiling_j_index_; |
182 bool required_for_activation_; | 175 bool required_for_activation_; |
183 bool required_for_draw_; | 176 bool required_for_draw_; |
184 | 177 |
185 Id id_; | 178 Id id_; |
186 static Id s_next_id_; | 179 static Id s_next_id_; |
187 | 180 |
| 181 unsigned scheduled_priority_; |
| 182 |
| 183 scoped_refptr<RasterTask> raster_task_; |
| 184 |
188 DISALLOW_COPY_AND_ASSIGN(Tile); | 185 DISALLOW_COPY_AND_ASSIGN(Tile); |
189 }; | 186 }; |
190 | 187 |
191 } // namespace cc | 188 } // namespace cc |
192 | 189 |
193 #endif // CC_RESOURCES_TILE_H_ | 190 #endif // CC_RESOURCES_TILE_H_ |
OLD | NEW |