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

Side by Side Diff: ui/gfx/transform_util.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « ui/gfx/transform_util.h ('k') | ui/gl/BUILD.gn » ('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 (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 #include "ui/gfx/transform_util.h" 5 #include "ui/gfx/transform_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 perspective[0], 491 perspective[0],
492 perspective[1], 492 perspective[1],
493 perspective[2], 493 perspective[2],
494 perspective[3], 494 perspective[3],
495 quaternion[0], 495 quaternion[0],
496 quaternion[1], 496 quaternion[1],
497 quaternion[2], 497 quaternion[2],
498 quaternion[3]); 498 quaternion[3]);
499 } 499 }
500 500
501 float MatrixDistance(const Transform& a, const Transform& b) {
502 double sum = 0.0;
503
504 const SkMatrix44& a_data = a.matrix();
505 const SkMatrix44& b_data = b.matrix();
506
507 for (int row = 0; row < 4; ++row) {
508 for (int col = 0; col < 4; ++col) {
509 double diff = a_data.get(row, col) - b_data.get(row, col);
510 sum += diff * diff;
511 }
512 }
513
514 return static_cast<float>(std::sqrt(sum));
515 }
516
517
501 } // namespace ui 518 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/transform_util.h ('k') | ui/gl/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698