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

Side by Side Diff: mojo/services/geometry/cpp/geometry_util.cc

Issue 1517853002: Extend the geometry APIs. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: rebase Created 5 years 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 | « mojo/services/geometry/cpp/geometry_util.h ('k') | mojo/services/geometry/cpp/logging.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string.h>
6 #include "mojo/services/geometry/cpp/geometry_util.h"
7
8 namespace mojo {
9
10 static const float kIdentityMatrix[]{
11 1.f, 0.f, 0.f, 0.f, // comments to prevent
12 0.f, 1.f, 0.f, 0.f, // auto formatter reflow
13 0.f, 0.f, 1.f, 0.f, //
14 0.f, 0.f, 0.f, 1.f};
15
16 void SetIdentityTransform(Transform* transform) {
17 transform->matrix.resize(16u);
18 memcpy(transform->matrix.data(), kIdentityMatrix, sizeof(kIdentityMatrix));
19 }
20
21 void SetTranslationTransform(Transform* transform, float x, float y, float z) {
22 SetIdentityTransform(transform);
23 transform->matrix[3] = x;
24 transform->matrix[7] = y;
25 transform->matrix[11] = z;
26 }
27
28 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/geometry/cpp/geometry_util.h ('k') | mojo/services/geometry/cpp/logging.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698