| 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 PrioritizedTile; | 21 class PrioritizedTile; |
| 21 class TileManager; | 22 class TileManager; |
| 22 struct TilePriority; | 23 struct TilePriority; |
| 23 | 24 |
| 24 class CC_EXPORT Tile { | 25 class CC_EXPORT Tile { |
| 25 public: | 26 public: |
| 26 class CC_EXPORT Deleter { | 27 class CC_EXPORT Deleter { |
| 27 public: | 28 public: |
| 28 void operator()(Tile* tile) const; | 29 void operator()(Tile* tile) const; |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 class CC_EXPORT CreateInfo { | 32 class CC_EXPORT CreateInfo { |
| 32 public: | 33 public: |
| 33 int tiling_i_index; | 34 int tiling_i_index; |
| 34 int tiling_j_index; | 35 int tiling_j_index; |
| 35 gfx::Rect enclosing_layer_rect; | 36 gfx::Rect enclosing_layer_rect; |
| 36 gfx::Rect content_rect; | 37 gfx::Rect content_rect; |
| 37 float contents_scale; | 38 ScaleTranslate2d contents_transform; |
| 38 | 39 |
| 39 CreateInfo(int tiling_i_index, | 40 CreateInfo(int tiling_i_index, |
| 40 int tiling_j_index, | 41 int tiling_j_index, |
| 41 const gfx::Rect& enclosing_layer_rect, | 42 const gfx::Rect& enclosing_layer_rect, |
| 42 const gfx::Rect& content_rect, | 43 const gfx::Rect& content_rect, |
| 43 float contents_scale) | 44 const ScaleTranslate2d& contents_transform) |
| 44 : tiling_i_index(tiling_i_index), | 45 : tiling_i_index(tiling_i_index), |
| 45 tiling_j_index(tiling_j_index), | 46 tiling_j_index(tiling_j_index), |
| 46 enclosing_layer_rect(enclosing_layer_rect), | 47 enclosing_layer_rect(enclosing_layer_rect), |
| 47 content_rect(content_rect), | 48 content_rect(content_rect), |
| 48 contents_scale(contents_scale) {} | 49 contents_transform(contents_transform) {} |
| 49 }; | 50 }; |
| 50 | 51 |
| 51 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0, IS_OPAQUE = 1 << 1 }; | 52 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0, IS_OPAQUE = 1 << 1 }; |
| 52 | 53 |
| 53 typedef uint64_t Id; | 54 typedef uint64_t Id; |
| 54 | 55 |
| 55 Id id() const { | 56 Id id() const { |
| 56 return id_; | 57 return id_; |
| 57 } | 58 } |
| 58 | 59 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 70 return !!(flags_ & USE_PICTURE_ANALYSIS); | 71 return !!(flags_ & USE_PICTURE_ANALYSIS); |
| 71 } | 72 } |
| 72 | 73 |
| 73 bool is_opaque() const { return !!(flags_ & IS_OPAQUE); } | 74 bool is_opaque() const { return !!(flags_ & IS_OPAQUE); } |
| 74 | 75 |
| 75 void AsValueInto(base::trace_event::TracedValue* value) const; | 76 void AsValueInto(base::trace_event::TracedValue* value) const; |
| 76 | 77 |
| 77 const TileDrawInfo& draw_info() const { return draw_info_; } | 78 const TileDrawInfo& draw_info() const { return draw_info_; } |
| 78 TileDrawInfo& draw_info() { return draw_info_; } | 79 TileDrawInfo& draw_info() { return draw_info_; } |
| 79 | 80 |
| 80 float contents_scale() const { return contents_scale_; } | 81 // float contents_scale() const { return contents_scale_; } |
| 82 const ScaleTranslate2d& contents_transform() const { |
| 83 return contents_transform_; |
| 84 } |
| 81 const gfx::Rect& content_rect() const { return content_rect_; } | 85 const gfx::Rect& content_rect() const { return content_rect_; } |
| 82 const gfx::Rect& enclosing_layer_rect() const { | 86 const gfx::Rect& enclosing_layer_rect() const { |
| 83 return enclosing_layer_rect_; | 87 return enclosing_layer_rect_; |
| 84 } | 88 } |
| 85 | 89 |
| 86 int layer_id() const { return layer_id_; } | 90 int layer_id() const { return layer_id_; } |
| 87 | 91 |
| 88 int source_frame_number() const { return source_frame_number_; } | 92 int source_frame_number() const { return source_frame_number_; } |
| 89 | 93 |
| 90 size_t GPUMemoryUsageInBytes() const; | 94 size_t GPUMemoryUsageInBytes() const; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 116 Tile(TileManager* tile_manager, | 120 Tile(TileManager* tile_manager, |
| 117 const CreateInfo& info, | 121 const CreateInfo& info, |
| 118 int layer_id, | 122 int layer_id, |
| 119 int source_frame_number, | 123 int source_frame_number, |
| 120 int flags); | 124 int flags); |
| 121 ~Tile(); | 125 ~Tile(); |
| 122 | 126 |
| 123 TileManager* const tile_manager_; | 127 TileManager* const tile_manager_; |
| 124 const gfx::Rect content_rect_; | 128 const gfx::Rect content_rect_; |
| 125 const gfx::Rect enclosing_layer_rect_; | 129 const gfx::Rect enclosing_layer_rect_; |
| 126 const float contents_scale_; | 130 const ScaleTranslate2d contents_transform_; |
| 127 | 131 |
| 128 TileDrawInfo draw_info_; | 132 TileDrawInfo draw_info_; |
| 129 | 133 |
| 130 const int layer_id_; | 134 const int layer_id_; |
| 131 const int source_frame_number_; | 135 const int source_frame_number_; |
| 132 const int flags_; | 136 const int flags_; |
| 133 const int tiling_i_index_; | 137 const int tiling_i_index_; |
| 134 const int tiling_j_index_; | 138 const int tiling_j_index_; |
| 135 bool required_for_activation_ : 1; | 139 bool required_for_activation_ : 1; |
| 136 bool required_for_draw_ : 1; | 140 bool required_for_draw_ : 1; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 148 scoped_refptr<TileTask> raster_task_; | 152 scoped_refptr<TileTask> raster_task_; |
| 149 | 153 |
| 150 DISALLOW_COPY_AND_ASSIGN(Tile); | 154 DISALLOW_COPY_AND_ASSIGN(Tile); |
| 151 }; | 155 }; |
| 152 | 156 |
| 153 using ScopedTilePtr = std::unique_ptr<Tile, Tile::Deleter>; | 157 using ScopedTilePtr = std::unique_ptr<Tile, Tile::Deleter>; |
| 154 | 158 |
| 155 } // namespace cc | 159 } // namespace cc |
| 156 | 160 |
| 157 #endif // CC_TILES_TILE_H_ | 161 #endif // CC_TILES_TILE_H_ |
| OLD | NEW |