Flutter Engine
matrix_decomposition.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
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 FLUTTER_FLOW_MATRIX_DECOMPOSITION_H_
6 #define FLUTTER_FLOW_MATRIX_DECOMPOSITION_H_
7 
8 #include "flutter/fml/macros.h"
9 #include "third_party/skia/include/core/SkM44.h"
10 #include "third_party/skia/include/core/SkMatrix.h"
11 
12 namespace flutter {
13 
14 /// Decomposes a given non-degenerate transformation matrix into a sequence of
15 /// operations that produced it. The validity of the decomposition must always
16 /// be checked before attempting to access any of the decomposed elements.
18  public:
19  MatrixDecomposition(const SkMatrix& matrix);
20 
21  MatrixDecomposition(SkM44 matrix);
22 
24 
25  bool IsValid() const;
26 
27  const SkV3& translation() const { return translation_; }
28 
29  const SkV3& scale() const { return scale_; }
30 
31  const SkV3& shear() const { return shear_; }
32 
33  const SkV4& perspective() const { return perspective_; }
34 
35  const SkV4& rotation() const { return rotation_; }
36 
37  private:
38  bool valid_;
39  SkV3 translation_;
40  SkV3 scale_;
41  SkV3 shear_;
42  SkV4 perspective_;
43  SkV4 rotation_;
44 
45  FML_DISALLOW_COPY_AND_ASSIGN(MatrixDecomposition);
46 };
47 
48 } // namespace flutter
49 
50 #endif // FLUTTER_FLOW_MATRIX_DECOMPOSITION_H_
const SkV4 & perspective() const
const SkV3 & translation() const
MatrixDecomposition(const SkMatrix &matrix)