OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_GFX_TRANSFORM_H_ | 5 #ifndef UI_GFX_TRANSFORM_H_ |
6 #define UI_GFX_TRANSFORM_H_ | 6 #define UI_GFX_TRANSFORM_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "third_party/skia/include/utils/SkMatrix44.h" | 9 #include "third_party/skia/include/utils/SkMatrix44.h" |
10 #include "ui/base/ui_export.h" | 10 #include "ui/base/ui_export.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // Resets this transform to the identity transform. | 29 // Resets this transform to the identity transform. |
30 void MakeIdentity(); | 30 void MakeIdentity(); |
31 | 31 |
32 // Applies the current transformation on a rotation and assigns the result | 32 // Applies the current transformation on a rotation and assigns the result |
33 // to |this|. | 33 // to |this|. |
34 void Rotate(double degree); | 34 void Rotate(double degree); |
35 | 35 |
36 // Applies the current transformation on an axis-angle rotation and assigns | 36 // Applies the current transformation on an axis-angle rotation and assigns |
37 // the result to |this|. | 37 // the result to |this|. |
38 void RotateAbout(const Vector3dF& point, double degree); | 38 void RotateAbout(const Vector3dF& axis, double degree); |
39 | 39 |
40 // Applies the current transformation on a scaling and assigns the result | 40 // Applies the current transformation on a scaling and assigns the result |
41 // to |this|. | 41 // to |this|. |
42 void Scale(double x, double y); | 42 void Scale(double x, double y); |
43 void Scale3d(double x, double y, double z); | 43 void Scale3d(double x, double y, double z); |
44 | 44 |
45 // Applies the current transformation on a translation and assigns the result | 45 // Applies the current transformation on a translation and assigns the result |
46 // to |this|. | 46 // to |this|. |
47 void Translate(double x, double y); | 47 void Translate(double x, double y); |
48 void Translate3d(double x, double y, double z); | 48 void Translate3d(double x, double y, double z); |
(...skipping 11 matching lines...) Expand all Loading... |
60 // (i.e. 'this = this * transform;'). | 60 // (i.e. 'this = this * transform;'). |
61 void PreconcatTransform(const Transform& transform); | 61 void PreconcatTransform(const Transform& transform); |
62 | 62 |
63 // Applies a transformation on the current transformation | 63 // Applies a transformation on the current transformation |
64 // (i.e. 'this = transform * this;'). | 64 // (i.e. 'this = transform * this;'). |
65 void ConcatTransform(const Transform& transform); | 65 void ConcatTransform(const Transform& transform); |
66 | 66 |
67 // Returns true if this is the identity matrix. | 67 // Returns true if this is the identity matrix. |
68 bool IsIdentity() const; | 68 bool IsIdentity() const; |
69 | 69 |
| 70 // Returns true if the matrix is either identity or pure translation. |
| 71 bool IsIdentityOrTranslation() const; |
| 72 |
| 73 // Returns true if the matrix is has only scaling and translation components. |
| 74 bool IsScaleOrTranslation() const; |
| 75 |
| 76 // Returns true if the matrix has any perspective component that would |
| 77 // change the w-component of a homogeneous point. |
| 78 bool HasPerspective() const; |
| 79 |
70 // Returns true if this transform is non-singular. | 80 // Returns true if this transform is non-singular. |
71 bool IsInvertible() const; | 81 bool IsInvertible() const; |
72 | 82 |
| 83 // Returns true if a layer with a forward-facing normal of (0, 0, 1) would |
| 84 // have its back side facing frontwards after applying the transform. |
| 85 bool IsBackFaceVisible() const; |
| 86 |
73 // Inverts the transform which is passed in. Returns true if successful. | 87 // Inverts the transform which is passed in. Returns true if successful. |
74 bool GetInverse(Transform* transform) const WARN_UNUSED_RESULT; | 88 bool GetInverse(Transform* transform) const WARN_UNUSED_RESULT; |
75 | 89 |
76 // Transposes this transform in place. | 90 // Transposes this transform in place. |
77 void Transpose(); | 91 void Transpose(); |
78 | 92 |
79 // Applies the transformation on the point. Returns true if the point is | 93 // Applies the transformation on the point. Returns true if the point is |
80 // transformed successfully. | 94 // transformed successfully. |
81 void TransformPoint(Point3F& point) const; | 95 void TransformPoint(Point3F& point) const; |
82 | 96 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 Point3F& point) const; | 146 Point3F& point) const; |
133 | 147 |
134 SkMatrix44 matrix_; | 148 SkMatrix44 matrix_; |
135 | 149 |
136 // copy/assign are allowed. | 150 // copy/assign are allowed. |
137 }; | 151 }; |
138 | 152 |
139 } // namespace gfx | 153 } // namespace gfx |
140 | 154 |
141 #endif // UI_GFX_TRANSFORM_H_ | 155 #endif // UI_GFX_TRANSFORM_H_ |
OLD | NEW |