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(NULL), | 26 render_target(NULL), |
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), |
32 index_of_first_descendants_addition(0), | 34 index_of_first_descendants_addition(0), |
33 num_descendants_added(0), | 35 num_descendants_added(0), |
34 index_of_first_render_surface_layer_list_addition(0), | 36 index_of_first_render_surface_layer_list_addition(0), |
35 num_render_surfaces_added(0), | 37 num_render_surfaces_added(0), |
36 last_drawn_render_surface_layer_list_id(0), | 38 last_drawn_render_surface_layer_list_id(0), |
37 ideal_contents_scale(0.f), | 39 ideal_contents_scale(0.f), |
38 maximum_animation_contents_scale(0.f), | 40 maximum_animation_contents_scale(0.f), |
39 page_scale_factor(0.f), | 41 page_scale_factor(0.f), |
40 device_scale_factor(0.f), | 42 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) {} | |
46 | 43 |
47 // Transforms objects from content space to target surface space, where | 44 // Transforms objects from content space to target surface space, where |
48 // this layer would be drawn. | 45 // this layer would be drawn. |
49 gfx::Transform target_space_transform; | 46 gfx::Transform target_space_transform; |
50 | 47 |
51 // Transforms objects from content space to screen space (viewport space). | 48 // Transforms objects from content space to screen space (viewport space). |
52 gfx::Transform screen_space_transform; | 49 gfx::Transform screen_space_transform; |
53 | 50 |
54 // DrawProperties::opacity may be different than LayerType::opacity, | 51 // DrawProperties::opacity may be different than LayerType::opacity, |
55 // particularly in the case when a RenderSurface re-parents the layer's | 52 // 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... |
102 // does not include our clip children because they are clipped by us. | 99 // does not include our clip children because they are clipped by us. |
103 int num_unclipped_descendants; | 100 int num_unclipped_descendants; |
104 | 101 |
105 // If true, the layer or some layer in its sub-tree has a CopyOutputRequest | 102 // If true, the layer or some layer in its sub-tree has a CopyOutputRequest |
106 // present on it. | 103 // present on it. |
107 bool layer_or_descendant_has_copy_request; | 104 bool layer_or_descendant_has_copy_request; |
108 | 105 |
109 // If true, the layer or one of its descendants has a wheel or touch handler. | 106 // If true, the layer or one of its descendants has a wheel or touch handler. |
110 bool layer_or_descendant_has_input_handler; | 107 bool layer_or_descendant_has_input_handler; |
111 | 108 |
| 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 |
112 // If this layer is visited out of order, its contribution to the descendant | 119 // If this layer is visited out of order, its contribution to the descendant |
113 // and render surface layer lists will be put aside in a temporary list. | 120 // and render surface layer lists will be put aside in a temporary list. |
114 // These values will allow for an efficient reordering of these additions. | 121 // These values will allow for an efficient reordering of these additions. |
115 size_t index_of_first_descendants_addition; | 122 size_t index_of_first_descendants_addition; |
116 size_t num_descendants_added; | 123 size_t num_descendants_added; |
117 size_t index_of_first_render_surface_layer_list_addition; | 124 size_t index_of_first_render_surface_layer_list_addition; |
118 size_t num_render_surfaces_added; | 125 size_t num_render_surfaces_added; |
119 | 126 |
120 // Each time we generate a new render surface layer list, an ID is used to | 127 // Each time we generate a new render surface layer list, an ID is used to |
121 // identify it. |last_drawn_render_surface_layer_list_id| is set to the ID | 128 // identify it. |last_drawn_render_surface_layer_list_id| is set to the ID |
(...skipping 11 matching lines...) Expand all Loading... |
133 // The maximum scale during the layers current animation at which content | 140 // The maximum scale during the layers current animation at which content |
134 // should be rastered at to be crisp. | 141 // should be rastered at to be crisp. |
135 float maximum_animation_contents_scale; | 142 float maximum_animation_contents_scale; |
136 | 143 |
137 // The page scale factor that is applied to the layer. Since some layers may | 144 // The page scale factor that is applied to the layer. Since some layers may |
138 // have page scale applied and others not, this may differ between layers. | 145 // have page scale applied and others not, this may differ between layers. |
139 float page_scale_factor; | 146 float page_scale_factor; |
140 | 147 |
141 // The device scale factor that is applied to the layer. | 148 // The device scale factor that is applied to the layer. |
142 float device_scale_factor; | 149 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; | |
167 }; | 150 }; |
168 | 151 |
169 } // namespace cc | 152 } // namespace cc |
170 | 153 |
171 #endif // CC_LAYERS_DRAW_PROPERTIES_H_ | 154 #endif // CC_LAYERS_DRAW_PROPERTIES_H_ |
OLD | NEW |