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 #include "utils/matrix44.h"
17
18 #include "impl_factory.h"
19
20 namespace OHOS {
21 namespace Rosen {
22 namespace Drawing {
Matrix44()23 Matrix44::Matrix44() : impl_(ImplFactory::CreateMatrix44Impl()) {}
24
Translate(scalar dx,scalar dy,scalar dz)25 void Matrix44::Translate(scalar dx, scalar dy, scalar dz)
26 {
27 impl_->Translate(dx, dy, dz);
28 }
29
Scale(scalar sx,scalar sy,scalar sz)30 void Matrix44::Scale(scalar sx, scalar sy, scalar sz)
31 {
32 impl_->Scale(sx, sy, sz);
33 }
34
PreTranslate(scalar dx,scalar dy,scalar dz)35 void Matrix44::PreTranslate(scalar dx, scalar dy, scalar dz)
36 {
37 impl_->PreTranslate(dx, dy, dz);
38 }
39
PostTranslate(scalar dx,scalar dy,scalar dz)40 void Matrix44::PostTranslate(scalar dx, scalar dy, scalar dz)
41 {
42 impl_->PostTranslate(dx, dy, dz);
43 }
44
PreScale(scalar sx,scalar sy,scalar sz)45 void Matrix44::PreScale(scalar sx, scalar sy, scalar sz)
46 {
47 impl_->PreScale(sx, sy, sz);
48 }
49
operator *(const Matrix44 & other)50 Matrix44 Matrix44::operator*(const Matrix44& other)
51 {
52 impl_->Multiply(*this, other);
53 return *this;
54 }
55
56 Matrix44::operator Matrix() const
57 {
58 return impl_->ConvertToMatrix();
59 }
60
SetMatrix44ColMajor(const Buffer & buffer)61 void Matrix44::SetMatrix44ColMajor(const Buffer& buffer)
62 {
63 impl_->SetMatrix44ColMajor(buffer);
64 }
65
SetMatrix44RowMajor(const Buffer & buffer)66 void Matrix44::SetMatrix44RowMajor(const Buffer& buffer)
67 {
68 impl_->SetMatrix44RowMajor(buffer);
69 }
70
SetCol(int column,scalar x,scalar y,scalar z,scalar w)71 void Matrix44::SetCol(int column, scalar x, scalar y, scalar z, scalar w)
72 {
73 impl_->SetCol(column, x, y, z, w);
74 }
75
76 } // namespace Drawing
77 } // namespace Rosen
78 } // namespace OHOS
79