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

Side by Side Diff: cc/animation/transform_operations.cc

Issue 15972006: TransformOperations should be able to blend outside the range [0, 1] (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « cc/animation/transform_operation.cc ('k') | cc/animation/transform_operations_unittest.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/animation/transform_operations.h" 5 #include "cc/animation/transform_operations.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ui/gfx/transform_util.h" 9 #include "ui/gfx/transform_util.h"
10 #include "ui/gfx/vector3d_f.h" 10 #include "ui/gfx/vector3d_f.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 from_identity ? 0 : &from.operations_[i], 157 from_identity ? 0 : &from.operations_[i],
158 to_identity ? 0 : &operations_[i], 158 to_identity ? 0 : &operations_[i],
159 progress, 159 progress,
160 &blended)) 160 &blended))
161 return false; 161 return false;
162 result->PreconcatTransform(blended); 162 result->PreconcatTransform(blended);
163 } 163 }
164 return true; 164 return true;
165 } 165 }
166 166
167 if (progress <= 0.0) {
168 *result = from.Apply();
169 return true;
170 }
171
172 if (progress >= 1.0) {
173 *result = Apply();
174 return true;
175 }
176
177 if (!ComputeDecomposedTransform() || !from.ComputeDecomposedTransform()) 167 if (!ComputeDecomposedTransform() || !from.ComputeDecomposedTransform())
178 return false; 168 return false;
179 169
180 gfx::DecomposedTransform to_return; 170 gfx::DecomposedTransform to_return;
181 if (!gfx::BlendDecomposedTransforms(&to_return, 171 if (!gfx::BlendDecomposedTransforms(&to_return,
182 *decomposed_transform_.get(), 172 *decomposed_transform_.get(),
183 *from.decomposed_transform_.get(), 173 *from.decomposed_transform_.get(),
184 progress)) 174 progress))
185 return false; 175 return false;
186 176
187 *result = ComposeTransform(to_return); 177 *result = ComposeTransform(to_return);
188 return true; 178 return true;
189 } 179 }
190 180
191 bool TransformOperations::ComputeDecomposedTransform() const { 181 bool TransformOperations::ComputeDecomposedTransform() const {
192 if (decomposed_transform_dirty_) { 182 if (decomposed_transform_dirty_) {
193 if (!decomposed_transform_) 183 if (!decomposed_transform_)
194 decomposed_transform_.reset(new gfx::DecomposedTransform()); 184 decomposed_transform_.reset(new gfx::DecomposedTransform());
195 gfx::Transform transform = Apply(); 185 gfx::Transform transform = Apply();
196 if (!gfx::DecomposeTransform(decomposed_transform_.get(), transform)) 186 if (!gfx::DecomposeTransform(decomposed_transform_.get(), transform))
197 return false; 187 return false;
198 decomposed_transform_dirty_ = false; 188 decomposed_transform_dirty_ = false;
199 } 189 }
200 return true; 190 return true;
201 } 191 }
202 192
203 } // namespace cc 193 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/transform_operation.cc ('k') | cc/animation/transform_operations_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698