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 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 @param count The number of triples (homogeneous points) in src to read, | 450 @param count The number of triples (homogeneous points) in src to read, |
451 and then transform into dst. | 451 and then transform into dst. |
452 */ | 452 */ |
453 void mapHomogeneousPoints(SkScalar dst[], const SkScalar src[], int count) c
onst; | 453 void mapHomogeneousPoints(SkScalar dst[], const SkScalar src[], int count) c
onst; |
454 | 454 |
455 void mapXY(SkScalar x, SkScalar y, SkPoint* result) const { | 455 void mapXY(SkScalar x, SkScalar y, SkPoint* result) const { |
456 SkASSERT(result); | 456 SkASSERT(result); |
457 this->getMapXYProc()(*this, x, y, result); | 457 this->getMapXYProc()(*this, x, y, result); |
458 } | 458 } |
459 | 459 |
| 460 SkPoint mapXY(SkScalar x, SkScalar y) const { |
| 461 SkPoint result; |
| 462 this->getMapXYProc()(*this, x, y, &result); |
| 463 return result; |
| 464 } |
| 465 |
460 /** Apply this matrix to the array of vectors specified by src, and write | 466 /** Apply this matrix to the array of vectors specified by src, and write |
461 the transformed vectors into the array of vectors specified by dst. | 467 the transformed vectors into the array of vectors specified by dst. |
462 This is similar to mapPoints, but ignores any translation in the matrix. | 468 This is similar to mapPoints, but ignores any translation in the matrix. |
463 @param dst Where the transformed coordinates are written. It must | 469 @param dst Where the transformed coordinates are written. It must |
464 contain at least count entries | 470 contain at least count entries |
465 @param src The original coordinates that are to be transformed. It | 471 @param src The original coordinates that are to be transformed. It |
466 must contain at least count entries | 472 must contain at least count entries |
467 @param count The number of vectors in src to read, and then transform | 473 @param count The number of vectors in src to read, and then transform |
468 into dst. | 474 into dst. |
469 */ | 475 */ |
470 void mapVectors(SkVector dst[], const SkVector src[], int count) const; | 476 void mapVectors(SkVector dst[], const SkVector src[], int count) const; |
471 | 477 |
472 /** Apply this matrix to the array of vectors specified by src, and write | 478 /** Apply this matrix to the array of vectors specified by src, and write |
473 the transformed vectors into the array of vectors specified by dst. | 479 the transformed vectors into the array of vectors specified by dst. |
474 This is similar to mapPoints, but ignores any translation in the matrix. | 480 This is similar to mapPoints, but ignores any translation in the matrix. |
475 @param vecs The vectors to be transformed. It must contain at least | 481 @param vecs The vectors to be transformed. It must contain at least |
476 count entries | 482 count entries |
477 @param count The number of vectors in vecs. | 483 @param count The number of vectors in vecs. |
478 */ | 484 */ |
479 void mapVectors(SkVector vecs[], int count) const { | 485 void mapVectors(SkVector vecs[], int count) const { |
480 this->mapVectors(vecs, vecs, count); | 486 this->mapVectors(vecs, vecs, count); |
481 } | 487 } |
482 | 488 |
| 489 void mapVector(SkScalar dx, SkScalar dy, SkVector* result) const { |
| 490 SkVector vec = { dx, dy }; |
| 491 this->mapVectors(result, &vec, 1); |
| 492 } |
| 493 |
| 494 SkVector mapVector(SkScalar dx, SkScalar dy) const { |
| 495 SkVector vec = { dx, dy }; |
| 496 this->mapVectors(&vec, &vec, 1); |
| 497 return vec; |
| 498 } |
| 499 |
483 /** Apply this matrix to the src rectangle, and write the transformed | 500 /** Apply this matrix to the src rectangle, and write the transformed |
484 rectangle into dst. This is accomplished by transforming the 4 corners | 501 rectangle into dst. This is accomplished by transforming the 4 corners |
485 of src, and then setting dst to the bounds of those points. | 502 of src, and then setting dst to the bounds of those points. |
486 @param dst Where the transformed rectangle is written. | 503 @param dst Where the transformed rectangle is written. |
487 @param src The original rectangle to be transformed. | 504 @param src The original rectangle to be transformed. |
488 @return the result of calling rectStaysRect() | 505 @return the result of calling rectStaysRect() |
489 */ | 506 */ |
490 bool mapRect(SkRect* dst, const SkRect& src) const; | 507 bool mapRect(SkRect* dst, const SkRect& src) const; |
491 | 508 |
492 /** Apply this matrix to the rectangle, and write the transformed rectangle | 509 /** Apply this matrix to the rectangle, and write the transformed rectangle |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], | 771 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], |
755 int count); | 772 int count); |
756 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); | 773 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); |
757 | 774 |
758 static const MapPtsProc gMapPtsProcs[]; | 775 static const MapPtsProc gMapPtsProcs[]; |
759 | 776 |
760 friend class SkPerspIter; | 777 friend class SkPerspIter; |
761 }; | 778 }; |
762 | 779 |
763 #endif | 780 #endif |
OLD | NEW |