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 #ifdef NEW_SKIA 20 #include "include/core/SkM44.h" 21 #else 22 #include "include/core/SkMatrix44.h" 23 #endif 24 #include "impl_interface/matrix44_impl.h" 25 26 namespace OHOS { 27 namespace Rosen { 28 namespace Drawing { 29 class SkiaMatrix44 : public Matrix44Impl { 30 public: 31 static inline constexpr AdapterType TYPE = AdapterType::SKIA_ADAPTER; 32 SkiaMatrix44(); ~SkiaMatrix44()33 ~SkiaMatrix44() override {} GetType()34 AdapterType GetType() const override 35 { 36 return AdapterType::SKIA_ADAPTER; 37 } 38 39 void Translate(scalar dx, scalar dy, scalar dz) override; 40 void Scale(scalar sx, scalar sy, scalar sz) override; 41 void Multiply(const Matrix44& a, const Matrix44& b) override; 42 void SetMatrix44(const std::array<scalar, MATRIX44_SIZE>& buffer) override; 43 Matrix ConvertToMatrix() override; 44 45 /* 46 * @brief Export Skia member variables for use by the adaptation layer. 47 */ 48 #ifdef NEW_SKIA 49 const SkM44& GetSkMatrix44() const; 50 #else 51 const SkMatrix44& GetSkMatrix44() const; 52 #endif 53 54 private: 55 #ifdef NEW_SKIA 56 SkM44 skMatrix44_; 57 #else 58 SkMatrix44 skMatrix44_; 59 #endif 60 }; 61 } // namespace Drawing 62 } // namespace Rosen 63 } // namespace OHOS 64 #endif 65