OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkMatrix44.h" | 8 #include "SkMatrix44.h" |
9 | 9 |
10 static inline bool eq4(const SkMScalar* SK_RESTRICT a, | 10 static inline bool eq4(const SkMScalar* SK_RESTRICT a, |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 dst[12] = SkDoubleToMScalar(src[3]); | 179 dst[12] = SkDoubleToMScalar(src[3]); |
180 src += 4; | 180 src += 4; |
181 dst += 1; | 181 dst += 1; |
182 } | 182 } |
183 this->dirtyTypeMask(); | 183 this->dirtyTypeMask(); |
184 } | 184 } |
185 | 185 |
186 /////////////////////////////////////////////////////////////////////////////// | 186 /////////////////////////////////////////////////////////////////////////////// |
187 | 187 |
188 const SkMatrix44& SkMatrix44::I() { | 188 const SkMatrix44& SkMatrix44::I() { |
189 static const SkMatrix44 gIdentity44(kIdentity_Constructor); | 189 static constexpr SkMatrix44 gIdentity44(kIdentity_Constructor); |
190 return gIdentity44; | 190 return gIdentity44; |
191 } | 191 } |
192 | 192 |
193 void SkMatrix44::setIdentity() { | 193 void SkMatrix44::setIdentity() { |
194 fMat[0][0] = 1; | 194 fMat[0][0] = 1; |
195 fMat[0][1] = 0; | 195 fMat[0][1] = 0; |
196 fMat[0][2] = 0; | 196 fMat[0][2] = 0; |
197 fMat[0][3] = 0; | 197 fMat[0][3] = 0; |
198 fMat[1][0] = 0; | 198 fMat[1][0] = 0; |
199 fMat[1][1] = 1; | 199 fMat[1][1] = 1; |
(...skipping 13 matching lines...) Expand all Loading... |
213 void SkMatrix44::set3x3(SkMScalar m00, SkMScalar m01, SkMScalar m02, | 213 void SkMatrix44::set3x3(SkMScalar m00, SkMScalar m01, SkMScalar m02, |
214 SkMScalar m10, SkMScalar m11, SkMScalar m12, | 214 SkMScalar m10, SkMScalar m11, SkMScalar m12, |
215 SkMScalar m20, SkMScalar m21, SkMScalar m22) { | 215 SkMScalar m20, SkMScalar m21, SkMScalar m22) { |
216 fMat[0][0] = m00; fMat[0][1] = m01; fMat[0][2] = m02; fMat[0][3] = 0; | 216 fMat[0][0] = m00; fMat[0][1] = m01; fMat[0][2] = m02; fMat[0][3] = 0; |
217 fMat[1][0] = m10; fMat[1][1] = m11; fMat[1][2] = m12; fMat[1][3] = 0; | 217 fMat[1][0] = m10; fMat[1][1] = m11; fMat[1][2] = m12; fMat[1][3] = 0; |
218 fMat[2][0] = m20; fMat[2][1] = m21; fMat[2][2] = m22; fMat[2][3] = 0; | 218 fMat[2][0] = m20; fMat[2][1] = m21; fMat[2][2] = m22; fMat[2][3] = 0; |
219 fMat[3][0] = 0; fMat[3][1] = 0; fMat[3][2] = 0; fMat[3][3] = 1; | 219 fMat[3][0] = 0; fMat[3][1] = 0; fMat[3][2] = 0; fMat[3][3] = 1; |
220 this->dirtyTypeMask(); | 220 this->dirtyTypeMask(); |
221 } | 221 } |
222 | 222 |
223 void SkMatrix44::set3x3ColMajorf(const float src[]) { | 223 void SkMatrix44::set3x3RowMajorf(const float src[]) { |
224 fMat[0][0] = src[0]; fMat[0][1] = src[3]; fMat[0][2] = src[6]; fMat[0][3] =
0; | 224 fMat[0][0] = src[0]; fMat[0][1] = src[3]; fMat[0][2] = src[6]; fMat[0][3] =
0; |
225 fMat[1][0] = src[1]; fMat[1][1] = src[4]; fMat[1][2] = src[7]; fMat[1][3] =
0; | 225 fMat[1][0] = src[1]; fMat[1][1] = src[4]; fMat[1][2] = src[7]; fMat[1][3] =
0; |
226 fMat[2][0] = src[2]; fMat[2][1] = src[5]; fMat[2][2] = src[8]; fMat[2][3] =
0; | 226 fMat[2][0] = src[2]; fMat[2][1] = src[5]; fMat[2][2] = src[8]; fMat[2][3] =
0; |
227 fMat[3][0] = 0; fMat[3][1] = 0; fMat[3][2] = 0; fMat[3][3] =
1; | 227 fMat[3][0] = 0; fMat[3][1] = 0; fMat[3][2] = 0; fMat[3][3] =
1; |
228 this->dirtyTypeMask(); | 228 this->dirtyTypeMask(); |
229 } | 229 } |
230 | 230 |
231 void SkMatrix44::set4x3ColMajorf(const float src[]) { | 231 void SkMatrix44::set4x3ColMajorf(const float src[]) { |
232 fMat[0][0] = src[0]; fMat[0][1] = src[1]; fMat[0][2] = src[2]; fMat[0][3] =
src[3]; | 232 fMat[0][0] = src[0]; fMat[0][1] = src[1]; fMat[0][2] = src[2]; fMat[0][3] =
src[3]; |
233 fMat[1][0] = src[4]; fMat[1][1] = src[5]; fMat[1][2] = src[6]; fMat[1][3] =
src[7]; | 233 fMat[1][0] = src[4]; fMat[1][1] = src[5]; fMat[1][2] = src[6]; fMat[1][3] =
src[7]; |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 dst[SkMatrix::kMSkewY] = SkMScalarToScalar(fMat[0][1]); | 1014 dst[SkMatrix::kMSkewY] = SkMScalarToScalar(fMat[0][1]); |
1015 dst[SkMatrix::kMScaleY] = SkMScalarToScalar(fMat[1][1]); | 1015 dst[SkMatrix::kMScaleY] = SkMScalarToScalar(fMat[1][1]); |
1016 dst[SkMatrix::kMTransY] = SkMScalarToScalar(fMat[3][1]); | 1016 dst[SkMatrix::kMTransY] = SkMScalarToScalar(fMat[3][1]); |
1017 | 1017 |
1018 dst[SkMatrix::kMPersp0] = SkMScalarToScalar(fMat[0][3]); | 1018 dst[SkMatrix::kMPersp0] = SkMScalarToScalar(fMat[0][3]); |
1019 dst[SkMatrix::kMPersp1] = SkMScalarToScalar(fMat[1][3]); | 1019 dst[SkMatrix::kMPersp1] = SkMScalarToScalar(fMat[1][3]); |
1020 dst[SkMatrix::kMPersp2] = SkMScalarToScalar(fMat[3][3]); | 1020 dst[SkMatrix::kMPersp2] = SkMScalarToScalar(fMat[3][3]); |
1021 | 1021 |
1022 return dst; | 1022 return dst; |
1023 } | 1023 } |
OLD | NEW |