| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 void set_raster_source(scoped_refptr<RasterSource> raster_source) { | 120 void set_raster_source(scoped_refptr<RasterSource> raster_source) { |
| 121 DCHECK(raster_source->CoversRect(content_rect_, contents_scale_)) | 121 DCHECK(raster_source->CoversRect(content_rect_, contents_scale_)) |
| 122 << "Recording rect: " | 122 << "Recording rect: " |
| 123 << gfx::ScaleToEnclosingRect(content_rect_, 1.f / contents_scale_) | 123 << gfx::ScaleToEnclosingRect(content_rect_, 1.f / contents_scale_) |
| 124 .ToString(); | 124 .ToString(); |
| 125 raster_source_ = raster_source; | 125 raster_source_ = raster_source; |
| 126 } | 126 } |
| 127 | 127 |
| 128 size_t GPUMemoryUsageInBytes() const; | 128 size_t GPUMemoryUsageInBytes() const; |
| 129 | 129 |
| 130 gfx::Size size() const { return size_; } | 130 gfx::Size desired_texture_size() const { return desired_texture_size_; } |
| 131 | 131 |
| 132 void set_tiling_index(int i, int j) { | 132 void set_tiling_index(int i, int j) { |
| 133 tiling_i_index_ = i; | 133 tiling_i_index_ = i; |
| 134 tiling_j_index_ = j; | 134 tiling_j_index_ = j; |
| 135 } | 135 } |
| 136 int tiling_i_index() const { return tiling_i_index_; } | 136 int tiling_i_index() const { return tiling_i_index_; } |
| 137 int tiling_j_index() const { return tiling_j_index_; } | 137 int tiling_j_index() const { return tiling_j_index_; } |
| 138 | 138 |
| 139 private: | 139 private: |
| 140 friend class TileManager; | 140 friend class TileManager; |
| 141 friend class PrioritizedTileSet; | 141 friend class PrioritizedTileSet; |
| 142 friend class FakeTileManager; | 142 friend class FakeTileManager; |
| 143 friend class BinComparator; | 143 friend class BinComparator; |
| 144 friend class FakePictureLayerImpl; | 144 friend class FakePictureLayerImpl; |
| 145 | 145 |
| 146 // Methods called by by tile manager. | 146 // Methods called by by tile manager. |
| 147 Tile(TileManager* tile_manager, | 147 Tile(TileManager* tile_manager, |
| 148 RasterSource* raster_source, | 148 RasterSource* raster_source, |
| 149 const gfx::Size& tile_size, | 149 const gfx::Size& desired_texture_size, |
| 150 const gfx::Rect& content_rect, | 150 const gfx::Rect& content_rect, |
| 151 float contents_scale, | 151 float contents_scale, |
| 152 int layer_id, | 152 int layer_id, |
| 153 int source_frame_number, | 153 int source_frame_number, |
| 154 int flags); | 154 int flags); |
| 155 ~Tile(); | 155 ~Tile(); |
| 156 | 156 |
| 157 bool HasRasterTask() const { return !!raster_task_.get(); } | 157 bool HasRasterTask() const { return !!raster_task_.get(); } |
| 158 | 158 |
| 159 scoped_refptr<RasterSource> raster_source_; | 159 scoped_refptr<RasterSource> raster_source_; |
| 160 gfx::Size size_; | 160 gfx::Size desired_texture_size_; |
| 161 gfx::Rect content_rect_; | 161 gfx::Rect content_rect_; |
| 162 float contents_scale_; | 162 float contents_scale_; |
| 163 bool is_occluded_[NUM_TREES]; | 163 bool is_occluded_[NUM_TREES]; |
| 164 | 164 |
| 165 TilePriority priority_[NUM_TREES]; | 165 TilePriority priority_[NUM_TREES]; |
| 166 TileDrawInfo draw_info_; | 166 TileDrawInfo draw_info_; |
| 167 | 167 |
| 168 int layer_id_; | 168 int layer_id_; |
| 169 int source_frame_number_; | 169 int source_frame_number_; |
| 170 int flags_; | 170 int flags_; |
| 171 int tiling_i_index_; | 171 int tiling_i_index_; |
| 172 int tiling_j_index_; | 172 int tiling_j_index_; |
| 173 bool is_shared_ : 1; | 173 bool is_shared_ : 1; |
| 174 bool required_for_activation_ : 1; | 174 bool required_for_activation_ : 1; |
| 175 bool required_for_draw_ : 1; | 175 bool required_for_draw_ : 1; |
| 176 | 176 |
| 177 Id id_; | 177 Id id_; |
| 178 static Id s_next_id_; | 178 static Id s_next_id_; |
| 179 | 179 |
| 180 unsigned scheduled_priority_; | 180 unsigned scheduled_priority_; |
| 181 | 181 |
| 182 scoped_refptr<RasterTask> raster_task_; | 182 scoped_refptr<RasterTask> raster_task_; |
| 183 | 183 |
| 184 DISALLOW_COPY_AND_ASSIGN(Tile); | 184 DISALLOW_COPY_AND_ASSIGN(Tile); |
| 185 }; | 185 }; |
| 186 | 186 |
| 187 } // namespace cc | 187 } // namespace cc |
| 188 | 188 |
| 189 #endif // CC_RESOURCES_TILE_H_ | 189 #endif // CC_RESOURCES_TILE_H_ |
| OLD | NEW |