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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/transform_util.h ('k') | ui/gl/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/transform_util.cc
diff --git a/ui/gfx/transform_util.cc b/ui/gfx/transform_util.cc
index 655ce57f2bb2b799cbf7da1b69164d97e5a42dd0..e96d96e6d9cf323a30b277c2f085549382208a46 100644
--- a/ui/gfx/transform_util.cc
+++ b/ui/gfx/transform_util.cc
@@ -498,4 +498,21 @@ std::string DecomposedTransform::ToString() const {
quaternion[3]);
}
+float MatrixDistance(const Transform& a, const Transform& b) {
+ double sum = 0.0;
+
+ const SkMatrix44& a_data = a.matrix();
+ const SkMatrix44& b_data = b.matrix();
+
+ for (int row = 0; row < 4; ++row) {
+ for (int col = 0; col < 4; ++col) {
+ double diff = a_data.get(row, col) - b_data.get(row, col);
+ sum += diff * diff;
+ }
+ }
+
+ return static_cast<float>(std::sqrt(sum));
+}
+
+
} // namespace ui
« 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