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 <iosfwd> | 8 #include <iosfwd> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // orthographic projection was added to the matrix sequence. | 181 // orthographic projection was added to the matrix sequence. |
182 // - For z values, the new transform overrides any effect that the transform | 182 // - For z values, the new transform overrides any effect that the transform |
183 // had on z, and instead it preserves the z value for any points that are | 183 // had on z, and instead it preserves the z value for any points that are |
184 // transformed. | 184 // transformed. |
185 // - Because of linearity of transforms, this flattened transform also | 185 // - Because of linearity of transforms, this flattened transform also |
186 // preserves the effect that any subsequent (multiplied from the right) | 186 // preserves the effect that any subsequent (multiplied from the right) |
187 // transforms would have on z values. | 187 // transforms would have on z values. |
188 // | 188 // |
189 void FlattenTo2d(); | 189 void FlattenTo2d(); |
190 | 190 |
| 191 // Returns true if the 3rd row and 3rd column are both (0, 0, 1, 0). |
| 192 bool IsFlat() const; |
| 193 |
191 // Returns the x and y translation components of the matrix. | 194 // Returns the x and y translation components of the matrix. |
192 Vector2dF To2dTranslation() const; | 195 Vector2dF To2dTranslation() const; |
193 | 196 |
194 // Applies the transformation to the point. | 197 // Applies the transformation to the point. |
195 void TransformPoint(Point3F* point) const; | 198 void TransformPoint(Point3F* point) const; |
196 | 199 |
197 // Applies the transformation to the point. | 200 // Applies the transformation to the point. |
198 void TransformPoint(Point* point) const; | 201 void TransformPoint(Point* point) const; |
199 | 202 |
200 // Applies the reverse transformation on the point. Returns true if the | 203 // Applies the reverse transformation on the point. Returns true if the |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 }; | 273 }; |
271 | 274 |
272 // This is declared here for use in gtest-based unit tests but is defined in | 275 // This is declared here for use in gtest-based unit tests but is defined in |
273 // the gfx_test_support target. Depend on that to use this in your unit test. | 276 // the gfx_test_support target. Depend on that to use this in your unit test. |
274 // This should not be used in production code - call ToString() instead. | 277 // This should not be used in production code - call ToString() instead. |
275 void PrintTo(const Transform& transform, ::std::ostream* os); | 278 void PrintTo(const Transform& transform, ::std::ostream* os); |
276 | 279 |
277 } // namespace gfx | 280 } // namespace gfx |
278 | 281 |
279 #endif // UI_GFX_TRANSFORM_H_ | 282 #endif // UI_GFX_TRANSFORM_H_ |
OLD | NEW |