blob: e93a5dc41d8bdd12e4c3aea0ce426acab6082d10 [file] [log] [blame]
Xianzhu Wang3ffdb1d42022-10-26 23:22:251// 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 Leeba222e72024-11-21 04:18:448#include "base/component_export.h"
Xianzhu Wang3ffdb1d42022-10-26 23:22:259#include "base/dcheck_is_on.h"
Xianzhu Wang3ffdb1d42022-10-26 23:22:2510#include "ui/gfx/geometry/quaternion.h"
11
12namespace gfx {
13
14// Contains the components of a factored transform. These components may be
15// blended and recomposed.
Kalvin Leeba222e72024-11-21 04:18:4416struct COMPONENT_EXPORT(GEOMETRY) DecomposedTransform {
Xianzhu Wang3ffdb1d42022-10-26 23:22:2517 // 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.
31void PrintTo(const DecomposedTransform&, ::std::ostream* os);
32
33} // namespace gfx
34
35#endif // UI_GFX_GEOMETRY_DECOMPOSED_TRANSFORM_H_