| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_RESOURCES_TILE_H_ | |
| 6 #define CC_RESOURCES_TILE_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "cc/resources/tile_draw_info.h" | |
| 10 #include "ui/gfx/geometry/rect.h" | |
| 11 #include "ui/gfx/geometry/size.h" | |
| 12 | |
| 13 namespace cc { | |
| 14 | |
| 15 class PrioritizedTile; | |
| 16 class TileManager; | |
| 17 struct TilePriority; | |
| 18 | |
| 19 class CC_EXPORT Tile { | |
| 20 public: | |
| 21 class CC_EXPORT Deleter { | |
| 22 public: | |
| 23 void operator()(Tile* tile) const; | |
| 24 }; | |
| 25 | |
| 26 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0 }; | |
| 27 | |
| 28 typedef uint64 Id; | |
| 29 | |
| 30 Id id() const { | |
| 31 return id_; | |
| 32 } | |
| 33 | |
| 34 // TODO(vmpstr): Move this to the iterators. | |
| 35 bool required_for_activation() const { return required_for_activation_; } | |
| 36 void set_required_for_activation(bool is_required) { | |
| 37 required_for_activation_ = is_required; | |
| 38 } | |
| 39 bool required_for_draw() const { return required_for_draw_; } | |
| 40 void set_required_for_draw(bool is_required) { | |
| 41 required_for_draw_ = is_required; | |
| 42 } | |
| 43 | |
| 44 bool use_picture_analysis() const { | |
| 45 return !!(flags_ & USE_PICTURE_ANALYSIS); | |
| 46 } | |
| 47 | |
| 48 void AsValueInto(base::trace_event::TracedValue* value) const; | |
| 49 | |
| 50 const TileDrawInfo& draw_info() const { return draw_info_; } | |
| 51 TileDrawInfo& draw_info() { return draw_info_; } | |
| 52 | |
| 53 float contents_scale() const { return contents_scale_; } | |
| 54 gfx::Rect content_rect() const { return content_rect_; } | |
| 55 | |
| 56 int layer_id() const { return layer_id_; } | |
| 57 | |
| 58 int source_frame_number() const { return source_frame_number_; } | |
| 59 | |
| 60 size_t GPUMemoryUsageInBytes() const; | |
| 61 | |
| 62 gfx::Size desired_texture_size() const { return desired_texture_size_; } | |
| 63 | |
| 64 void set_tiling_index(int i, int j) { | |
| 65 tiling_i_index_ = i; | |
| 66 tiling_j_index_ = j; | |
| 67 } | |
| 68 int tiling_i_index() const { return tiling_i_index_; } | |
| 69 int tiling_j_index() const { return tiling_j_index_; } | |
| 70 | |
| 71 private: | |
| 72 friend class TileManager; | |
| 73 friend class FakeTileManager; | |
| 74 friend class FakePictureLayerImpl; | |
| 75 | |
| 76 // Methods called by by tile manager. | |
| 77 Tile(TileManager* tile_manager, | |
| 78 const gfx::Size& desired_texture_size, | |
| 79 const gfx::Rect& content_rect, | |
| 80 float contents_scale, | |
| 81 int layer_id, | |
| 82 int source_frame_number, | |
| 83 int flags); | |
| 84 ~Tile(); | |
| 85 | |
| 86 bool HasRasterTask() const { return !!raster_task_.get(); } | |
| 87 | |
| 88 TileManager* tile_manager_; | |
| 89 gfx::Size desired_texture_size_; | |
| 90 gfx::Rect content_rect_; | |
| 91 float contents_scale_; | |
| 92 | |
| 93 TileDrawInfo draw_info_; | |
| 94 | |
| 95 int layer_id_; | |
| 96 int source_frame_number_; | |
| 97 int flags_; | |
| 98 int tiling_i_index_; | |
| 99 int tiling_j_index_; | |
| 100 bool required_for_activation_ : 1; | |
| 101 bool required_for_draw_ : 1; | |
| 102 | |
| 103 Id id_; | |
| 104 static Id s_next_id_; | |
| 105 | |
| 106 unsigned scheduled_priority_; | |
| 107 | |
| 108 scoped_refptr<RasterTask> raster_task_; | |
| 109 | |
| 110 DISALLOW_COPY_AND_ASSIGN(Tile); | |
| 111 }; | |
| 112 | |
| 113 using ScopedTilePtr = scoped_ptr<Tile, Tile::Deleter>; | |
| 114 | |
| 115 } // namespace cc | |
| 116 | |
| 117 #endif // CC_RESOURCES_TILE_H_ | |
| OLD | NEW |