Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef REMOTING_CLIENT_OPENGL_GL_MATH_H_ | 5 #ifndef REMOTING_CLIENT_OPENGL_GL_MATH_H_ |
| 6 #define REMOTING_CLIENT_OPENGL_GL_MATH_H_ | 6 #define REMOTING_CLIENT_OPENGL_GL_MATH_H_ |
| 7 | 7 |
| 8 #include <array> | 8 #include <array> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 // | 21 // |
| 22 // | m0, m1, m2, | | x | | 22 // | m0, m1, m2, | | x | |
| 23 // | m3, m4, m5, | * | y | | 23 // | m3, m4, m5, | * | y | |
| 24 // | m6, m7, m8 | | 1 | | 24 // | m6, m7, m8 | | 1 | |
| 25 void NormalizeTransformationMatrix(int view_width, | 25 void NormalizeTransformationMatrix(int view_width, |
| 26 int view_height, | 26 int view_height, |
| 27 int canvas_width, | 27 int canvas_width, |
| 28 int canvas_height, | 28 int canvas_height, |
| 29 std::array<float, 9>* matrix); | 29 std::array<float, 9>* matrix); |
| 30 | 30 |
| 31 // Transposes matrix [ m0 ,0, m2, 0, m4, m5, 0, 0, m8 ]: | |
| 32 // | |
| 33 // | m0, 0, m2, | | x | | |
| 34 // | 0, m4, m5, | * | y | | |
| 35 // | 0, 0, m8 | | 1 | | |
| 36 // | |
| 37 // Into [ m0, 0, 0, 0 ,m4, 0, m2, m5, m8 ]. | |
| 38 // The result is only valid if m1=m3=m6=m7=0. | |
|
Sergey Ulanov
2016/07/27 18:36:41
Why do you need this requirement?
Yuwei
2016/07/27 18:44:01
If I remove this constraint then I will need to sw
Yuwei
2016/07/27 18:54:08
Done.
| |
| 39 void TransposeTransformationMatrix(std::array<float, 9>* matrix); | |
| 40 | |
| 31 // Given left, top, width, height of a rectangle, fills |positions| with | 41 // Given left, top, width, height of a rectangle, fills |positions| with |
| 32 // coordinates of four vertices of the rectangle. | 42 // coordinates of four vertices of the rectangle. |
| 33 // positions: [ x_upperleft, y_upperleft, x_lowerleft, y_lowerleft, | 43 // positions: [ x_upperleft, y_upperleft, x_lowerleft, y_lowerleft, |
| 34 // x_upperright, y_upperright, x_lowerright, y_lowerright ] | 44 // x_upperright, y_upperright, x_lowerright, y_lowerright ] |
| 35 void FillRectangleVertexPositions(float left, | 45 void FillRectangleVertexPositions(float left, |
| 36 float top, | 46 float top, |
| 37 float width, | 47 float width, |
| 38 float height, | 48 float height, |
| 39 std::array<float, 8>* positions); | 49 std::array<float, 8>* positions); |
| 40 | 50 |
| 41 // Returns the string representation of the matrix for debugging. | 51 // Returns the string representation of the matrix for debugging. |
| 42 // | 52 // |
| 43 // For example: | 53 // For example: |
| 44 // [ | 54 // [ |
| 45 // 1, 0, 0, | 55 // 1, 0, 0, |
| 46 // 0, 1, 0, | 56 // 0, 1, 0, |
| 47 // 0, 0, 1, | 57 // 0, 0, 1, |
| 48 // ] | 58 // ] |
| 49 std::string MatrixToString(const float* mat, int num_rows, int num_cols); | 59 std::string MatrixToString(const float* mat, int num_rows, int num_cols); |
| 50 | 60 |
| 51 } // namespace remoting | 61 } // namespace remoting |
| 52 | 62 |
| 53 #endif // REMOTING_CLIENT_OPENGL_GL_MATH_H_ | 63 #endif // REMOTING_CLIENT_OPENGL_GL_MATH_H_ |
| OLD | NEW |