OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "cc/layers/layer_utils.h" | 5 #include "cc/layers/layer_utils.h" |
6 | 6 |
7 #include "cc/layers/layer_impl.h" | 7 #include "cc/layers/layer_impl.h" |
8 #include "cc/trees/layer_tree_host_common.h" | 8 #include "cc/trees/layer_tree_host_common.h" |
9 #include "cc/trees/layer_tree_impl.h" | 9 #include "cc/trees/layer_tree_impl.h" |
| 10 #include "cc/trees/transform_node.h" |
10 #include "ui/gfx/geometry/box_f.h" | 11 #include "ui/gfx/geometry/box_f.h" |
11 | 12 |
12 namespace cc { | 13 namespace cc { |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 bool HasTransformAnimationThatInflatesBounds(const LayerImpl& layer) { | 17 bool HasTransformAnimationThatInflatesBounds(const LayerImpl& layer) { |
17 return layer.HasTransformAnimationThatInflatesBounds(); | 18 return layer.HasTransformAnimationThatInflatesBounds(); |
18 } | 19 } |
19 | 20 |
20 inline bool HasAncestorTransformAnimation(const TransformNode* transform_node) { | 21 inline bool HasAncestorTransformAnimation(const TransformNode* transform_node) { |
21 return transform_node->data.to_screen_is_potentially_animated; | 22 return transform_node->to_screen_is_potentially_animated; |
22 } | 23 } |
23 | 24 |
24 inline bool HasAncestorFilterAnimation(const LayerImpl& layer) { | 25 inline bool HasAncestorFilterAnimation(const LayerImpl& layer) { |
25 // This function returns false, it should use the effect tree once filters | 26 // This function returns false, it should use the effect tree once filters |
26 // and filter animations are known by the tree. | 27 // and filter animations are known by the tree. |
27 return false; | 28 return false; |
28 } | 29 } |
29 | 30 |
30 } // namespace | 31 } // namespace |
31 | 32 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 86 |
86 for (; transform_tree.parent(transform_node); | 87 for (; transform_tree.parent(transform_node); |
87 transform_node = transform_tree.parent(transform_node)) { | 88 transform_node = transform_tree.parent(transform_node)) { |
88 LayerImpl* layer = | 89 LayerImpl* layer = |
89 layer_in.layer_tree_impl()->LayerById(transform_node->owner_id); | 90 layer_in.layer_tree_impl()->LayerById(transform_node->owner_id); |
90 | 91 |
91 // Filter animation bounds are unimplemented, see function | 92 // Filter animation bounds are unimplemented, see function |
92 // HasAncestorFilterAnimation() for reference. | 93 // HasAncestorFilterAnimation() for reference. |
93 | 94 |
94 if (HasTransformAnimationThatInflatesBounds(*layer)) { | 95 if (HasTransformAnimationThatInflatesBounds(*layer)) { |
95 coalesced_transform.ConcatTransform(transform_node->data.pre_local); | 96 coalesced_transform.ConcatTransform(transform_node->pre_local); |
96 coalesced_transform.TransformBox(&box); | 97 coalesced_transform.TransformBox(&box); |
97 coalesced_transform.MakeIdentity(); | 98 coalesced_transform.MakeIdentity(); |
98 | 99 |
99 gfx::BoxF inflated; | 100 gfx::BoxF inflated; |
100 if (!layer->TransformAnimationBoundsForBox(box, &inflated)) | 101 if (!layer->TransformAnimationBoundsForBox(box, &inflated)) |
101 return false; | 102 return false; |
102 box = inflated; | 103 box = inflated; |
103 | 104 |
104 coalesced_transform.ConcatTransform(transform_node->data.post_local); | 105 coalesced_transform.ConcatTransform(transform_node->post_local); |
105 } else { | 106 } else { |
106 coalesced_transform.ConcatTransform(transform_node->data.to_parent); | 107 coalesced_transform.ConcatTransform(transform_node->to_parent); |
107 } | 108 } |
108 } | 109 } |
109 | 110 |
110 // If we've got an unapplied coalesced transform at this point, it must still | 111 // If we've got an unapplied coalesced transform at this point, it must still |
111 // be applied. | 112 // be applied. |
112 if (!coalesced_transform.IsIdentity()) | 113 if (!coalesced_transform.IsIdentity()) |
113 coalesced_transform.TransformBox(&box); | 114 coalesced_transform.TransformBox(&box); |
114 | 115 |
115 *out = box; | 116 *out = box; |
116 | 117 |
117 return true; | 118 return true; |
118 } | 119 } |
119 | 120 |
120 } // namespace cc | 121 } // namespace cc |
OLD | NEW |