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

Side by Side Diff: ui/gfx/transform.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: Added tests. 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_operations_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // MSVC++ requires this to be set before any other includes to get M_PI. 5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES 6 #define _USE_MATH_DEFINES
7 7
8 #include "ui/gfx/transform.h" 8 #include "ui/gfx/transform.h"
9 9
10 #include <cmath> 10 #include <cmath>
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 return false; 358 return false;
359 359
360 const SkMatrix& matrix = inverse; 360 const SkMatrix& matrix = inverse;
361 SkRect src = RectFToSkRect(*rect); 361 SkRect src = RectFToSkRect(*rect);
362 matrix.mapRect(&src); 362 matrix.mapRect(&src);
363 *rect = SkRectToRectF(src); 363 *rect = SkRectToRectF(src);
364 return true; 364 return true;
365 } 365 }
366 366
367 bool Transform::Blend(const Transform& from, double progress) { 367 bool Transform::Blend(const Transform& from, double progress) {
368 if (progress <= 0.0) {
369 *this = from;
370 return true;
371 }
372
373 if (progress >= 1.0)
374 return true;
375
ajuma 2013/06/01 14:54:12 Please add a gfx::Transform unit test for this tha
376 DecomposedTransform to_decomp; 368 DecomposedTransform to_decomp;
377 DecomposedTransform from_decomp; 369 DecomposedTransform from_decomp;
378 if (!DecomposeTransform(&to_decomp, *this) || 370 if (!DecomposeTransform(&to_decomp, *this) ||
379 !DecomposeTransform(&from_decomp, from)) 371 !DecomposeTransform(&from_decomp, from))
380 return false; 372 return false;
381 373
382 if (!BlendDecomposedTransforms(&to_decomp, to_decomp, from_decomp, progress)) 374 if (!BlendDecomposedTransforms(&to_decomp, to_decomp, from_decomp, progress))
383 return false; 375 return false;
384 376
385 matrix_ = ComposeTransform(to_decomp).matrix(); 377 matrix_ = ComposeTransform(to_decomp).matrix();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 matrix_.getDouble(2, 1), 434 matrix_.getDouble(2, 1),
443 matrix_.getDouble(2, 2), 435 matrix_.getDouble(2, 2),
444 matrix_.getDouble(2, 3), 436 matrix_.getDouble(2, 3),
445 matrix_.getDouble(3, 0), 437 matrix_.getDouble(3, 0),
446 matrix_.getDouble(3, 1), 438 matrix_.getDouble(3, 1),
447 matrix_.getDouble(3, 2), 439 matrix_.getDouble(3, 2),
448 matrix_.getDouble(3, 3)); 440 matrix_.getDouble(3, 3));
449 } 441 }
450 442
451 } // namespace gfx 443 } // namespace gfx
OLDNEW
« no previous file with comments | « cc/animation/transform_operations_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698