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

Side by Side Diff: cc/math_util.cc

Issue 11418040: gfx::Transform API clean-up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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/math_util.h ('k') | cc/math_util_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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "cc/math_util.h" 5 #include "cc/math_util.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <limits> 8 #include <limits>
9 9
10 #include "ui/gfx/quad_f.h" 10 #include "ui/gfx/quad_f.h"
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 MathUtil::rotateAxisAngle(&rotationAboutX, 1, 0, 0, eulerX); 454 MathUtil::rotateAxisAngle(&rotationAboutX, 1, 0, 0, eulerX);
455 MathUtil::rotateAxisAngle(&rotationAboutY, 0, 1, 0, eulerY); 455 MathUtil::rotateAxisAngle(&rotationAboutY, 0, 1, 0, eulerY);
456 MathUtil::rotateAxisAngle(&rotationAboutZ, 0, 0, 1, eulerZ); 456 MathUtil::rotateAxisAngle(&rotationAboutZ, 0, 0, 1, eulerZ);
457 457
458 gfx::Transform composite = rotationAboutZ * rotationAboutY * rotationAboutX; 458 gfx::Transform composite = rotationAboutZ * rotationAboutY * rotationAboutX;
459 transform->PreconcatTransform(composite); 459 transform->PreconcatTransform(composite);
460 } 460 }
461 461
462 void MathUtil::rotateAxisAngle(gfx::Transform* transform, double i, double j, do uble k, double degrees) 462 void MathUtil::rotateAxisAngle(gfx::Transform* transform, double i, double j, do uble k, double degrees)
463 { 463 {
464 // TODO (shawnsingh): fix gfx::Transform API to receive vector instead of 464 gfx::Vector3dF axis(i, j, k);
465 // point for the axis. 465 transform->RotateAbout(axis, degrees);
466 gfx::Point3F axis(i, j, k);
467 transform->PreconcatRotateAbout(axis, degrees);
468 } 466 }
469 467
470 gfx::Transform MathUtil::inverse(const gfx::Transform& transform) 468 gfx::Transform MathUtil::inverse(const gfx::Transform& transform)
471 { 469 {
472 gfx::Transform result; 470 gfx::Transform result;
473 bool invertedSuccessfully = transform.GetInverse(&result); 471 bool invertedSuccessfully = transform.GetInverse(&result);
474 472
475 if (invertedSuccessfully) 473 if (invertedSuccessfully)
476 return result; 474 return result;
477 475
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 matrix.setDouble(0, 0, a); 536 matrix.setDouble(0, 0, a);
539 matrix.setDouble(1, 0, b); 537 matrix.setDouble(1, 0, b);
540 matrix.setDouble(0, 1, c); 538 matrix.setDouble(0, 1, c);
541 matrix.setDouble(1, 1, d); 539 matrix.setDouble(1, 1, d);
542 matrix.setDouble(0, 3, e); 540 matrix.setDouble(0, 3, e);
543 matrix.setDouble(1, 3, f); 541 matrix.setDouble(1, 3, f);
544 542
545 return result; 543 return result;
546 } 544 }
547 545
548 gfx::Transform operator*(const gfx::Transform& A, const gfx::Transform& B)
549 {
550 // Compute A * B.
551 gfx::Transform result = A;
552 result.PreconcatTransform(B);
553 return result;
554 }
555
556 } // namespace cc 546 } // namespace cc
OLDNEW
« no previous file with comments | « cc/math_util.h ('k') | cc/math_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698