OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkMatrix_DEFINED | 10 #ifndef SkMatrix_DEFINED |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 fMat[kMTransX] = transX; | 167 fMat[kMTransX] = transX; |
168 fMat[kMSkewY] = skewY; | 168 fMat[kMSkewY] = skewY; |
169 fMat[kMScaleY] = scaleY; | 169 fMat[kMScaleY] = scaleY; |
170 fMat[kMTransY] = transY; | 170 fMat[kMTransY] = transY; |
171 fMat[kMPersp0] = persp0; | 171 fMat[kMPersp0] = persp0; |
172 fMat[kMPersp1] = persp1; | 172 fMat[kMPersp1] = persp1; |
173 fMat[kMPersp2] = persp2; | 173 fMat[kMPersp2] = persp2; |
174 this->setTypeMask(kUnknown_Mask); | 174 this->setTypeMask(kUnknown_Mask); |
175 } | 175 } |
176 | 176 |
| 177 /** |
| 178 * Copy the 9 scalars for this matrix into buffer, in the same order as the
kMScaleX |
| 179 * enum... scalex, skewx, transx, skewy, scaley, transy, persp0, persp1, pe
rsp2 |
| 180 */ |
| 181 void get9(SkScalar buffer[9]) const { |
| 182 memcpy(buffer, fMat, 9 * sizeof(SkScalar)); |
| 183 } |
| 184 |
| 185 /** |
| 186 * Set this matrix to the 9 scalars from the buffer, in the same order as t
he kMScaleX |
| 187 * enum... scalex, skewx, transx, skewy, scaley, transy, persp0, persp1, pe
rsp2 |
| 188 * |
| 189 * Note: calling set9 followed by get9 may not return the exact same values
. Since the matrix |
| 190 * is used to map non-homogeneous coordinates, it is free to rescale the 9
values as needed. |
| 191 */ |
| 192 void set9(const SkScalar buffer[9]); |
| 193 |
177 /** Set the matrix to identity | 194 /** Set the matrix to identity |
178 */ | 195 */ |
179 void reset(); | 196 void reset(); |
180 // alias for reset() | 197 // alias for reset() |
181 void setIdentity() { this->reset(); } | 198 void setIdentity() { this->reset(); } |
182 | 199 |
183 /** Set the matrix to translate by (dx, dy). | 200 /** Set the matrix to translate by (dx, dy). |
184 */ | 201 */ |
185 void setTranslate(SkScalar dx, SkScalar dy); | 202 void setTranslate(SkScalar dx, SkScalar dy); |
186 void setTranslate(const SkVector& v) { this->setTranslate(v.fX, v.fY); } | 203 void setTranslate(const SkVector& v) { this->setTranslate(v.fX, v.fY); } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 @param affine The array to fill with affine identity values. | 382 @param affine The array to fill with affine identity values. |
366 Must not be NULL. | 383 Must not be NULL. |
367 */ | 384 */ |
368 static void SetAffineIdentity(SkScalar affine[6]); | 385 static void SetAffineIdentity(SkScalar affine[6]); |
369 | 386 |
370 /** Fills the passed array with the affine values in column major order. | 387 /** Fills the passed array with the affine values in column major order. |
371 If the matrix is a perspective transform, returns false | 388 If the matrix is a perspective transform, returns false |
372 and does not change the passed array. | 389 and does not change the passed array. |
373 @param affine The array to fill with affine values. Ignored if NULL. | 390 @param affine The array to fill with affine values. Ignored if NULL. |
374 */ | 391 */ |
375 bool asAffine(SkScalar affine[6]) const; | 392 bool SK_WARN_UNUSED_RESULT asAffine(SkScalar affine[6]) const; |
| 393 |
| 394 /** Set the matrix to the specified affine values. |
| 395 * Note: these are passed in column major order. |
| 396 */ |
| 397 void setAffine(const SkScalar affine[6]); |
376 | 398 |
377 /** Apply this matrix to the array of points specified by src, and write | 399 /** Apply this matrix to the array of points specified by src, and write |
378 the transformed points into the array of points specified by dst. | 400 the transformed points into the array of points specified by dst. |
379 dst[] = M * src[] | 401 dst[] = M * src[] |
380 @param dst Where the transformed coordinates are written. It must | 402 @param dst Where the transformed coordinates are written. It must |
381 contain at least count entries | 403 contain at least count entries |
382 @param src The original coordinates that are to be transformed. It | 404 @param src The original coordinates that are to be transformed. It |
383 must contain at least count entries | 405 must contain at least count entries |
384 @param count The number of points in src to read, and then transform | 406 @param count The number of points in src to read, and then transform |
385 into dst. | 407 into dst. |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], | 759 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], |
738 int count); | 760 int count); |
739 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); | 761 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); |
740 | 762 |
741 static const MapPtsProc gMapPtsProcs[]; | 763 static const MapPtsProc gMapPtsProcs[]; |
742 | 764 |
743 friend class SkPerspIter; | 765 friend class SkPerspIter; |
744 }; | 766 }; |
745 | 767 |
746 #endif | 768 #endif |
OLD | NEW |