| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 #include "SkMatrix.h" | 8 #include "SkMatrix.h" |
| 9 #include "SkFloatBits.h" | 9 #include "SkFloatBits.h" |
| 10 #include "SkRSXform.h" | 10 #include "SkRSXform.h" |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 // so we can get away with these blind multiplies. | 373 // so we can get away with these blind multiplies. |
| 374 | 374 |
| 375 fMat[kMScaleX] *= sx; | 375 fMat[kMScaleX] *= sx; |
| 376 fMat[kMSkewY] *= sx; | 376 fMat[kMSkewY] *= sx; |
| 377 fMat[kMPersp0] *= sx; | 377 fMat[kMPersp0] *= sx; |
| 378 | 378 |
| 379 fMat[kMSkewX] *= sy; | 379 fMat[kMSkewX] *= sy; |
| 380 fMat[kMScaleY] *= sy; | 380 fMat[kMScaleY] *= sy; |
| 381 fMat[kMPersp1] *= sy; | 381 fMat[kMPersp1] *= sy; |
| 382 | 382 |
| 383 #ifndef SK_SUPPORT_LEGACY_PRESCALE_SEMANTICS |
| 384 // Attempt to simplify our type when applying an inverse scale. |
| 385 // TODO: The persp/affine preconditions are in place to keep the mask consis
tent with |
| 386 // what computeTypeMask() would produce (persp/skew always implies kSc
ale). |
| 387 // We should investigate whether these flag dependencies are truly nee
ded. |
| 388 if (fMat[kMScaleX] == 1 && fMat[kMScaleY] == 1 |
| 389 && !(fTypeMask & (kPerspective_Mask | kAffine_Mask))) { |
| 390 this->clearTypeMask(kScale_Mask); |
| 391 } else { |
| 392 this->orTypeMask(kScale_Mask); |
| 393 } |
| 394 #else |
| 383 this->orTypeMask(kScale_Mask); | 395 this->orTypeMask(kScale_Mask); |
| 396 #endif |
| 384 } | 397 } |
| 385 | 398 |
| 386 void SkMatrix::postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py) { | 399 void SkMatrix::postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py) { |
| 387 if (1 == sx && 1 == sy) { | 400 if (1 == sx && 1 == sy) { |
| 388 return; | 401 return; |
| 389 } | 402 } |
| 390 SkMatrix m; | 403 SkMatrix m; |
| 391 m.setScale(sx, sy, px, py); | 404 m.setScale(sx, sy, px, py); |
| 392 this->postConcat(m); | 405 this->postConcat(m); |
| 393 } | 406 } |
| (...skipping 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1773 const SkScalar m11 = m00; | 1786 const SkScalar m11 = m00; |
| 1774 const SkScalar m12 = fTy; | 1787 const SkScalar m12 = fTy; |
| 1775 | 1788 |
| 1776 quad[0].set(m02, m12); | 1789 quad[0].set(m02, m12); |
| 1777 quad[1].set(m00 * width + m02, m10 * width + m12); | 1790 quad[1].set(m00 * width + m02, m10 * width + m12); |
| 1778 quad[2].set(m00 * width + m01 * height + m02, m10 * width + m11 * height + m
12); | 1791 quad[2].set(m00 * width + m01 * height + m02, m10 * width + m11 * height + m
12); |
| 1779 quad[3].set(m01 * height + m02, m11 * height + m12); | 1792 quad[3].set(m01 * height + m02, m11 * height + m12); |
| 1780 #endif | 1793 #endif |
| 1781 } | 1794 } |
| 1782 | 1795 |
| OLD | NEW |