Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: cc/layers/layer_utils.cc

Issue 1010663002: CC Animations: Redirect all compositor animation requests to AnimationHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@introduce
Patch Set: Rebase. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/test/layer_tree_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "ui/gfx/geometry/box_f.h" 9 #include "ui/gfx/geometry/box_f.h"
10 10
11 namespace cc { 11 namespace cc {
12 12
13 namespace { 13 namespace {
14 14
15 bool HasAnimationThatInflatesBounds(const LayerImpl& layer) { 15 bool HasAnimationThatInflatesBounds(const LayerImpl& layer) {
16 return layer.layer_animation_controller()->HasAnimationThatInflatesBounds(); 16 return layer.HasAnimationThatInflatesBounds();
17 } 17 }
18 18
19 bool HasFilterAnimationThatInflatesBounds(const LayerImpl& layer) { 19 bool HasFilterAnimationThatInflatesBounds(const LayerImpl& layer) {
20 return layer.layer_animation_controller() 20 return layer.HasFilterAnimationThatInflatesBounds();
21 ->HasFilterAnimationThatInflatesBounds();
22 } 21 }
23 22
24 bool HasTransformAnimationThatInflatesBounds(const LayerImpl& layer) { 23 bool HasTransformAnimationThatInflatesBounds(const LayerImpl& layer) {
25 return layer.layer_animation_controller() 24 return layer.HasTransformAnimationThatInflatesBounds();
26 ->HasTransformAnimationThatInflatesBounds();
27 } 25 }
28 26
29 inline bool HasAncestorTransformAnimation(const LayerImpl& layer) { 27 inline bool HasAncestorTransformAnimation(const LayerImpl& layer) {
30 return layer.screen_space_transform_is_animating(); 28 return layer.screen_space_transform_is_animating();
31 } 29 }
32 30
33 inline bool HasAncestorFilterAnimation(const LayerImpl& layer) { 31 inline bool HasAncestorFilterAnimation(const LayerImpl& layer) {
34 for (const LayerImpl* current = &layer; current; 32 for (const LayerImpl* current = &layer; current;
35 current = current->parent()) { 33 current = current->parent()) {
36 if (HasFilterAnimationThatInflatesBounds(*current)) 34 if (HasFilterAnimationThatInflatesBounds(*current))
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 103
106 // We need to apply the inflation about the layer's anchor point. Rather 104 // We need to apply the inflation about the layer's anchor point. Rather
107 // than doing this via transforms, we'll just shift the box directly. 105 // than doing this via transforms, we'll just shift the box directly.
108 box.set_origin(box.origin() + gfx::Vector3dF(-transform_origin_x, 106 box.set_origin(box.origin() + gfx::Vector3dF(-transform_origin_x,
109 -transform_origin_y, 107 -transform_origin_y,
110 -transform_origin_z)); 108 -transform_origin_z));
111 109
112 // Perform the inflation 110 // Perform the inflation
113 if (HasFilterAnimationThatInflatesBounds(*layer)) { 111 if (HasFilterAnimationThatInflatesBounds(*layer)) {
114 gfx::BoxF inflated; 112 gfx::BoxF inflated;
115 if (!layer->layer_animation_controller()->FilterAnimationBoundsForBox( 113 if (!layer->FilterAnimationBoundsForBox(box, &inflated))
116 box, &inflated))
117 return false; 114 return false;
118 box = inflated; 115 box = inflated;
119 } 116 }
120 117
121 if (HasTransformAnimationThatInflatesBounds(*layer)) { 118 if (HasTransformAnimationThatInflatesBounds(*layer)) {
122 gfx::BoxF inflated; 119 gfx::BoxF inflated;
123 if (!layer->layer_animation_controller()->TransformAnimationBoundsForBox( 120 if (!layer->TransformAnimationBoundsForBox(box, &inflated))
124 box, &inflated))
125 return false; 121 return false;
126 box = inflated; 122 box = inflated;
127 } 123 }
128 124
129 // Apply step 3) mentioned above. 125 // Apply step 3) mentioned above.
130 box.set_origin(box.origin() + 126 box.set_origin(box.origin() +
131 gfx::Vector3dF(transform_origin_x + position.x(), 127 gfx::Vector3dF(transform_origin_x + position.x(),
132 transform_origin_y + position.y(), 128 transform_origin_y + position.y(),
133 transform_origin_z)); 129 transform_origin_z));
134 } 130 }
135 131
136 // If we've got an unapplied coalesced transform at this point, it must still 132 // If we've got an unapplied coalesced transform at this point, it must still
137 // be applied. 133 // be applied.
138 if (!coalesced_transform.IsIdentity()) 134 if (!coalesced_transform.IsIdentity())
139 coalesced_transform.TransformBox(&box); 135 coalesced_transform.TransformBox(&box);
140 136
141 *out = box; 137 *out = box;
142 138
143 return true; 139 return true;
144 } 140 }
145 141
146 } // namespace cc 142 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/test/layer_tree_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698