| 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_TILES_TILE_H_ | 5 #ifndef CC_TILES_TILE_H_ |
| 6 #define CC_TILES_TILE_H_ | 6 #define CC_TILES_TILE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "cc/raster/tile_task.h" | 13 #include "cc/raster/tile_task.h" |
| 14 #include "cc/tiles/tile_draw_info.h" | 14 #include "cc/tiles/tile_draw_info.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
| 17 | 17 |
| 18 namespace cc { | 18 namespace cc { |
| 19 | 19 |
| 20 class PictureLayerTiling; | 20 class PictureLayerTiling; |
| 21 class TileManager; | 21 class TileManager; |
| 22 | 22 |
| 23 class CC_EXPORT Tile { | 23 class CC_EXPORT Tile { |
| 24 public: | 24 public: |
| 25 class CC_EXPORT Deleter { | |
| 26 public: | |
| 27 void operator()(Tile* tile) const; | |
| 28 }; | |
| 29 | |
| 30 class CC_EXPORT CreateInfo { | 25 class CC_EXPORT CreateInfo { |
| 31 public: | 26 public: |
| 32 const PictureLayerTiling* tiling; | 27 const PictureLayerTiling* tiling; |
| 33 int tiling_i_index; | 28 int tiling_i_index; |
| 34 int tiling_j_index; | 29 int tiling_j_index; |
| 35 gfx::Rect enclosing_layer_rect; | 30 gfx::Rect enclosing_layer_rect; |
| 36 gfx::Rect content_rect; | 31 gfx::Rect content_rect; |
| 37 gfx::SizeF raster_scales; | 32 gfx::SizeF raster_scales; |
| 38 | 33 |
| 39 CreateInfo(const PictureLayerTiling* tiling, | 34 CreateInfo(const PictureLayerTiling* tiling, |
| 40 int tiling_i_index, | 35 int tiling_i_index, |
| 41 int tiling_j_index, | 36 int tiling_j_index, |
| 42 const gfx::Rect& enclosing_layer_rect, | 37 const gfx::Rect& enclosing_layer_rect, |
| 43 const gfx::Rect& content_rect, | 38 const gfx::Rect& content_rect, |
| 44 const gfx::SizeF& raster_scales) | 39 const gfx::SizeF& raster_scales) |
| 45 : tiling(tiling), | 40 : tiling(tiling), |
| 46 tiling_i_index(tiling_i_index), | 41 tiling_i_index(tiling_i_index), |
| 47 tiling_j_index(tiling_j_index), | 42 tiling_j_index(tiling_j_index), |
| 48 enclosing_layer_rect(enclosing_layer_rect), | 43 enclosing_layer_rect(enclosing_layer_rect), |
| 49 content_rect(content_rect), | 44 content_rect(content_rect), |
| 50 raster_scales(raster_scales) {} | 45 raster_scales(raster_scales) {} |
| 51 }; | 46 }; |
| 52 | 47 |
| 53 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0, IS_OPAQUE = 1 << 1 }; | 48 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0, IS_OPAQUE = 1 << 1 }; |
| 54 | 49 |
| 55 typedef uint64_t Id; | 50 typedef uint64_t Id; |
| 56 | 51 |
| 52 ~Tile(); |
| 53 |
| 57 Id id() const { | 54 Id id() const { |
| 58 return id_; | 55 return id_; |
| 59 } | 56 } |
| 60 | 57 |
| 61 // TODO(vmpstr): Move this to the iterators. | 58 // TODO(vmpstr): Move this to the iterators. |
| 62 bool required_for_activation() const { return required_for_activation_; } | 59 bool required_for_activation() const { return required_for_activation_; } |
| 63 void set_required_for_activation(bool is_required) { | 60 void set_required_for_activation(bool is_required) { |
| 64 required_for_activation_ = is_required; | 61 required_for_activation_ = is_required; |
| 65 } | 62 } |
| 66 bool required_for_draw() const { return required_for_draw_; } | 63 bool required_for_draw() const { return required_for_draw_; } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 friend class TileManager; | 121 friend class TileManager; |
| 125 friend class FakeTileManager; | 122 friend class FakeTileManager; |
| 126 friend class FakePictureLayerImpl; | 123 friend class FakePictureLayerImpl; |
| 127 | 124 |
| 128 // Methods called by by tile manager. | 125 // Methods called by by tile manager. |
| 129 Tile(TileManager* tile_manager, | 126 Tile(TileManager* tile_manager, |
| 130 const CreateInfo& info, | 127 const CreateInfo& info, |
| 131 int layer_id, | 128 int layer_id, |
| 132 int source_frame_number, | 129 int source_frame_number, |
| 133 int flags); | 130 int flags); |
| 134 ~Tile(); | |
| 135 | 131 |
| 136 TileManager* const tile_manager_; | 132 TileManager* const tile_manager_; |
| 137 const PictureLayerTiling* tiling_; | 133 const PictureLayerTiling* tiling_; |
| 138 const gfx::Rect content_rect_; | 134 const gfx::Rect content_rect_; |
| 139 const gfx::Rect enclosing_layer_rect_; | 135 const gfx::Rect enclosing_layer_rect_; |
| 140 const gfx::SizeF raster_scales_; | 136 const gfx::SizeF raster_scales_; |
| 141 | 137 |
| 142 TileDrawInfo draw_info_; | 138 TileDrawInfo draw_info_; |
| 143 | 139 |
| 144 const int layer_id_; | 140 const int layer_id_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 157 gfx::Rect invalidated_content_rect_; | 153 gfx::Rect invalidated_content_rect_; |
| 158 // The |id_| of the Tile that was invalidated and replaced by this tile. | 154 // The |id_| of the Tile that was invalidated and replaced by this tile. |
| 159 Id invalidated_id_; | 155 Id invalidated_id_; |
| 160 | 156 |
| 161 unsigned scheduled_priority_; | 157 unsigned scheduled_priority_; |
| 162 scoped_refptr<TileTask> raster_task_; | 158 scoped_refptr<TileTask> raster_task_; |
| 163 | 159 |
| 164 DISALLOW_COPY_AND_ASSIGN(Tile); | 160 DISALLOW_COPY_AND_ASSIGN(Tile); |
| 165 }; | 161 }; |
| 166 | 162 |
| 167 using ScopedTilePtr = std::unique_ptr<Tile, Tile::Deleter>; | |
| 168 | |
| 169 } // namespace cc | 163 } // namespace cc |
| 170 | 164 |
| 171 #endif // CC_TILES_TILE_H_ | 165 #endif // CC_TILES_TILE_H_ |
| OLD | NEW |