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 PictureLayerTiling; | 21 class PictureLayerTiling; |
21 class TileManager; | 22 class TileManager; |
22 | 23 |
23 class CC_EXPORT Tile { | 24 class CC_EXPORT Tile { |
24 public: | 25 public: |
25 class CC_EXPORT CreateInfo { | 26 class CC_EXPORT CreateInfo { |
26 public: | 27 public: |
27 const PictureLayerTiling* tiling; | 28 const PictureLayerTiling* tiling; |
28 int tiling_i_index; | 29 int tiling_i_index; |
29 int tiling_j_index; | 30 int tiling_j_index; |
30 gfx::Rect enclosing_layer_rect; | 31 gfx::Rect enclosing_layer_rect; |
31 gfx::Rect content_rect; | 32 gfx::Rect content_rect; |
32 float contents_scale; | 33 ScaleTranslate2d raster_transform; |
33 | 34 |
34 CreateInfo(const PictureLayerTiling* tiling, | 35 CreateInfo(const PictureLayerTiling* tiling, |
35 int tiling_i_index, | 36 int tiling_i_index, |
36 int tiling_j_index, | 37 int tiling_j_index, |
37 const gfx::Rect& enclosing_layer_rect, | 38 const gfx::Rect& enclosing_layer_rect, |
38 const gfx::Rect& content_rect, | 39 const gfx::Rect& content_rect, |
39 float contents_scale) | 40 const ScaleTranslate2d& raster_transform) |
40 : tiling(tiling), | 41 : tiling(tiling), |
41 tiling_i_index(tiling_i_index), | 42 tiling_i_index(tiling_i_index), |
42 tiling_j_index(tiling_j_index), | 43 tiling_j_index(tiling_j_index), |
43 enclosing_layer_rect(enclosing_layer_rect), | 44 enclosing_layer_rect(enclosing_layer_rect), |
44 content_rect(content_rect), | 45 content_rect(content_rect), |
45 contents_scale(contents_scale) {} | 46 raster_transform(raster_transform) {} |
46 }; | 47 }; |
47 | 48 |
48 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0, IS_OPAQUE = 1 << 1 }; | 49 enum TileRasterFlags { USE_PICTURE_ANALYSIS = 1 << 0, IS_OPAQUE = 1 << 1 }; |
49 | 50 |
50 typedef uint64_t Id; | 51 typedef uint64_t Id; |
51 | 52 |
52 ~Tile(); | 53 ~Tile(); |
53 | 54 |
54 Id id() const { | 55 Id id() const { |
55 return id_; | 56 return id_; |
(...skipping 13 matching lines...) Expand all Loading... |
69 return !!(flags_ & USE_PICTURE_ANALYSIS); | 70 return !!(flags_ & USE_PICTURE_ANALYSIS); |
70 } | 71 } |
71 | 72 |
72 bool is_opaque() const { return !!(flags_ & IS_OPAQUE); } | 73 bool is_opaque() const { return !!(flags_ & IS_OPAQUE); } |
73 | 74 |
74 void AsValueInto(base::trace_event::TracedValue* value) const; | 75 void AsValueInto(base::trace_event::TracedValue* value) const; |
75 | 76 |
76 const TileDrawInfo& draw_info() const { return draw_info_; } | 77 const TileDrawInfo& draw_info() const { return draw_info_; } |
77 TileDrawInfo& draw_info() { return draw_info_; } | 78 TileDrawInfo& draw_info() { return draw_info_; } |
78 | 79 |
79 float contents_scale() const { return contents_scale_; } | 80 float contents_scale_key() const { return raster_transform_.scale(); } |
| 81 const ScaleTranslate2d& raster_transform() const { return raster_transform_; } |
80 const gfx::Rect& content_rect() const { return content_rect_; } | 82 const gfx::Rect& content_rect() const { return content_rect_; } |
81 const gfx::Rect& enclosing_layer_rect() const { | 83 const gfx::Rect& enclosing_layer_rect() const { |
82 return enclosing_layer_rect_; | 84 return enclosing_layer_rect_; |
83 } | 85 } |
84 | 86 |
85 int layer_id() const { return layer_id_; } | 87 int layer_id() const { return layer_id_; } |
86 | 88 |
87 int source_frame_number() const { return source_frame_number_; } | 89 int source_frame_number() const { return source_frame_number_; } |
88 | 90 |
89 size_t GPUMemoryUsageInBytes() const; | 91 size_t GPUMemoryUsageInBytes() const; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 Tile(TileManager* tile_manager, | 127 Tile(TileManager* tile_manager, |
126 const CreateInfo& info, | 128 const CreateInfo& info, |
127 int layer_id, | 129 int layer_id, |
128 int source_frame_number, | 130 int source_frame_number, |
129 int flags); | 131 int flags); |
130 | 132 |
131 TileManager* const tile_manager_; | 133 TileManager* const tile_manager_; |
132 const PictureLayerTiling* tiling_; | 134 const PictureLayerTiling* tiling_; |
133 const gfx::Rect content_rect_; | 135 const gfx::Rect content_rect_; |
134 const gfx::Rect enclosing_layer_rect_; | 136 const gfx::Rect enclosing_layer_rect_; |
135 const float contents_scale_; | 137 const ScaleTranslate2d raster_transform_; |
136 | 138 |
137 TileDrawInfo draw_info_; | 139 TileDrawInfo draw_info_; |
138 | 140 |
139 const int layer_id_; | 141 const int layer_id_; |
140 const int source_frame_number_; | 142 const int source_frame_number_; |
141 const int flags_; | 143 const int flags_; |
142 const int tiling_i_index_; | 144 const int tiling_i_index_; |
143 const int tiling_j_index_; | 145 const int tiling_j_index_; |
144 bool required_for_activation_ : 1; | 146 bool required_for_activation_ : 1; |
145 bool required_for_draw_ : 1; | 147 bool required_for_draw_ : 1; |
146 bool is_solid_color_analysis_performed_ : 1; | 148 bool is_solid_color_analysis_performed_ : 1; |
147 | 149 |
148 Id id_; | 150 Id id_; |
149 | 151 |
150 // The rect bounding the changes in this Tile vs the previous tile it | 152 // The rect bounding the changes in this Tile vs the previous tile it |
151 // replaced. | 153 // replaced. |
152 gfx::Rect invalidated_content_rect_; | 154 gfx::Rect invalidated_content_rect_; |
153 // The |id_| of the Tile that was invalidated and replaced by this tile. | 155 // The |id_| of the Tile that was invalidated and replaced by this tile. |
154 Id invalidated_id_; | 156 Id invalidated_id_; |
155 | 157 |
156 unsigned scheduled_priority_; | 158 unsigned scheduled_priority_; |
157 scoped_refptr<TileTask> raster_task_; | 159 scoped_refptr<TileTask> raster_task_; |
158 | 160 |
159 DISALLOW_COPY_AND_ASSIGN(Tile); | 161 DISALLOW_COPY_AND_ASSIGN(Tile); |
160 }; | 162 }; |
161 | 163 |
162 } // namespace cc | 164 } // namespace cc |
163 | 165 |
164 #endif // CC_TILES_TILE_H_ | 166 #endif // CC_TILES_TILE_H_ |
OLD | NEW |