OLD | NEW |
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 Loading... |
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 |
OLD | NEW |