| 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/base/scale_translate2d.h" |
| 13 #include "cc/raster/tile_task.h" | 14 #include "cc/raster/tile_task.h" |
| 14 #include "cc/tiles/tile_draw_info.h" | 15 #include "cc/tiles/tile_draw_info.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 16 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/geometry/size.h" | 17 #include "ui/gfx/geometry/size.h" |
| 17 | 18 |
| 18 namespace cc { | 19 namespace cc { |
| 19 | 20 |
| 20 class TileManager; | 21 class TileManager; |
| 21 | 22 |
| 22 class CC_EXPORT Tile { | 23 class CC_EXPORT Tile { |
| 23 public: | 24 public: |
| 24 class CC_EXPORT Deleter { | 25 class CC_EXPORT Deleter { |
| 25 public: | 26 public: |
| 26 void operator()(Tile* tile) const; | 27 void operator()(Tile* tile) const; |
| 27 }; | 28 }; |
| 28 | 29 |
| 29 class CC_EXPORT CreateInfo { | 30 class CC_EXPORT CreateInfo { |
| 30 public: | 31 public: |
| 31 int tiling_i_index; | 32 int tiling_i_index; |
| 32 int tiling_j_index; | 33 int tiling_j_index; |
| 33 gfx::Rect enclosing_layer_rect; | 34 gfx::Rect enclosing_layer_rect; |
| 34 gfx::Rect content_rect; | 35 gfx::Rect content_rect; |
| 35 gfx::SizeF raster_scales; | 36 ScaleTranslate2d raster_transform; |
| 36 | 37 |
| 37 CreateInfo(int tiling_i_index, | 38 CreateInfo(int tiling_i_index, |
| 38 int tiling_j_index, | 39 int tiling_j_index, |
| 39 const gfx::Rect& enclosing_layer_rect, | 40 const gfx::Rect& enclosing_layer_rect, |
| 40 const gfx::Rect& content_rect, | 41 const gfx::Rect& content_rect, |
| 41 const gfx::SizeF& raster_scales) | 42 const ScaleTranslate2d& raster_transform) |
| 42 : tiling_i_index(tiling_i_index), | 43 : tiling_i_index(tiling_i_index), |
| 43 tiling_j_index(tiling_j_index), | 44 tiling_j_index(tiling_j_index), |
| 44 enclosing_layer_rect(enclosing_layer_rect), | 45 enclosing_layer_rect(enclosing_layer_rect), |
| 45 content_rect(content_rect), | 46 content_rect(content_rect), |
| 46 raster_scales(raster_scales) {} | 47 raster_transform(raster_transform) {} |
| 47 }; | 48 }; |
| 48 | 49 |
| 49 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0, IS_OPAQUE = 1 << 1 }; | 50 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0, IS_OPAQUE = 1 << 1 }; |
| 50 | 51 |
| 51 typedef uint64_t Id; | 52 typedef uint64_t Id; |
| 52 | 53 |
| 53 Id id() const { | 54 Id id() const { |
| 54 return id_; | 55 return id_; |
| 55 } | 56 } |
| 56 | 57 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 68 return !!(flags_ & USE_PICTURE_ANALYSIS); | 69 return !!(flags_ & USE_PICTURE_ANALYSIS); |
| 69 } | 70 } |
| 70 | 71 |
| 71 bool is_opaque() const { return !!(flags_ & IS_OPAQUE); } | 72 bool is_opaque() const { return !!(flags_ & IS_OPAQUE); } |
| 72 | 73 |
| 73 void AsValueInto(base::trace_event::TracedValue* value) const; | 74 void AsValueInto(base::trace_event::TracedValue* value) const; |
| 74 | 75 |
| 75 const TileDrawInfo& draw_info() const { return draw_info_; } | 76 const TileDrawInfo& draw_info() const { return draw_info_; } |
| 76 TileDrawInfo& draw_info() { return draw_info_; } | 77 TileDrawInfo& draw_info() { return draw_info_; } |
| 77 | 78 |
| 78 float contents_scale_key() const { return raster_scales_.width(); } | 79 float contents_scale_key() const { return raster_transform_.scale(); } |
| 79 const gfx::SizeF& raster_scales() const { return raster_scales_; } | 80 const ScaleTranslate2d& raster_transform() const { |
| 81 return raster_transform_; |
| 82 } |
| 80 const gfx::Rect& content_rect() const { return content_rect_; } | 83 const gfx::Rect& content_rect() const { return content_rect_; } |
| 81 const gfx::Rect& enclosing_layer_rect() const { | 84 const gfx::Rect& enclosing_layer_rect() const { |
| 82 return enclosing_layer_rect_; | 85 return enclosing_layer_rect_; |
| 83 } | 86 } |
| 84 | 87 |
| 85 int layer_id() const { return layer_id_; } | 88 int layer_id() const { return layer_id_; } |
| 86 | 89 |
| 87 int source_frame_number() const { return source_frame_number_; } | 90 int source_frame_number() const { return source_frame_number_; } |
| 88 | 91 |
| 89 size_t GPUMemoryUsageInBytes() const; | 92 size_t GPUMemoryUsageInBytes() const; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 Tile(TileManager* tile_manager, | 125 Tile(TileManager* tile_manager, |
| 123 const CreateInfo& info, | 126 const CreateInfo& info, |
| 124 int layer_id, | 127 int layer_id, |
| 125 int source_frame_number, | 128 int source_frame_number, |
| 126 int flags); | 129 int flags); |
| 127 ~Tile(); | 130 ~Tile(); |
| 128 | 131 |
| 129 TileManager* const tile_manager_; | 132 TileManager* const tile_manager_; |
| 130 const gfx::Rect content_rect_; | 133 const gfx::Rect content_rect_; |
| 131 const gfx::Rect enclosing_layer_rect_; | 134 const gfx::Rect enclosing_layer_rect_; |
| 132 const gfx::SizeF raster_scales_; | 135 const ScaleTranslate2d raster_transform_; |
| 133 | 136 |
| 134 TileDrawInfo draw_info_; | 137 TileDrawInfo draw_info_; |
| 135 | 138 |
| 136 const int layer_id_; | 139 const int layer_id_; |
| 137 const int source_frame_number_; | 140 const int source_frame_number_; |
| 138 const int flags_; | 141 const int flags_; |
| 139 const int tiling_i_index_; | 142 const int tiling_i_index_; |
| 140 const int tiling_j_index_; | 143 const int tiling_j_index_; |
| 141 bool required_for_activation_ : 1; | 144 bool required_for_activation_ : 1; |
| 142 bool required_for_draw_ : 1; | 145 bool required_for_draw_ : 1; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 154 scoped_refptr<TileTask> raster_task_; | 157 scoped_refptr<TileTask> raster_task_; |
| 155 | 158 |
| 156 DISALLOW_COPY_AND_ASSIGN(Tile); | 159 DISALLOW_COPY_AND_ASSIGN(Tile); |
| 157 }; | 160 }; |
| 158 | 161 |
| 159 using ScopedTilePtr = std::unique_ptr<Tile, Tile::Deleter>; | 162 using ScopedTilePtr = std::unique_ptr<Tile, Tile::Deleter>; |
| 160 | 163 |
| 161 } // namespace cc | 164 } // namespace cc |
| 162 | 165 |
| 163 #endif // CC_TILES_TILE_H_ | 166 #endif // CC_TILES_TILE_H_ |
| OLD | NEW |