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

Side by Side Diff: include/utils/SkMatrix44.h

Issue 513343002: Add helper SkMatrix44::hasPerspective() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bug, call SkToBool, import tests Created 6 years, 3 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 | « no previous file | tests/Matrix44Test.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 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkMatrix44_DEFINED 8 #ifndef SkMatrix44_DEFINED
9 #define SkMatrix44_DEFINED 9 #define SkMatrix44_DEFINED
10 10
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 return !(this->getType() & ~kTranslate_Mask); 191 return !(this->getType() & ~kTranslate_Mask);
192 } 192 }
193 193
194 /** 194 /**
195 * Return true if the matrix only contains scale or translate or is identit y. 195 * Return true if the matrix only contains scale or translate or is identit y.
196 */ 196 */
197 inline bool isScaleTranslate() const { 197 inline bool isScaleTranslate() const {
198 return !(this->getType() & ~(kScale_Mask | kTranslate_Mask)); 198 return !(this->getType() & ~(kScale_Mask | kTranslate_Mask));
199 } 199 }
200 200
201 inline bool hasPerspective() const {
202 return SkToBool(this->getType() & kPerspective_Mask);
203 }
204
201 void setIdentity(); 205 void setIdentity();
202 inline void reset() { this->setIdentity();} 206 inline void reset() { this->setIdentity();}
203 207
204 /** 208 /**
205 * get a value from the matrix. The row,col parameters work as follows: 209 * get a value from the matrix. The row,col parameters work as follows:
206 * (0, 0) scale-x 210 * (0, 0) scale-x
207 * (0, 3) translate-x 211 * (0, 3) translate-x
208 * (3, 0) perspective-x 212 * (3, 0) perspective-x
209 */ 213 */
210 inline SkMScalar get(int row, int col) const { 214 inline SkMScalar get(int row, int col) const {
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 /** 417 /**
414 * Does not take the time to 'compute' the typemask. Only returns true if 418 * Does not take the time to 'compute' the typemask. Only returns true if
415 * we already know that this matrix is identity. 419 * we already know that this matrix is identity.
416 */ 420 */
417 inline bool isTriviallyIdentity() const { 421 inline bool isTriviallyIdentity() const {
418 return 0 == fTypeMask; 422 return 0 == fTypeMask;
419 } 423 }
420 }; 424 };
421 425
422 #endif 426 #endif
OLDNEW
« no previous file with comments | « no previous file | tests/Matrix44Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698