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"
17 // Container for properties that layers need to compute before they can be
19 struct CC_EXPORT DrawProperties
{
23 // Transforms objects from content space to target surface space, where
24 // this layer would be drawn.
25 gfx::Transform target_space_transform
;
27 // Transforms objects from content space to screen space (viewport space).
28 gfx::Transform screen_space_transform
;
30 // Known occlusion above the layer mapped to the content space of the layer.
31 Occlusion occlusion_in_content_space
;
33 // DrawProperties::opacity may be different than LayerImpl::opacity,
34 // particularly in the case when a RenderSurface re-parents the layer's
35 // opacity, or when opacity is compounded by the hierarchy.
38 // xxx_is_animating flags are used to indicate whether the DrawProperties
39 // are actually meaningful on the main thread. When the properties are
40 // animating, the main thread may not have the same values that are used
42 bool screen_space_transform_is_animating
;
44 // True if the layer can use LCD text.
45 bool can_use_lcd_text
;
47 // The layer whose coordinate space this layer draws into. This can be
48 // either the same layer (draw_properties_.render_target == this) or an
49 // ancestor of this layer.
50 LayerImpl
* render_target
;
52 // This rect is a bounding box around what part of the layer is visible, in
53 // the layer's coordinate space.
54 gfx::Rect visible_layer_rect
;
56 // In target surface space, the rect that encloses the clipped, drawable
57 // content of the layer.
58 gfx::Rect drawable_content_rect
;
60 // In target surface space, the original rect that clipped this layer. This
61 // value is used to avoid unnecessarily changing GL scissor state.
64 // Number of descendants with a clip parent that is our ancestor. NB - this
65 // does not include our clip children because they are clipped by us.
66 size_t num_unclipped_descendants
;
68 // If true, the layer or some layer in its sub-tree has a CopyOutputRequest
70 bool layer_or_descendant_has_copy_request
;
72 // If true, the layer or one of its descendants has a wheel or touch handler.
73 bool layer_or_descendant_has_input_handler
;
75 // This is true if the layer has any direct child that has a scroll parent.
76 // This layer will not be the scroll parent in this case. This information
77 // lets us avoid work in CalculateDrawPropertiesInternal -- if none of our
78 // children have scroll parents, we will not need to recur out of order.
79 bool has_child_with_a_scroll_parent
;
81 // Each time we generate a new render surface layer list, an ID is used to
82 // identify it. |last_drawn_render_surface_layer_list_id| is set to the ID
83 // that marked the render surface layer list generation which last updated
84 // these draw properties and determined that this layer will draw itself.
85 // If these draw properties are not a part of the render surface layer list,
86 // or the layer doesn't contribute anything, then this ID will be either out
88 int last_drawn_render_surface_layer_list_id
;
90 // The maximum scale during the layers current animation at which content
91 // should be rastered at to be crisp.
92 float maximum_animation_contents_scale
;
94 // The scale during the layer animation start at which content should be
95 // rastered at to be crisp.
96 float starting_animation_contents_scale
;
101 #endif // CC_LAYERS_DRAW_PROPERTIES_H_