| 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 "Sk64.h" | 9 #include "Sk64.h" |
| 10 #include "SkFloatBits.h" | 10 #include "SkFloatBits.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 enum { | 41 enum { |
| 42 kTranslate_Shift, | 42 kTranslate_Shift, |
| 43 kScale_Shift, | 43 kScale_Shift, |
| 44 kAffine_Shift, | 44 kAffine_Shift, |
| 45 kPerspective_Shift, | 45 kPerspective_Shift, |
| 46 kRectStaysRect_Shift | 46 kRectStaysRect_Shift |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 #ifdef SK_SCALAR_IS_FLOAT | 49 #ifdef SK_SCALAR_IS_FLOAT |
| 50 static const int32_t kScalar1Int = 0x3f800000; | 50 static const int32_t kScalar1Int = 0x3f800000; |
| 51 static const int32_t kPersp1Int = 0x3f800000; | |
| 52 #else | 51 #else |
| 53 #define scalarAsInt(x) (x) | 52 #define scalarAsInt(x) (x) |
| 54 static const int32_t kScalar1Int = (1 << 16); | 53 static const int32_t kScalar1Int = (1 << 16); |
| 55 static const int32_t kPersp1Int = (1 << 30); | 54 static const int32_t kPersp1Int = (1 << 30); |
| 56 #endif | 55 #endif |
| 57 | 56 |
| 57 #ifdef SK_SCALAR_SLOW_COMPARES |
| 58 static const int32_t kPersp1Int = 0x3f800000; |
| 59 #endif |
| 60 |
| 58 uint8_t SkMatrix::computePerspectiveTypeMask() const { | 61 uint8_t SkMatrix::computePerspectiveTypeMask() const { |
| 59 #ifdef SK_SCALAR_SLOW_COMPARES | 62 #ifdef SK_SCALAR_SLOW_COMPARES |
| 60 if (SkScalarAs2sCompliment(fMat[kMPersp0]) | | 63 if (SkScalarAs2sCompliment(fMat[kMPersp0]) | |
| 61 SkScalarAs2sCompliment(fMat[kMPersp1]) | | 64 SkScalarAs2sCompliment(fMat[kMPersp1]) | |
| 62 (SkScalarAs2sCompliment(fMat[kMPersp2]) - kPersp1Int)) { | 65 (SkScalarAs2sCompliment(fMat[kMPersp2]) - kPersp1Int)) { |
| 63 return SkToU8(kORableMasks); | 66 return SkToU8(kORableMasks); |
| 64 } | 67 } |
| 65 #else | 68 #else |
| 66 // Benchmarking suggests that replacing this set of SkScalarAs2sCompliment | 69 // Benchmarking suggests that replacing this set of SkScalarAs2sCompliment |
| 67 // is a win, but replacing those below is not. We don't yet understand | 70 // is a win, but replacing those below is not. We don't yet understand |
| (...skipping 2041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2109 rotation1->fX = cos1; | 2112 rotation1->fX = cos1; |
| 2110 rotation1->fY = sin1; | 2113 rotation1->fY = sin1; |
| 2111 } | 2114 } |
| 2112 if (NULL != rotation2) { | 2115 if (NULL != rotation2) { |
| 2113 rotation2->fX = cos2; | 2116 rotation2->fX = cos2; |
| 2114 rotation2->fY = sin2; | 2117 rotation2->fY = sin2; |
| 2115 } | 2118 } |
| 2116 | 2119 |
| 2117 return true; | 2120 return true; |
| 2118 } | 2121 } |
| OLD | NEW |