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. | 383 // 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 | 384 // 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). | 385 // what computeTypeMask() would produce (persp/skew always implies kSc
ale). |
387 // We should investigate whether these flag dependencies are truly nee
ded. | 386 // We should investigate whether these flag dependencies are truly nee
ded. |
388 if (fMat[kMScaleX] == 1 && fMat[kMScaleY] == 1 | 387 if (fMat[kMScaleX] == 1 && fMat[kMScaleY] == 1 |
389 && !(fTypeMask & (kPerspective_Mask | kAffine_Mask))) { | 388 && !(fTypeMask & (kPerspective_Mask | kAffine_Mask))) { |
390 this->clearTypeMask(kScale_Mask); | 389 this->clearTypeMask(kScale_Mask); |
391 } else { | 390 } else { |
392 this->orTypeMask(kScale_Mask); | 391 this->orTypeMask(kScale_Mask); |
393 } | 392 } |
394 #else | |
395 this->orTypeMask(kScale_Mask); | |
396 #endif | |
397 } | 393 } |
398 | 394 |
399 void SkMatrix::postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py) { | 395 void SkMatrix::postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py) { |
400 if (1 == sx && 1 == sy) { | 396 if (1 == sx && 1 == sy) { |
401 return; | 397 return; |
402 } | 398 } |
403 SkMatrix m; | 399 SkMatrix m; |
404 m.setScale(sx, sy, px, py); | 400 m.setScale(sx, sy, px, py); |
405 this->postConcat(m); | 401 this->postConcat(m); |
406 } | 402 } |
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1798 const SkScalar m11 = m00; | 1794 const SkScalar m11 = m00; |
1799 const SkScalar m12 = fTy; | 1795 const SkScalar m12 = fTy; |
1800 | 1796 |
1801 quad[0].set(m02, m12); | 1797 quad[0].set(m02, m12); |
1802 quad[1].set(m00 * width + m02, m10 * width + m12); | 1798 quad[1].set(m00 * width + m02, m10 * width + m12); |
1803 quad[2].set(m00 * width + m01 * height + m02, m10 * width + m11 * height + m
12); | 1799 quad[2].set(m00 * width + m01 * height + m02, m10 * width + m11 * height + m
12); |
1804 quad[3].set(m01 * height + m02, m11 * height + m12); | 1800 quad[3].set(m01 * height + m02, m11 * height + m12); |
1805 #endif | 1801 #endif |
1806 } | 1802 } |
1807 | 1803 |
OLD | NEW |