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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 void ConcatTransform(const Transform& transform); | 71 void ConcatTransform(const Transform& transform); |
72 | 72 |
73 // Returns true if this is the identity matrix. | 73 // Returns true if this is the identity matrix. |
74 bool IsIdentity() const { return matrix_.isIdentity(); } | 74 bool IsIdentity() const { return matrix_.isIdentity(); } |
75 | 75 |
76 // Returns true if the matrix is either identity or pure translation. | 76 // Returns true if the matrix is either identity or pure translation. |
77 bool IsIdentityOrTranslation() const { | 77 bool IsIdentityOrTranslation() const { |
78 return !(matrix_.getType() & ~SkMatrix44::kTranslate_Mask); | 78 return !(matrix_.getType() & ~SkMatrix44::kTranslate_Mask); |
79 } | 79 } |
80 | 80 |
81 // Returns true if the matrix is either a positive scale and/or a translation | |
danakj
2013/01/04 21:17:57
nit: missing a period on the end of the sentence.
| |
82 bool IsPositiveScaleOrTranslation() const { | |
83 if (!IsScaleOrTranslation()) | |
84 return false; | |
85 return matrix_.getDouble(0, 0) > 0.0 && | |
86 matrix_.getDouble(1, 1) > 0.0 && | |
87 matrix_.getDouble(2, 2) > 0.0; | |
88 } | |
89 | |
81 // Returns true if the matrix is either identity or pure, non-fractional | 90 // Returns true if the matrix is either identity or pure, non-fractional |
82 // translation. | 91 // translation. |
83 bool IsIdentityOrIntegerTranslation() const; | 92 bool IsIdentityOrIntegerTranslation() const; |
84 | 93 |
85 // Returns true if the matrix is has only scaling and translation components. | 94 // Returns true if the matrix is has only scaling and translation components. |
86 bool IsScaleOrTranslation() const; | 95 bool IsScaleOrTranslation() const; |
87 | 96 |
88 // Returns true if the matrix has any perspective component that would | 97 // Returns true if the matrix has any perspective component that would |
89 // change the w-component of a homogeneous point. | 98 // change the w-component of a homogeneous point. |
90 bool HasPerspective() const; | 99 bool HasPerspective() const; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 Point3F& point) const; | 169 Point3F& point) const; |
161 | 170 |
162 SkMatrix44 matrix_; | 171 SkMatrix44 matrix_; |
163 | 172 |
164 // copy/assign are allowed. | 173 // copy/assign are allowed. |
165 }; | 174 }; |
166 | 175 |
167 } // namespace gfx | 176 } // namespace gfx |
168 | 177 |
169 #endif // UI_GFX_TRANSFORM_H_ | 178 #endif // UI_GFX_TRANSFORM_H_ |
OLD | NEW |