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 | |
Alexander Cooper | ae2b9d0 | 2025-01-06 20:50:39 | [diff] [blame] | 8 | #include <array> |
| 9 | |
Kalvin Lee | ba222e7 | 2024-11-21 04:18:44 | [diff] [blame] | 10 | #include "base/component_export.h" |
Xianzhu Wang | 3ffdb1d4 | 2022-10-26 23:22:25 | [diff] [blame] | 11 | #include "base/dcheck_is_on.h" |
Xianzhu Wang | 3ffdb1d4 | 2022-10-26 23:22:25 | [diff] [blame] | 12 | #include "ui/gfx/geometry/quaternion.h" |
| 13 | |
| 14 | namespace gfx { |
| 15 | |
| 16 | // Contains the components of a factored transform. These components may be |
| 17 | // blended and recomposed. |
Kalvin Lee | ba222e7 | 2024-11-21 04:18:44 | [diff] [blame] | 18 | struct COMPONENT_EXPORT(GEOMETRY) DecomposedTransform { |
Xianzhu Wang | 3ffdb1d4 | 2022-10-26 23:22:25 | [diff] [blame] | 19 | // The default constructor initializes the components in such a way that |
| 20 | // will compose the identity transform. |
Alexander Cooper | ae2b9d0 | 2025-01-06 20:50:39 | [diff] [blame] | 21 | std::array<double, 3u> translate = {0, 0, 0}; |
| 22 | std::array<double, 3u> scale = {1, 1, 1}; |
| 23 | std::array<double, 3u> skew = {0, 0, 0}; |
| 24 | std::array<double, 4u> perspective = {0, 0, 0, 1}; |
Xianzhu Wang | 3ffdb1d4 | 2022-10-26 23:22:25 | [diff] [blame] | 25 | Quaternion quaternion; |
| 26 | |
| 27 | std::string ToString() const; |
| 28 | }; |
| 29 | |
| 30 | // This is declared here for use in gtest-based unit tests but is defined in |
| 31 | // the //ui/gfx:test_support target. Depend on that to use this in your unit |
| 32 | // test. This should not be used in production code - call ToString() instead. |
| 33 | void PrintTo(const DecomposedTransform&, ::std::ostream* os); |
| 34 | |
| 35 | } // namespace gfx |
| 36 | |
| 37 | #endif // UI_GFX_GEOMETRY_DECOMPOSED_TRANSFORM_H_ |