1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef SKIA_MATRIX44_H
17 #define SKIA_MATRIX44_H
18 
19 #include "impl_interface/matrix44_impl.h"
20 #include "include/core/SkM44.h"
21 
22 namespace OHOS {
23 namespace Rosen {
24 namespace Drawing {
25 class SkiaMatrix44 : public Matrix44Impl {
26 public:
27     static inline constexpr AdapterType TYPE = AdapterType::SKIA_ADAPTER;
28 
29     SkiaMatrix44();
~SkiaMatrix44()30     ~SkiaMatrix44() override {}
31 
GetType()32     AdapterType GetType() const override
33     {
34         return AdapterType::SKIA_ADAPTER;
35     }
36 
37     void Translate(scalar dx, scalar dy, scalar dz) override;
38     void Scale(scalar sx, scalar sy, scalar sz) override;
39     void PreTranslate(scalar dx, scalar dy, scalar dz) override;
40     void PostTranslate(scalar dx, scalar dy, scalar dz) override;
41     void PreScale(scalar sx, scalar sy, scalar sz) override;
42     void Multiply(const Matrix44& a, const Matrix44& b) override;
43     void SetCol(int column, scalar x, scalar y, scalar z, scalar w) override;
44     void SetMatrix44ColMajor(const std::array<scalar, MATRIX44_SIZE>& buffer) override;
45     void SetMatrix44RowMajor(const std::array<scalar, MATRIX44_SIZE>& buffer) override;
46     Matrix ConvertToMatrix() override;
47 
48     /*
49      * @brief  Export Skia member variables for use by the adaptation layer.
50      */
51     const SkM44& GetSkMatrix44() const;
52 
53 private:
54     SkM44 skMatrix44_;
55 };
56 } // namespace Drawing
57 } // namespace Rosen
58 } // namespace OHOS
59 #endif
60