1 // Copyright 2014 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_TREES_DRAW_PROPERTY_UTILS_H_
6 #define CC_TREES_DRAW_PROPERTY_UTILS_H_
8 #include "cc/base/cc_export.h"
9 #include "cc/layers/layer_lists.h"
21 class RenderSurfaceImpl
;
26 // Computes combined clips for every node in |clip_tree|. This function requires
27 // that |transform_tree| has been updated via |ComputeTransforms|.
28 // TODO(vollick): ComputeClips and ComputeTransforms will eventually need to be
29 // done on both threads.
31 ComputeClips(ClipTree
* clip_tree
, const TransformTree
& transform_tree
);
33 // Computes combined (screen space) transforms for every node in the transform
34 // tree. This must be done prior to calling |ComputeClips|.
35 void CC_EXPORT
ComputeTransforms(TransformTree
* transform_tree
);
37 // Computes screen space opacity for every node in the opacity tree.
38 void CC_EXPORT
ComputeOpacities(EffectTree
* effect_tree
);
40 // Computes the visible content rect for every layer under |root_layer|. The
41 // visible content rect is the clipped content space rect that will be used for
43 void CC_EXPORT
BuildPropertyTreesAndComputeVisibleRects(
45 const Layer
* page_scale_layer
,
46 const Layer
* inner_viewport_scroll_layer
,
47 const Layer
* outer_viewport_scroll_layer
,
48 float page_scale_factor
,
49 float device_scale_factor
,
50 const gfx::Rect
& viewport
,
51 const gfx::Transform
& device_transform
,
52 PropertyTrees
* property_trees
,
53 LayerList
* update_layer_list
);
55 void CC_EXPORT
BuildPropertyTreesAndComputeVisibleRects(
56 LayerImpl
* root_layer
,
57 const LayerImpl
* page_scale_layer
,
58 const LayerImpl
* inner_viewport_scroll_layer
,
59 const LayerImpl
* outer_viewport_scroll_layer
,
60 float page_scale_factor
,
61 float device_scale_factor
,
62 const gfx::Rect
& viewport
,
63 const gfx::Transform
& device_transform
,
64 PropertyTrees
* property_trees
,
65 LayerImplList
* update_layer_list
);
68 ComputeVisibleRectsUsingPropertyTrees(Layer
* root_layer
,
69 PropertyTrees
* property_trees
,
70 LayerList
* update_layer_list
);
73 ComputeVisibleRectsUsingPropertyTrees(LayerImpl
* root_layer
,
74 PropertyTrees
* property_trees
,
75 LayerImplList
* update_layer_list
);
77 gfx::Transform CC_EXPORT
78 DrawTransformFromPropertyTrees(const Layer
* layer
, const TransformTree
& tree
);
80 gfx::Transform CC_EXPORT
DrawTransformOfRenderSurfaceFromPropertyTrees(
81 const RenderSurfaceImpl
* render_Surface
,
82 const TransformTree
& tree
);
85 RenderSurfaceIsClippedFromPropertyTrees(const RenderSurfaceImpl
* render_surface
,
86 const ClipTree
& tree
);
88 gfx::Rect CC_EXPORT
ClipRectOfRenderSurfaceFromPropertyTrees(
89 const RenderSurfaceImpl
* render_surface
,
90 const ClipTree
& clip_tree
);
92 gfx::Transform CC_EXPORT
ScreenSpaceTransformOfRenderSurfaceFromPropertyTrees(
93 const RenderSurfaceImpl
* render_surface
,
94 const TransformTree
& tree
);
96 gfx::Transform CC_EXPORT
97 DrawTransformFromPropertyTrees(const LayerImpl
* layer
,
98 const TransformTree
& tree
);
100 gfx::Transform CC_EXPORT
101 ScreenSpaceTransformFromPropertyTrees(const Layer
* layer
,
102 const TransformTree
& tree
);
104 gfx::Transform CC_EXPORT
105 ScreenSpaceTransformFromPropertyTrees(const LayerImpl
* layer
,
106 const TransformTree
& tree
);
109 ScreenSpaceTransformIsAnimatingFromPropertyTrees(const Layer
* layer
,
110 const TransformTree
& tree
);
113 ScreenSpaceTransformIsAnimatingFromPropertyTrees(const LayerImpl
* layer
,
114 const TransformTree
& tree
);
117 MaximumAnimationTargetScaleFromPropertyTrees(const LayerImpl
* layer
,
118 const TransformTree
& tree
);
121 StartingAnimationScaleFromPropertyTrees(const LayerImpl
* layer
,
122 const TransformTree
& tree
);
124 float CC_EXPORT
DrawOpacityFromPropertyTrees(const Layer
* layer
,
125 const EffectTree
& tree
);
127 float CC_EXPORT
DrawOpacityFromPropertyTrees(const LayerImpl
* layer
,
128 const EffectTree
& tree
);
131 DrawOpacityOfRenderSurfaceFromPropertyTrees(RenderSurfaceImpl
* render_surface
,
132 const EffectTree
& tree
);
135 CanUseLcdTextFromPropertyTrees(const LayerImpl
* layer
,
136 bool layers_always_allowed_lcd_text
,
137 bool can_use_lcd_text
,
138 PropertyTrees
* property_trees
);
140 gfx::Rect CC_EXPORT
DrawableContentRectOfSurfaceFromPropertyTrees(
141 const RenderSurfaceImpl
* render_surface
,
142 const TransformTree
& transform_tree
);
145 DrawableContentRectFromPropertyTrees(const LayerImpl
* layer
,
146 const TransformTree
& transform_tree
);
149 ClipRectFromPropertyTrees(const LayerImpl
* layer
,
150 const TransformTree
& transform_tree
);
152 gfx::Rect CC_EXPORT
ViewportRectFromPropertyTrees(const ClipTree
& tree
);
154 gfx::Transform CC_EXPORT
DrawTransformOfRenderSurfaceReplicaFromPropertyTrees(
155 const RenderSurfaceImpl
* render_surface
,
156 const TransformTree
& tree
);
158 gfx::Transform CC_EXPORT
159 ScreenSpaceTransformOfRenderSurfaceReplicaFromPropertyTrees(
160 const RenderSurfaceImpl
* render_surface
,
161 const TransformTree
& tree
);
165 #endif // CC_TREES_DRAW_PROPERTY_UTILS_H_