| 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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 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(WhichTree tree) const { | 34 const TilePriority& priority() const { return priority_; } |
| 35 return priority_[tree]; | |
| 36 } | |
| 37 | 35 |
| 38 TilePriority priority_for_tree_priority(TreePriority tree_priority) const { | 36 void set_priority(const TilePriority& priority) { priority_ = priority; } |
| 39 switch (tree_priority) { | |
| 40 case SMOOTHNESS_TAKES_PRIORITY: | |
| 41 return priority_[ACTIVE_TREE]; | |
| 42 case NEW_CONTENT_TAKES_PRIORITY: | |
| 43 return priority_[PENDING_TREE]; | |
| 44 case SAME_PRIORITY_FOR_BOTH_TREES: | |
| 45 return combined_priority(); | |
| 46 default: | |
| 47 NOTREACHED(); | |
| 48 return TilePriority(); | |
| 49 } | |
| 50 } | |
| 51 | |
| 52 TilePriority combined_priority() const { | |
| 53 return TilePriority(priority_[ACTIVE_TREE], | |
| 54 priority_[PENDING_TREE]); | |
| 55 } | |
| 56 | |
| 57 void SetPriority(WhichTree tree, const TilePriority& priority) { | |
| 58 priority_[tree] = priority; | |
| 59 } | |
| 60 | 37 |
| 61 // TODO(vmpstr): Move this to the iterators. | 38 // TODO(vmpstr): Move this to the iterators. |
| 62 void set_is_occluded(WhichTree tree, bool is_occluded) { | 39 void set_is_occluded(bool is_occluded) { is_occluded_ = is_occluded; } |
| 63 is_occluded_[tree] = is_occluded; | 40 bool is_occluded() const { return is_occluded_; } |
| 64 } | |
| 65 | |
| 66 bool is_occluded(WhichTree tree) const { return is_occluded_[tree]; } | |
| 67 | |
| 68 void set_shared(bool is_shared) { is_shared_ = is_shared; } | |
| 69 bool is_shared() const { return is_shared_; } | |
| 70 | |
| 71 bool is_occluded_combined() const { | |
| 72 return is_occluded_[ACTIVE_TREE] && is_occluded_[PENDING_TREE]; | |
| 73 } | |
| 74 | 41 |
| 75 // TODO(vmpstr): Move this to the iterators. | 42 // TODO(vmpstr): Move this to the iterators. |
| 76 bool required_for_activation() const { return required_for_activation_; } | 43 bool required_for_activation() const { return required_for_activation_; } |
| 77 void set_required_for_activation(bool is_required) { | 44 void set_required_for_activation(bool is_required) { |
| 78 required_for_activation_ = is_required; | 45 required_for_activation_ = is_required; |
| 79 } | 46 } |
| 80 bool required_for_draw() const { return required_for_draw_; } | 47 bool required_for_draw() const { return required_for_draw_; } |
| 81 void set_required_for_draw(bool is_required) { | 48 void set_required_for_draw(bool is_required) { |
| 82 required_for_draw_ = is_required; | 49 required_for_draw_ = is_required; |
| 83 } | 50 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 101 | 68 |
| 102 TileDrawInfo& draw_info() { return draw_info_; } | 69 TileDrawInfo& draw_info() { return draw_info_; } |
| 103 | 70 |
| 104 float contents_scale() const { return contents_scale_; } | 71 float contents_scale() const { return contents_scale_; } |
| 105 gfx::Rect content_rect() const { return content_rect_; } | 72 gfx::Rect content_rect() const { return content_rect_; } |
| 106 | 73 |
| 107 int layer_id() const { return layer_id_; } | 74 int layer_id() const { return layer_id_; } |
| 108 | 75 |
| 109 int source_frame_number() const { return source_frame_number_; } | 76 int source_frame_number() const { return source_frame_number_; } |
| 110 | 77 |
| 111 void set_raster_source(scoped_refptr<RasterSource> raster_source) { | 78 void set_raster_source(RasterSource* raster_source) { |
| 112 DCHECK(raster_source->CoversRect(content_rect_, contents_scale_)) | 79 DCHECK(raster_source->CoversRect(content_rect_, contents_scale_)) |
| 113 << "Recording rect: " | 80 << "Recording rect: " |
| 114 << gfx::ScaleToEnclosingRect(content_rect_, 1.f / contents_scale_) | 81 << gfx::ScaleToEnclosingRect(content_rect_, 1.f / contents_scale_) |
| 115 .ToString(); | 82 .ToString(); |
| 116 raster_source_ = raster_source; | 83 raster_source_ = raster_source; |
| 117 } | 84 } |
| 118 | 85 |
| 119 size_t GPUMemoryUsageInBytes() const; | 86 size_t GPUMemoryUsageInBytes() const; |
| 120 | 87 |
| 121 gfx::Size desired_texture_size() const { return desired_texture_size_; } | 88 gfx::Size desired_texture_size() const { return desired_texture_size_; } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 144 int source_frame_number, | 111 int source_frame_number, |
| 145 int flags); | 112 int flags); |
| 146 ~Tile(); | 113 ~Tile(); |
| 147 | 114 |
| 148 bool HasRasterTask() const { return !!raster_task_.get(); } | 115 bool HasRasterTask() const { return !!raster_task_.get(); } |
| 149 | 116 |
| 150 scoped_refptr<RasterSource> raster_source_; | 117 scoped_refptr<RasterSource> raster_source_; |
| 151 gfx::Size desired_texture_size_; | 118 gfx::Size desired_texture_size_; |
| 152 gfx::Rect content_rect_; | 119 gfx::Rect content_rect_; |
| 153 float contents_scale_; | 120 float contents_scale_; |
| 154 bool is_occluded_[LAST_TREE + 1]; | 121 bool is_occluded_; |
| 155 | 122 |
| 156 TilePriority priority_[LAST_TREE + 1]; | 123 TilePriority priority_; |
| 157 TileDrawInfo draw_info_; | 124 TileDrawInfo draw_info_; |
| 158 | 125 |
| 159 int layer_id_; | 126 int layer_id_; |
| 160 int source_frame_number_; | 127 int source_frame_number_; |
| 161 int flags_; | 128 int flags_; |
| 162 int tiling_i_index_; | 129 int tiling_i_index_; |
| 163 int tiling_j_index_; | 130 int tiling_j_index_; |
| 164 bool is_shared_ : 1; | |
| 165 bool required_for_activation_ : 1; | 131 bool required_for_activation_ : 1; |
| 166 bool required_for_draw_ : 1; | 132 bool required_for_draw_ : 1; |
| 167 | 133 |
| 168 Id id_; | 134 Id id_; |
| 169 static Id s_next_id_; | 135 static Id s_next_id_; |
| 170 | 136 |
| 171 unsigned scheduled_priority_; | 137 unsigned scheduled_priority_; |
| 172 | 138 |
| 173 scoped_refptr<RasterTask> raster_task_; | 139 scoped_refptr<RasterTask> raster_task_; |
| 174 | 140 |
| 175 DISALLOW_COPY_AND_ASSIGN(Tile); | 141 DISALLOW_COPY_AND_ASSIGN(Tile); |
| 176 }; | 142 }; |
| 177 | 143 |
| 178 } // namespace cc | 144 } // namespace cc |
| 179 | 145 |
| 180 #endif // CC_RESOURCES_TILE_H_ | 146 #endif // CC_RESOURCES_TILE_H_ |
| OLD | NEW |