Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Side by Side Diff: include/core/SkMatrix.h

Issue 1034273002: Add matrix constructing helpers to SkMatrix (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/texturedomaineffect.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #define SkMatrix_DEFINED 11 #define SkMatrix_DEFINED
12 12
13 #include "SkRect.h" 13 #include "SkRect.h"
14 14
15 class SkString; 15 class SkString;
16 16
17 /** \class SkMatrix 17 /** \class SkMatrix
18 18
19 The SkMatrix class holds a 3x3 matrix for transforming coordinates. 19 The SkMatrix class holds a 3x3 matrix for transforming coordinates.
20 SkMatrix does not have a constructor, so it must be explicitly initialized 20 SkMatrix does not have a constructor, so it must be explicitly initialized
21 using either reset() - to construct an identity matrix, or one of the set 21 using either reset() - to construct an identity matrix, or one of the set
22 functions (e.g. setTranslate, setRotate, etc.). 22 functions (e.g. setTranslate, setRotate, etc.).
23 */ 23 */
24 class SK_API SkMatrix { 24 class SK_API SkMatrix {
25 public: 25 public:
26 static SkMatrix SK_WARN_UNUSED_RESULT MakeScale(SkScalar sx, SkScalar sy) {
27 SkMatrix m;
28 m.setScale(sx, sy);
29 return m;
30 }
31
32 static SkMatrix SK_WARN_UNUSED_RESULT MakeTrans(SkScalar dx, SkScalar dy) {
33 SkMatrix m;
34 m.setTranslate(dx, dy);
35 return m;
36 }
37
26 /** Enum of bit fields for the mask return by getType(). 38 /** Enum of bit fields for the mask return by getType().
27 Use this to identify the complexity of the matrix. 39 Use this to identify the complexity of the matrix.
28 */ 40 */
29 enum TypeMask { 41 enum TypeMask {
30 kIdentity_Mask = 0, 42 kIdentity_Mask = 0,
31 kTranslate_Mask = 0x01, //!< set if the matrix has translation 43 kTranslate_Mask = 0x01, //!< set if the matrix has translation
32 kScale_Mask = 0x02, //!< set if the matrix has X or Y scale 44 kScale_Mask = 0x02, //!< set if the matrix has X or Y scale
33 kAffine_Mask = 0x04, //!< set if the matrix skews or rotates 45 kAffine_Mask = 0x04, //!< set if the matrix skews or rotates
34 kPerspective_Mask = 0x08 //!< set if the matrix is in perspective 46 kPerspective_Mask = 0x08 //!< set if the matrix is in perspective
35 }; 47 };
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], 798 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[],
787 int count); 799 int count);
788 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); 800 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int);
789 801
790 static const MapPtsProc gMapPtsProcs[]; 802 static const MapPtsProc gMapPtsProcs[];
791 803
792 friend class SkPerspIter; 804 friend class SkPerspIter;
793 }; 805 };
794 806
795 #endif 807 #endif
OLDNEW
« no previous file with comments | « gm/texturedomaineffect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698