| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_VIEW_MATRIX_H_ | 5 #ifndef REMOTING_CLIENT_VIEW_MATRIX_H_ |
| 6 #define REMOTING_CLIENT_VIEW_MATRIX_H_ | 6 #define REMOTING_CLIENT_VIEW_MATRIX_H_ |
| 7 | 7 |
| 8 #include <array> | 8 #include <array> |
| 9 | 9 |
| 10 namespace remoting { | 10 namespace remoting { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // the vector and does not apply offset. | 37 // the vector and does not apply offset. |
| 38 Vector2D MapVector(const Vector2D& vector) const; | 38 Vector2D MapVector(const Vector2D& vector) const; |
| 39 | 39 |
| 40 // Sets the scale factor, with the pivot point at (0, 0). This WON'T affect | 40 // Sets the scale factor, with the pivot point at (0, 0). This WON'T affect |
| 41 // the offset. | 41 // the offset. |
| 42 void SetScale(float scale); | 42 void SetScale(float scale); |
| 43 | 43 |
| 44 // Returns the scale of this matrix. | 44 // Returns the scale of this matrix. |
| 45 float GetScale() const; | 45 float GetScale() const; |
| 46 | 46 |
| 47 // Sets the offset. |
| 48 void SetOffset(const Point& offset); |
| 49 |
| 47 // Adjust the matrix M to M' such that: | 50 // Adjust the matrix M to M' such that: |
| 48 // M * p_a = p_b => M' * p_a = scale * (p_b - pivot) + pivot | 51 // M * p_a = p_b => M' * p_a = scale * (p_b - pivot) + pivot |
| 49 void PostScale(const Point& pivot, float scale); | 52 void PostScale(const Point& pivot, float scale); |
| 50 | 53 |
| 51 // Applies translation to the matrix. | 54 // Applies translation to the matrix. |
| 52 // M * p_a = p_b => M' * p_a = p_b + delta | 55 // M * p_a = p_b => M' * p_a = p_b + delta |
| 53 void PostTranslate(const Vector2D& delta); | 56 void PostTranslate(const Vector2D& delta); |
| 54 | 57 |
| 55 // Returns the inverse of this matrix. | 58 // Returns the inverse of this matrix. |
| 56 ViewMatrix Invert() const; | 59 ViewMatrix Invert() const; |
| 57 | 60 |
| 58 // Returns true if the scale and offsets are both 0. | 61 // Returns true if the scale and offsets are both 0. |
| 59 bool IsEmpty() const; | 62 bool IsEmpty() const; |
| 60 | 63 |
| 61 // Converts to the 3x3 matrix array. | 64 // Converts to the 3x3 matrix array. |
| 62 std::array<float, 9> ToMatrixArray() const; | 65 std::array<float, 9> ToMatrixArray() const; |
| 63 | 66 |
| 64 private: | 67 private: |
| 65 float scale_; | 68 float scale_; |
| 66 Vector2D offset_; | 69 Vector2D offset_; |
| 67 }; | 70 }; |
| 68 | 71 |
| 69 } // namespace remoting | 72 } // namespace remoting |
| 70 | 73 |
| 71 #endif // REMOTING_CLIENT_VIEW_MATRIX_H_ | 74 #endif // REMOTING_CLIENT_VIEW_MATRIX_H_ |
| OLD | NEW |