Xianzhu Wang | 3ffdb1d4 | 2022-10-26 23:22:25 | [diff] [blame] | 1 | // Copyright 2022 The Chromium Authors |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef UI_GFX_GEOMETRY_DECOMPOSED_TRANSFORM_H_ |
| 6 | #define UI_GFX_GEOMETRY_DECOMPOSED_TRANSFORM_H_ |
| 7 | |
Kalvin Lee | ba222e7 | 2024-11-21 04:18:44 | [diff] [blame^] | 8 | #include "base/component_export.h" |
Xianzhu Wang | 3ffdb1d4 | 2022-10-26 23:22:25 | [diff] [blame] | 9 | #include "base/dcheck_is_on.h" |
Xianzhu Wang | 3ffdb1d4 | 2022-10-26 23:22:25 | [diff] [blame] | 10 | #include "ui/gfx/geometry/quaternion.h" |
| 11 | |
| 12 | namespace gfx { |
| 13 | |
| 14 | // Contains the components of a factored transform. These components may be |
| 15 | // blended and recomposed. |
Kalvin Lee | ba222e7 | 2024-11-21 04:18:44 | [diff] [blame^] | 16 | struct COMPONENT_EXPORT(GEOMETRY) DecomposedTransform { |
Xianzhu Wang | 3ffdb1d4 | 2022-10-26 23:22:25 | [diff] [blame] | 17 | // The default constructor initializes the components in such a way that |
| 18 | // will compose the identity transform. |
| 19 | double translate[3] = {0, 0, 0}; |
| 20 | double scale[3] = {1, 1, 1}; |
| 21 | double skew[3] = {0, 0, 0}; |
| 22 | double perspective[4] = {0, 0, 0, 1}; |
| 23 | Quaternion quaternion; |
| 24 | |
| 25 | std::string ToString() const; |
| 26 | }; |
| 27 | |
| 28 | // This is declared here for use in gtest-based unit tests but is defined in |
| 29 | // the //ui/gfx:test_support target. Depend on that to use this in your unit |
| 30 | // test. This should not be used in production code - call ToString() instead. |
| 31 | void PrintTo(const DecomposedTransform&, ::std::ostream* os); |
| 32 | |
| 33 | } // namespace gfx |
| 34 | |
| 35 | #endif // UI_GFX_GEOMETRY_DECOMPOSED_TRANSFORM_H_ |