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

Unified Diff: mojo/services/geometry/cpp/geometry_util.cc

Issue 1537633005: Extend the geometry APIs. (Closed) Base URL: git@github.com:domokit/mojo.git@moz-10
Patch Set: rebase Created 4 years, 11 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 | « mojo/services/geometry/cpp/geometry_util.h ('k') | mojo/services/geometry/interfaces/geometry.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/services/geometry/cpp/geometry_util.cc
diff --git a/mojo/services/geometry/cpp/geometry_util.cc b/mojo/services/geometry/cpp/geometry_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..570f707a2462db19f7e2cbfeb79c8308e8b5c573
--- /dev/null
+++ b/mojo/services/geometry/cpp/geometry_util.cc
@@ -0,0 +1,29 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/services/geometry/cpp/geometry_util.h"
+
+#include <string.h>
+
+namespace mojo {
+
+static const float kIdentityMatrix[]{
+ 1.f, 0.f, 0.f, 0.f, // comments to prevent
+ 0.f, 1.f, 0.f, 0.f, // auto formatter reflow
+ 0.f, 0.f, 1.f, 0.f, //
+ 0.f, 0.f, 0.f, 1.f};
+
+void SetIdentityTransform(Transform* transform) {
+ transform->matrix.resize(16u);
+ memcpy(transform->matrix.data(), kIdentityMatrix, sizeof(kIdentityMatrix));
+}
+
+void SetTranslationTransform(Transform* transform, float x, float y, float z) {
+ SetIdentityTransform(transform);
+ transform->matrix[3] = x;
+ transform->matrix[7] = y;
+ transform->matrix[11] = z;
+}
+
+} // namespace mojo
« no previous file with comments | « mojo/services/geometry/cpp/geometry_util.h ('k') | mojo/services/geometry/interfaces/geometry.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698