Chromium Code Reviews| OLD | NEW |
|---|---|
| (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> | |
|
viettrungluu
2015/12/11 00:15:13
You want <string.h> (or <cstring>) for memcpy, not
jeffbrown
2015/12/11 19:40:55
Done.
| |
| 6 #include "mojo/services/geometry/cpp/geometry_util.h" | |
| 7 | |
| 8 namespace mojo { | |
| 9 | |
| 10 static float kIdentityMatrix[]{1.f, 0.f, 0.f, 0.f, // comments to prevent | |
|
abarth-chromium
2015/12/10 22:49:53
const ?
jeffbrown
2015/12/11 19:40:55
Done.
| |
| 11 0.f, 1.f, 0.f, 0.f, // auto formatter reflow | |
| 12 0.f, 0.f, 1.f, 0.f, // | |
| 13 0.f, 0.f, 0.f, 1.f}; | |
| 14 | |
| 15 void SetIdentityTransform(Transform* transform) { | |
| 16 transform->matrix.resize(16u); | |
| 17 memcpy(transform->matrix.data(), kIdentityMatrix, sizeof(kIdentityMatrix)); | |
| 18 } | |
| 19 | |
| 20 void SetTranslationTransform(Transform* transform, float x, float y, float z) { | |
| 21 SetIdentityTransform(transform); | |
| 22 transform->matrix[3] = x; | |
| 23 transform->matrix[7] = y; | |
| 24 transform->matrix[11] = z; | |
| 25 } | |
| 26 | |
| 27 } // namespace mojo | |
| OLD | NEW |