blob: 0c7e4795f3ae08d8347f5df70d514448a359aaba [file] [log] [blame]
[email protected]d76806f82012-12-05 21:41:501// 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.
4
[email protected]cc3cfaa2013-03-18 09:05:525#ifndef CC_LAYERS_DRAW_PROPERTIES_H_
6#define CC_LAYERS_DRAW_PROPERTIES_H_
[email protected]d76806f82012-12-05 21:41:507
avi02a4d172015-12-21 06:14:368#include <stddef.h>
9
[email protected]d76806f82012-12-05 21:41:5010#include "base/memory/scoped_ptr.h"
danakj4902c302015-02-13 22:12:1611#include "cc/trees/occlusion.h"
rosca948d29d2014-11-09 10:25:1312#include "third_party/skia/include/core/SkXfermode.h"
heejin.r.chungd28506ba2014-10-23 16:36:2013#include "ui/gfx/geometry/rect.h"
[email protected]d76806f82012-12-05 21:41:5014#include "ui/gfx/transform.h"
15
16namespace cc {
ennefffb119c2015-08-29 09:17:3017class LayerImpl;
[email protected]d76806f82012-12-05 21:41:5018
19// Container for properties that layers need to compute before they can be
20// drawn.
[email protected]d76806f82012-12-05 21:41:5021struct CC_EXPORT DrawProperties {
ennefffb119c2015-08-29 09:17:3022 DrawProperties();
23 ~DrawProperties();
[email protected]d76806f82012-12-05 21:41:5024
[email protected]7af0d792013-03-24 09:38:5725 // Transforms objects from content space to target surface space, where
26 // this layer would be drawn.
27 gfx::Transform target_space_transform;
[email protected]d76806f82012-12-05 21:41:5028
[email protected]7af0d792013-03-24 09:38:5729 // Transforms objects from content space to screen space (viewport space).
30 gfx::Transform screen_space_transform;
[email protected]d76806f82012-12-05 21:41:5031
danakj4902c302015-02-13 22:12:1632 // Known occlusion above the layer mapped to the content space of the layer.
33 Occlusion occlusion_in_content_space;
34
ennefffb119c2015-08-29 09:17:3035 // DrawProperties::opacity may be different than LayerImpl::opacity,
[email protected]ed511b8d2013-03-25 03:29:2936 // particularly in the case when a RenderSurface re-parents the layer's
[email protected]7af0d792013-03-24 09:38:5737 // opacity, or when opacity is compounded by the hierarchy.
38 float opacity;
[email protected]d76806f82012-12-05 21:41:5039
[email protected]7af0d792013-03-24 09:38:5740 // xxx_is_animating flags are used to indicate whether the DrawProperties
41 // are actually meaningful on the main thread. When the properties are
42 // animating, the main thread may not have the same values that are used
43 // to draw.
[email protected]7af0d792013-03-24 09:38:5744 bool screen_space_transform_is_animating;
[email protected]d76806f82012-12-05 21:41:5045
[email protected]7af0d792013-03-24 09:38:5746 // True if the layer can use LCD text.
47 bool can_use_lcd_text;
[email protected]10aabcc32012-12-13 09:18:5948
ajumae2b7a5c2015-09-30 21:41:4249 // True if the layer needs to be clipped by clip_rect.
50 bool is_clipped;
51
[email protected]7af0d792013-03-24 09:38:5752 // The layer whose coordinate space this layer draws into. This can be
53 // either the same layer (draw_properties_.render_target == this) or an
54 // ancestor of this layer.
ennefffb119c2015-08-29 09:17:3055 LayerImpl* render_target;
[email protected]d76806f82012-12-05 21:41:5056
danakj64767d902015-06-19 00:10:4357 // This rect is a bounding box around what part of the layer is visible, in
58 // the layer's coordinate space.
59 gfx::Rect visible_layer_rect;
[email protected]d76806f82012-12-05 21:41:5060
[email protected]7af0d792013-03-24 09:38:5761 // In target surface space, the rect that encloses the clipped, drawable
62 // content of the layer.
63 gfx::Rect drawable_content_rect;
[email protected]d76806f82012-12-05 21:41:5064
[email protected]7af0d792013-03-24 09:38:5765 // In target surface space, the original rect that clipped this layer. This
66 // value is used to avoid unnecessarily changing GL scissor state.
67 gfx::Rect clip_rect;
[email protected]b5b1fce2012-12-12 22:49:3668
[email protected]420fdf6e2013-08-26 20:36:3869 // Number of descendants with a clip parent that is our ancestor. NB - this
70 // does not include our clip children because they are clipped by us.
vmpstr762e70d2015-06-10 02:12:5771 size_t num_unclipped_descendants;
[email protected]420fdf6e2013-08-26 20:36:3872
vollickeb194942014-09-12 17:45:2773 // This is true if the layer has any direct child that has a scroll parent.
74 // This layer will not be the scroll parent in this case. This information
75 // lets us avoid work in CalculateDrawPropertiesInternal -- if none of our
76 // children have scroll parents, we will not need to recur out of order.
77 bool has_child_with_a_scroll_parent;
78
[email protected]390bb1ff2014-05-09 17:14:4079 // Each time we generate a new render surface layer list, an ID is used to
80 // identify it. |last_drawn_render_surface_layer_list_id| is set to the ID
81 // that marked the render surface layer list generation which last updated
82 // these draw properties and determined that this layer will draw itself.
83 // If these draw properties are not a part of the render surface layer list,
84 // or the layer doesn't contribute anything, then this ID will be either out
85 // of date or 0.
86 int last_drawn_render_surface_layer_list_id;
[email protected]18e69652014-06-13 12:50:5887
[email protected]18e69652014-06-13 12:50:5888 // The maximum scale during the layers current animation at which content
89 // should be rastered at to be crisp.
90 float maximum_animation_contents_scale;
91
behara.msf0ebecee2015-05-05 02:52:1292 // The scale during the layer animation start at which content should be
93 // rastered at to be crisp.
94 float starting_animation_contents_scale;
[email protected]d76806f82012-12-05 21:41:5095};
96
97} // namespace cc
98
[email protected]cc3cfaa2013-03-18 09:05:5299#endif // CC_LAYERS_DRAW_PROPERTIES_H_