GN (Android): Fix packaging excess libs when target_cpu is changed
[chromium-blink-merge.git] / cc / layers / draw_properties.h
blob4e105d92c6fecbc5dc624b4e9238698dd739140c
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
3 // found in the LICENSE file.
5 #ifndef CC_LAYERS_DRAW_PROPERTIES_H_
6 #define CC_LAYERS_DRAW_PROPERTIES_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/trees/occlusion.h"
10 #include "third_party/skia/include/core/SkXfermode.h"
11 #include "ui/gfx/geometry/rect.h"
12 #include "ui/gfx/transform.h"
14 namespace cc {
16 // Container for properties that layers need to compute before they can be
17 // drawn.
18 template <typename LayerType>
19 struct CC_EXPORT DrawProperties {
20 DrawProperties()
21 : opacity(0.f),
22 screen_space_transform_is_animating(false),
23 can_use_lcd_text(false),
24 render_target(nullptr),
25 num_unclipped_descendants(0),
26 layer_or_descendant_has_copy_request(false),
27 layer_or_descendant_has_input_handler(false),
28 has_child_with_a_scroll_parent(false),
29 last_drawn_render_surface_layer_list_id(0),
30 maximum_animation_contents_scale(0.f),
31 starting_animation_contents_scale(0.f) {}
33 // Transforms objects from content space to target surface space, where
34 // this layer would be drawn.
35 gfx::Transform target_space_transform;
37 // Transforms objects from content space to screen space (viewport space).
38 gfx::Transform screen_space_transform;
40 // Known occlusion above the layer mapped to the content space of the layer.
41 Occlusion occlusion_in_content_space;
43 // DrawProperties::opacity may be different than LayerType::opacity,
44 // particularly in the case when a RenderSurface re-parents the layer's
45 // opacity, or when opacity is compounded by the hierarchy.
46 float opacity;
48 // xxx_is_animating flags are used to indicate whether the DrawProperties
49 // are actually meaningful on the main thread. When the properties are
50 // animating, the main thread may not have the same values that are used
51 // to draw.
52 bool screen_space_transform_is_animating;
54 // True if the layer can use LCD text.
55 bool can_use_lcd_text;
57 // The layer whose coordinate space this layer draws into. This can be
58 // either the same layer (draw_properties_.render_target == this) or an
59 // ancestor of this layer.
60 LayerType* render_target;
62 // This rect is a bounding box around what part of the layer is visible, in
63 // the layer's coordinate space.
64 gfx::Rect visible_layer_rect;
66 // In target surface space, the rect that encloses the clipped, drawable
67 // content of the layer.
68 gfx::Rect drawable_content_rect;
70 // In target surface space, the original rect that clipped this layer. This
71 // value is used to avoid unnecessarily changing GL scissor state.
72 gfx::Rect clip_rect;
74 // Number of descendants with a clip parent that is our ancestor. NB - this
75 // does not include our clip children because they are clipped by us.
76 size_t num_unclipped_descendants;
78 // If true, the layer or some layer in its sub-tree has a CopyOutputRequest
79 // present on it.
80 bool layer_or_descendant_has_copy_request;
82 // If true, the layer or one of its descendants has a wheel or touch handler.
83 bool layer_or_descendant_has_input_handler;
85 // This is true if the layer has any direct child that has a scroll parent.
86 // This layer will not be the scroll parent in this case. This information
87 // lets us avoid work in CalculateDrawPropertiesInternal -- if none of our
88 // children have scroll parents, we will not need to recur out of order.
89 bool has_child_with_a_scroll_parent;
91 // Each time we generate a new render surface layer list, an ID is used to
92 // identify it. |last_drawn_render_surface_layer_list_id| is set to the ID
93 // that marked the render surface layer list generation which last updated
94 // these draw properties and determined that this layer will draw itself.
95 // If these draw properties are not a part of the render surface layer list,
96 // or the layer doesn't contribute anything, then this ID will be either out
97 // of date or 0.
98 int last_drawn_render_surface_layer_list_id;
100 // The maximum scale during the layers current animation at which content
101 // should be rastered at to be crisp.
102 float maximum_animation_contents_scale;
104 // The scale during the layer animation start at which content should be
105 // rastered at to be crisp.
106 float starting_animation_contents_scale;
109 } // namespace cc
111 #endif // CC_LAYERS_DRAW_PROPERTIES_H_