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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 362 |
363 /** Set the matrix to the scale and translate values that map the source | 363 /** Set the matrix to the scale and translate values that map the source |
364 rectangle to the destination rectangle, returning true if the the result | 364 rectangle to the destination rectangle, returning true if the the result |
365 can be represented. | 365 can be represented. |
366 @param src the source rectangle to map from. | 366 @param src the source rectangle to map from. |
367 @param dst the destination rectangle to map to. | 367 @param dst the destination rectangle to map to. |
368 @param stf the ScaleToFit option | 368 @param stf the ScaleToFit option |
369 @return true if the matrix can be represented by the rectangle mapping. | 369 @return true if the matrix can be represented by the rectangle mapping. |
370 */ | 370 */ |
371 bool setRectToRect(const SkRect& src, const SkRect& dst, ScaleToFit stf); | 371 bool setRectToRect(const SkRect& src, const SkRect& dst, ScaleToFit stf); |
| 372 static SkMatrix MakeRectToRect(const SkRect& src, const SkRect& dst, ScaleTo
Fit stf) { |
| 373 SkMatrix m; |
| 374 m.setRectToRect(src, dst, stf); |
| 375 return m; |
| 376 } |
372 | 377 |
373 /** Set the matrix such that the specified src points would map to the | 378 /** Set the matrix such that the specified src points would map to the |
374 specified dst points. count must be within [0..4]. | 379 specified dst points. count must be within [0..4]. |
375 @param src The array of src points | 380 @param src The array of src points |
376 @param dst The array of dst points | 381 @param dst The array of dst points |
377 @param count The number of points to use for the transformation | 382 @param count The number of points to use for the transformation |
378 @return true if the matrix was set to the specified transformation | 383 @return true if the matrix was set to the specified transformation |
379 */ | 384 */ |
380 bool setPolyToPoly(const SkPoint src[], const SkPoint dst[], int count); | 385 bool setPolyToPoly(const SkPoint src[], const SkPoint dst[], int count); |
381 | 386 |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); | 821 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); |
817 | 822 |
818 static void Affine_vpts(const SkMatrix&, SkPoint dst[], const SkPoint[], int
); | 823 static void Affine_vpts(const SkMatrix&, SkPoint dst[], const SkPoint[], int
); |
819 | 824 |
820 static const MapPtsProc gMapPtsProcs[]; | 825 static const MapPtsProc gMapPtsProcs[]; |
821 | 826 |
822 friend class SkPerspIter; | 827 friend class SkPerspIter; |
823 }; | 828 }; |
824 | 829 |
825 #endif | 830 #endif |
OLD | NEW |