| 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 /** Apply this matrix to the array of points specified by src, and write | 406 /** Apply this matrix to the array of points specified by src, and write |
| 407 the transformed points into the array of points specified by dst. | 407 the transformed points into the array of points specified by dst. |
| 408 dst[] = M * src[] | 408 dst[] = M * src[] |
| 409 @param dst Where the transformed coordinates are written. It must | 409 @param dst Where the transformed coordinates are written. It must |
| 410 contain at least count entries | 410 contain at least count entries |
| 411 @param src The original coordinates that are to be transformed. It | 411 @param src The original coordinates that are to be transformed. It |
| 412 must contain at least count entries | 412 must contain at least count entries |
| 413 @param count The number of points in src to read, and then transform | 413 @param count The number of points in src to read, and then transform |
| 414 into dst. | 414 into dst. |
| 415 */ | 415 */ |
| 416 void mapPoints(SkPoint dst[], const SkPoint src[], int count) const; | 416 void mapPoints(SkPoint dst[], const SkPoint src[], int count) const { |
| 417 SkASSERT((dst && src && count > 0) || 0 == count); |
| 418 // no partial overlap |
| 419 SkASSERT(src == dst || &dst[count] <= &src[0] || &src[count] <= &dst[0])
; |
| 420 this->getMapPtsProc()(*this, dst, src, count); |
| 421 } |
| 417 | 422 |
| 418 /** Apply this matrix to the array of points, overwriting it with the | 423 /** Apply this matrix to the array of points, overwriting it with the |
| 419 transformed values. | 424 transformed values. |
| 420 dst[] = M * pts[] | 425 dst[] = M * pts[] |
| 421 @param pts The points to be transformed. It must contain at least | 426 @param pts The points to be transformed. It must contain at least |
| 422 count entries | 427 count entries |
| 423 @param count The number of points in pts. | 428 @param count The number of points in pts. |
| 424 */ | 429 */ |
| 425 void mapPoints(SkPoint pts[], int count) const { | 430 void mapPoints(SkPoint pts[], int count) const { |
| 426 this->mapPoints(pts, pts, count); | 431 this->mapPoints(pts, pts, count); |
| 427 } | 432 } |
| 428 | 433 |
| 429 void mapPts(SkPoint dst[], const SkPoint src[], int count) const { | |
| 430 gMapVPtsProcs[this->getType() & 0xF](*this, dst, src, count); | |
| 431 } | |
| 432 | |
| 433 /** Like mapPoints but with custom byte stride between the points. Stride | 434 /** Like mapPoints but with custom byte stride between the points. Stride |
| 434 * should be a multiple of sizeof(SkScalar). | 435 * should be a multiple of sizeof(SkScalar). |
| 435 */ | 436 */ |
| 436 void mapPointsWithStride(SkPoint pts[], size_t stride, int count) const { | 437 void mapPointsWithStride(SkPoint pts[], size_t stride, int count) const { |
| 437 SkASSERT(stride >= sizeof(SkPoint)); | 438 SkASSERT(stride >= sizeof(SkPoint)); |
| 438 SkASSERT(0 == stride % sizeof(SkScalar)); | 439 SkASSERT(0 == stride % sizeof(SkScalar)); |
| 439 for (int i = 0; i < count; ++i) { | 440 for (int i = 0; i < count; ++i) { |
| 440 this->mapPoints(pts, pts, 1); | 441 this->mapPoints(pts, pts, 1); |
| 441 pts = (SkPoint*)((intptr_t)pts + stride); | 442 pts = (SkPoint*)((intptr_t)pts + stride); |
| 442 } | 443 } |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 static void Identity_pts(const SkMatrix&, SkPoint[], const SkPoint[], int); | 795 static void Identity_pts(const SkMatrix&, SkPoint[], const SkPoint[], int); |
| 795 static void Trans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); | 796 static void Trans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); |
| 796 static void Scale_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); | 797 static void Scale_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); |
| 797 static void ScaleTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], | 798 static void ScaleTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], |
| 798 int count); | 799 int count); |
| 799 static void Rot_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); | 800 static void Rot_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); |
| 800 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], | 801 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], |
| 801 int count); | 802 int count); |
| 802 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); | 803 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); |
| 803 | 804 |
| 804 static void Trans_vpts(const SkMatrix&, SkPoint dst[], const SkPoint[], int)
; | |
| 805 static void Scale_vpts(const SkMatrix&, SkPoint dst[], const SkPoint[], int)
; | |
| 806 static void Affine_vpts(const SkMatrix&, SkPoint dst[], const SkPoint[], int
); | 805 static void Affine_vpts(const SkMatrix&, SkPoint dst[], const SkPoint[], int
); |
| 807 | 806 |
| 808 static const MapPtsProc gMapPtsProcs[]; | 807 static const MapPtsProc gMapPtsProcs[]; |
| 809 static const MapPtsProc gMapVPtsProcs[]; | |
| 810 | 808 |
| 811 friend class SkPerspIter; | 809 friend class SkPerspIter; |
| 812 }; | 810 }; |
| 813 | 811 |
| 814 #endif | 812 #endif |
| OLD | NEW |