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

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

Issue 864713002: remove dead SkPersp macros (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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/filltypespersp.cpp ('k') | src/animator/SkDrawMatrix.cpp » ('j') | 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 // TODO: can we remove these 3 (need to check chrome/android)
18 typedef SkScalar SkPersp;
19 #define SkScalarToPersp(x) (x)
20 #define SkPerspToScalar(x) (x)
21
22 /** \class SkMatrix 17 /** \class SkMatrix
23 18
24 The SkMatrix class holds a 3x3 matrix for transforming coordinates. 19 The SkMatrix class holds a 3x3 matrix for transforming coordinates.
25 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
26 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
27 functions (e.g. setTranslate, setRotate, etc.). 22 functions (e.g. setTranslate, setRotate, etc.).
28 */ 23 */
29 class SK_API SkMatrix { 24 class SK_API SkMatrix {
30 public: 25 public:
31 /** Enum of bit fields for the mask return by getType(). 26 /** Enum of bit fields for the mask return by getType().
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 SkASSERT((unsigned)index < 9); 123 SkASSERT((unsigned)index < 9);
129 return fMat[index]; 124 return fMat[index];
130 } 125 }
131 126
132 SkScalar getScaleX() const { return fMat[kMScaleX]; } 127 SkScalar getScaleX() const { return fMat[kMScaleX]; }
133 SkScalar getScaleY() const { return fMat[kMScaleY]; } 128 SkScalar getScaleY() const { return fMat[kMScaleY]; }
134 SkScalar getSkewY() const { return fMat[kMSkewY]; } 129 SkScalar getSkewY() const { return fMat[kMSkewY]; }
135 SkScalar getSkewX() const { return fMat[kMSkewX]; } 130 SkScalar getSkewX() const { return fMat[kMSkewX]; }
136 SkScalar getTranslateX() const { return fMat[kMTransX]; } 131 SkScalar getTranslateX() const { return fMat[kMTransX]; }
137 SkScalar getTranslateY() const { return fMat[kMTransY]; } 132 SkScalar getTranslateY() const { return fMat[kMTransY]; }
138 SkPersp getPerspX() const { return fMat[kMPersp0]; } 133 SkScalar getPerspX() const { return fMat[kMPersp0]; }
139 SkPersp getPerspY() const { return fMat[kMPersp1]; } 134 SkScalar getPerspY() const { return fMat[kMPersp1]; }
140 135
141 SkScalar& operator[](int index) { 136 SkScalar& operator[](int index) {
142 SkASSERT((unsigned)index < 9); 137 SkASSERT((unsigned)index < 9);
143 this->setTypeMask(kUnknown_Mask); 138 this->setTypeMask(kUnknown_Mask);
144 return fMat[index]; 139 return fMat[index];
145 } 140 }
146 141
147 void set(int index, SkScalar value) { 142 void set(int index, SkScalar value) {
148 SkASSERT((unsigned)index < 9); 143 SkASSERT((unsigned)index < 9);
149 fMat[index] = value; 144 fMat[index] = value;
150 this->setTypeMask(kUnknown_Mask); 145 this->setTypeMask(kUnknown_Mask);
151 } 146 }
152 147
153 void setScaleX(SkScalar v) { this->set(kMScaleX, v); } 148 void setScaleX(SkScalar v) { this->set(kMScaleX, v); }
154 void setScaleY(SkScalar v) { this->set(kMScaleY, v); } 149 void setScaleY(SkScalar v) { this->set(kMScaleY, v); }
155 void setSkewY(SkScalar v) { this->set(kMSkewY, v); } 150 void setSkewY(SkScalar v) { this->set(kMSkewY, v); }
156 void setSkewX(SkScalar v) { this->set(kMSkewX, v); } 151 void setSkewX(SkScalar v) { this->set(kMSkewX, v); }
157 void setTranslateX(SkScalar v) { this->set(kMTransX, v); } 152 void setTranslateX(SkScalar v) { this->set(kMTransX, v); }
158 void setTranslateY(SkScalar v) { this->set(kMTransY, v); } 153 void setTranslateY(SkScalar v) { this->set(kMTransY, v); }
159 void setPerspX(SkPersp v) { this->set(kMPersp0, v); } 154 void setPerspX(SkScalar v) { this->set(kMPersp0, v); }
160 void setPerspY(SkPersp v) { this->set(kMPersp1, v); } 155 void setPerspY(SkScalar v) { this->set(kMPersp1, v); }
161 156
162 void setAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, 157 void setAll(SkScalar scaleX, SkScalar skewX, SkScalar transX,
163 SkScalar skewY, SkScalar scaleY, SkScalar transY, 158 SkScalar skewY, SkScalar scaleY, SkScalar transY,
164 SkPersp persp0, SkPersp persp1, SkPersp persp2) { 159 SkScalar persp0, SkScalar persp1, SkScalar persp2) {
165 fMat[kMScaleX] = scaleX; 160 fMat[kMScaleX] = scaleX;
166 fMat[kMSkewX] = skewX; 161 fMat[kMSkewX] = skewX;
167 fMat[kMTransX] = transX; 162 fMat[kMTransX] = transX;
168 fMat[kMSkewY] = skewY; 163 fMat[kMSkewY] = skewY;
169 fMat[kMScaleY] = scaleY; 164 fMat[kMScaleY] = scaleY;
170 fMat[kMTransY] = transY; 165 fMat[kMTransY] = transY;
171 fMat[kMPersp0] = persp0; 166 fMat[kMPersp0] = persp0;
172 fMat[kMPersp1] = persp1; 167 fMat[kMPersp1] = persp1;
173 fMat[kMPersp2] = persp2; 168 fMat[kMPersp2] = persp2;
174 this->setTypeMask(kUnknown_Mask); 169 this->setTypeMask(kUnknown_Mask);
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], 754 static void RotTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[],
760 int count); 755 int count);
761 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); 756 static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int);
762 757
763 static const MapPtsProc gMapPtsProcs[]; 758 static const MapPtsProc gMapPtsProcs[];
764 759
765 friend class SkPerspIter; 760 friend class SkPerspIter;
766 }; 761 };
767 762
768 #endif 763 #endif
OLDNEW
« no previous file with comments | « gm/filltypespersp.cpp ('k') | src/animator/SkDrawMatrix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698