Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 fTypeMask = src.fTypeMask; | 130 fTypeMask = src.fTypeMask; |
| 131 } | 131 } |
| 132 return *this; | 132 return *this; |
| 133 } | 133 } |
| 134 | 134 |
| 135 bool operator==(const SkMatrix44& other) const; | 135 bool operator==(const SkMatrix44& other) const; |
| 136 bool operator!=(const SkMatrix44& other) const { | 136 bool operator!=(const SkMatrix44& other) const { |
| 137 return !(other == *this); | 137 return !(other == *this); |
| 138 } | 138 } |
| 139 | 139 |
| 140 /* When converting from SkMatrix44 to SkMatrix, the third row and | |
| 141 * column is dropped. When converting from SkMatrix to SkMatrix44 | |
| 142 * the third row and column remain as identity: | |
| 143 * [ a b c ] [ a b 0 c ] | |
| 144 * [ d e f ] -> [ d e 0 f ] | |
| 145 * [ g h i ] [ 0 0 1 0 ] | |
| 146 * [ g h 0 i ] | |
| 147 */ | |
| 140 SkMatrix44(const SkMatrix&); | 148 SkMatrix44(const SkMatrix&); |
| 141 SkMatrix44& operator=(const SkMatrix& src); | 149 SkMatrix44& operator=(const SkMatrix& src); |
| 142 operator SkMatrix() const; | 150 operator SkMatrix() const; |
| 143 | 151 |
| 144 /** | 152 /** |
| 145 * Return a reference to a const identity matrix | 153 * Return a reference to a const identity matrix |
| 146 */ | 154 */ |
| 147 static const SkMatrix44& I(); | 155 static const SkMatrix44& I(); |
| 148 | 156 |
| 149 enum TypeMask { | 157 enum TypeMask { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 void setRowMajord(const double[]); | 254 void setRowMajord(const double[]); |
| 247 | 255 |
| 248 #ifdef SK_MSCALAR_IS_FLOAT | 256 #ifdef SK_MSCALAR_IS_FLOAT |
| 249 void setColMajor(const SkMScalar data[]) { this->setColMajorf(data); } | 257 void setColMajor(const SkMScalar data[]) { this->setColMajorf(data); } |
| 250 void setRowMajor(const SkMScalar data[]) { this->setRowMajorf(data); } | 258 void setRowMajor(const SkMScalar data[]) { this->setRowMajorf(data); } |
| 251 #else | 259 #else |
| 252 void setColMajor(const SkMScalar data[]) { this->setColMajord(data); } | 260 void setColMajor(const SkMScalar data[]) { this->setColMajord(data); } |
| 253 void setRowMajor(const SkMScalar data[]) { this->setRowMajord(data); } | 261 void setRowMajor(const SkMScalar data[]) { this->setRowMajord(data); } |
| 254 #endif | 262 #endif |
| 255 | 263 |
| 264 /* This sets the top-left of the matrix, i.e. the translation and | |
| 265 * perspective components remain untouched. */ | |
|
reed1
2013/10/03 09:00:40
the i.e. section is incorrect: set3x3 sets *all* e
aelias_OOO_until_Jul13
2013/10/03 19:05:36
Right, fixed the comment.
| |
| 256 void set3x3(SkMScalar m00, SkMScalar m01, SkMScalar m02, | 266 void set3x3(SkMScalar m00, SkMScalar m01, SkMScalar m02, |
| 257 SkMScalar m10, SkMScalar m11, SkMScalar m12, | 267 SkMScalar m10, SkMScalar m11, SkMScalar m12, |
| 258 SkMScalar m20, SkMScalar m21, SkMScalar m22); | 268 SkMScalar m20, SkMScalar m21, SkMScalar m22); |
| 259 | 269 |
| 260 void setTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); | 270 void setTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); |
| 261 void preTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); | 271 void preTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); |
| 262 void postTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); | 272 void postTranslate(SkMScalar dx, SkMScalar dy, SkMScalar dz); |
| 263 | 273 |
| 264 void setScale(SkMScalar sx, SkMScalar sy, SkMScalar sz); | 274 void setScale(SkMScalar sx, SkMScalar sy, SkMScalar sz); |
| 265 void preScale(SkMScalar sx, SkMScalar sy, SkMScalar sz); | 275 void preScale(SkMScalar sx, SkMScalar sy, SkMScalar sz); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 396 /** | 406 /** |
| 397 * Does not take the time to 'compute' the typemask. Only returns true if | 407 * Does not take the time to 'compute' the typemask. Only returns true if |
| 398 * we already know that this matrix is identity. | 408 * we already know that this matrix is identity. |
| 399 */ | 409 */ |
| 400 inline bool isTriviallyIdentity() const { | 410 inline bool isTriviallyIdentity() const { |
| 401 return 0 == fTypeMask; | 411 return 0 == fTypeMask; |
| 402 } | 412 } |
| 403 }; | 413 }; |
| 404 | 414 |
| 405 #endif | 415 #endif |
| OLD | NEW |