OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 "remoting/client/gl_math.h" | |
6 | |
7 #include <sstream> | |
8 | |
9 namespace remoting { | |
10 | |
11 void TransposeTransformationMatrix(std::array<float, 9>* matrix) { | |
12 // | ??, m1, m2, | | ??, m3, m6 | | |
13 // | m3, ??, m5, | -> | m1, ??, m7 | | |
14 // | m6, m7, ?? | | m2, m5, ?? | | |
15 std::swap((*matrix)[1], (*matrix)[3]); | |
16 std::swap((*matrix)[2], (*matrix)[6]); | |
17 std::swap((*matrix)[5], (*matrix)[7]); | |
18 } | |
19 | |
20 void FillRectangleVertexPositions(float left, | |
21 float top, | |
22 float width, | |
23 float height, | |
24 std::array<float, 8>* positions) { | |
25 (*positions)[0] = left; | |
26 (*positions)[1] = top; | |
27 | |
28 (*positions)[2] = left; | |
29 (*positions)[3] = top + height; | |
30 | |
31 (*positions)[4] = left + width; | |
32 (*positions)[5] = top; | |
33 | |
34 (*positions)[6] = left + width; | |
35 (*positions)[7] = top + height; | |
36 } | |
37 | |
38 std::string MatrixToString(const float* mat, int num_rows, int num_cols) { | |
39 std::ostringstream outstream; | |
40 outstream << "[\n"; | |
41 for (int i = 0; i < num_rows; i++) { | |
42 for (int j = 0; j < num_cols; j++) { | |
43 outstream << mat[i * num_cols + j] << ", "; | |
44 } | |
45 outstream << "\n"; | |
46 } | |
47 outstream << "]"; | |
48 return outstream.str(); | |
49 } | |
50 | |
51 } // namespace remoting | |
OLD | NEW |