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

Side by Side 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, 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
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "mojo/services/geometry/cpp/geometry_util.h"
6
7 #include <string.h>
8
9 namespace mojo {
10
11 static const float kIdentityMatrix[]{
12 1.f, 0.f, 0.f, 0.f, // comments to prevent
13 0.f, 1.f, 0.f, 0.f, // auto formatter reflow
14 0.f, 0.f, 1.f, 0.f, //
15 0.f, 0.f, 0.f, 1.f};
16
17 void SetIdentityTransform(Transform* transform) {
18 transform->matrix.resize(16u);
19 memcpy(transform->matrix.data(), kIdentityMatrix, sizeof(kIdentityMatrix));
20 }
21
22 void SetTranslationTransform(Transform* transform, float x, float y, float z) {
23 SetIdentityTransform(transform);
24 transform->matrix[3] = x;
25 transform->matrix[7] = y;
26 transform->matrix[11] = z;
27 }
28
29 } // namespace mojo
OLDNEW
« 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