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_LAYERS_DRAW_PROPERTIES_H_ | 5 #ifndef CC_LAYERS_DRAW_PROPERTIES_H_ |
6 #define CC_LAYERS_DRAW_PROPERTIES_H_ | 6 #define CC_LAYERS_DRAW_PROPERTIES_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "ui/gfx/rect.h" | 9 #include "ui/gfx/rect.h" |
10 #include "ui/gfx/transform.h" | 10 #include "ui/gfx/transform.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 target_space_transform_is_animating(false), | 22 target_space_transform_is_animating(false), |
23 screen_space_transform_is_animating(false), | 23 screen_space_transform_is_animating(false), |
24 can_use_lcd_text(false), | 24 can_use_lcd_text(false), |
25 is_clipped(false), | 25 is_clipped(false), |
26 render_target(nullptr), | 26 render_target(nullptr), |
27 contents_scale_x(1.f), | 27 contents_scale_x(1.f), |
28 contents_scale_y(1.f), | 28 contents_scale_y(1.f), |
29 num_unclipped_descendants(0), | 29 num_unclipped_descendants(0), |
30 layer_or_descendant_has_copy_request(false), | 30 layer_or_descendant_has_copy_request(false), |
31 layer_or_descendant_has_input_handler(false), | 31 layer_or_descendant_has_input_handler(false), |
32 has_child_with_a_scroll_parent(false), | |
33 sorted_for_recursion(false), | |
34 index_of_first_descendants_addition(0), | 32 index_of_first_descendants_addition(0), |
35 num_descendants_added(0), | 33 num_descendants_added(0), |
36 index_of_first_render_surface_layer_list_addition(0), | 34 index_of_first_render_surface_layer_list_addition(0), |
37 num_render_surfaces_added(0), | 35 num_render_surfaces_added(0), |
38 last_drawn_render_surface_layer_list_id(0), | 36 last_drawn_render_surface_layer_list_id(0), |
39 ideal_contents_scale(0.f), | 37 ideal_contents_scale(0.f), |
40 maximum_animation_contents_scale(0.f), | 38 maximum_animation_contents_scale(0.f), |
41 page_scale_factor(0.f), | 39 page_scale_factor(0.f), |
42 device_scale_factor(0.f) {} | 40 device_scale_factor(0.f), |
| 41 children_need_sorting(false), |
| 42 sequence_number(0), |
| 43 sort_weight(0), |
| 44 sort_weight_sequence_number(0), |
| 45 depth(0) {} |
43 | 46 |
44 // Transforms objects from content space to target surface space, where | 47 // Transforms objects from content space to target surface space, where |
45 // this layer would be drawn. | 48 // this layer would be drawn. |
46 gfx::Transform target_space_transform; | 49 gfx::Transform target_space_transform; |
47 | 50 |
48 // Transforms objects from content space to screen space (viewport space). | 51 // Transforms objects from content space to screen space (viewport space). |
49 gfx::Transform screen_space_transform; | 52 gfx::Transform screen_space_transform; |
50 | 53 |
51 // DrawProperties::opacity may be different than LayerType::opacity, | 54 // DrawProperties::opacity may be different than LayerType::opacity, |
52 // particularly in the case when a RenderSurface re-parents the layer's | 55 // particularly in the case when a RenderSurface re-parents the layer's |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // does not include our clip children because they are clipped by us. | 102 // does not include our clip children because they are clipped by us. |
100 int num_unclipped_descendants; | 103 int num_unclipped_descendants; |
101 | 104 |
102 // If true, the layer or some layer in its sub-tree has a CopyOutputRequest | 105 // If true, the layer or some layer in its sub-tree has a CopyOutputRequest |
103 // present on it. | 106 // present on it. |
104 bool layer_or_descendant_has_copy_request; | 107 bool layer_or_descendant_has_copy_request; |
105 | 108 |
106 // If true, the layer or one of its descendants has a wheel or touch handler. | 109 // If true, the layer or one of its descendants has a wheel or touch handler. |
107 bool layer_or_descendant_has_input_handler; | 110 bool layer_or_descendant_has_input_handler; |
108 | 111 |
109 // This is true if the layer has any direct child that has a scroll parent. | |
110 // This layer will not be the scroll parent in this case. This information | |
111 // lets us avoid work in CalculateDrawPropertiesInternal -- if none of our | |
112 // children have scroll parents, we will not need to recur out of order. | |
113 bool has_child_with_a_scroll_parent; | |
114 | |
115 // This is true if the order (wrt to its siblings in the tree) in which the | |
116 // layer will be visited while computing draw properties has been determined. | |
117 bool sorted_for_recursion; | |
118 | |
119 // If this layer is visited out of order, its contribution to the descendant | 112 // If this layer is visited out of order, its contribution to the descendant |
120 // and render surface layer lists will be put aside in a temporary list. | 113 // and render surface layer lists will be put aside in a temporary list. |
121 // These values will allow for an efficient reordering of these additions. | 114 // These values will allow for an efficient reordering of these additions. |
122 size_t index_of_first_descendants_addition; | 115 size_t index_of_first_descendants_addition; |
123 size_t num_descendants_added; | 116 size_t num_descendants_added; |
124 size_t index_of_first_render_surface_layer_list_addition; | 117 size_t index_of_first_render_surface_layer_list_addition; |
125 size_t num_render_surfaces_added; | 118 size_t num_render_surfaces_added; |
126 | 119 |
127 // Each time we generate a new render surface layer list, an ID is used to | 120 // Each time we generate a new render surface layer list, an ID is used to |
128 // identify it. |last_drawn_render_surface_layer_list_id| is set to the ID | 121 // identify it. |last_drawn_render_surface_layer_list_id| is set to the ID |
(...skipping 11 matching lines...) Expand all Loading... |
140 // The maximum scale during the layers current animation at which content | 133 // The maximum scale during the layers current animation at which content |
141 // should be rastered at to be crisp. | 134 // should be rastered at to be crisp. |
142 float maximum_animation_contents_scale; | 135 float maximum_animation_contents_scale; |
143 | 136 |
144 // The page scale factor that is applied to the layer. Since some layers may | 137 // The page scale factor that is applied to the layer. Since some layers may |
145 // have page scale applied and others not, this may differ between layers. | 138 // have page scale applied and others not, this may differ between layers. |
146 float page_scale_factor; | 139 float page_scale_factor; |
147 | 140 |
148 // The device scale factor that is applied to the layer. | 141 // The device scale factor that is applied to the layer. |
149 float device_scale_factor; | 142 float device_scale_factor; |
| 143 |
| 144 // This is used to detect cases when a layer needs to sort its children to |
| 145 // ensure that scroll parents are visited before scroll children. |
| 146 bool children_need_sorting; |
| 147 |
| 148 // This sequence number is used to determine if we've visited this layer in |
| 149 // PreCalculateMetaInformation. |
| 150 int sequence_number; |
| 151 |
| 152 // Determines the order the layer should be processed in |
| 153 // CalculateDrawProperties wrt to its siblings. If you have lower |
| 154 // |sort_weight| you get visited first. |
| 155 int sort_weight; |
| 156 |
| 157 // This sequence number is used to determine if a sort weight has already been |
| 158 // assigned for a layer. We may assign a sort weight before we visit a layer, |
| 159 // and it's important that we don't clobber it when we do eventually visit the |
| 160 // layer. |
| 161 int sort_weight_sequence_number; |
| 162 |
| 163 // This is the topological depth in the tree. (E.g., root has depth zero). |
| 164 // This is used to make it faster to find the lowest common ancestor of two |
| 165 // layers. |
| 166 int depth; |
150 }; | 167 }; |
151 | 168 |
152 } // namespace cc | 169 } // namespace cc |
153 | 170 |
154 #endif // CC_LAYERS_DRAW_PROPERTIES_H_ | 171 #endif // CC_LAYERS_DRAW_PROPERTIES_H_ |
OLD | NEW |