| 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 #include "SkBitmapCache.h" | 8 #include "SkBitmapCache.h" |
| 9 #include "SkBitmapController.h" | 9 #include "SkBitmapController.h" |
| 10 #include "SkBitmapProcState.h" | 10 #include "SkBitmapProcState.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // a faster path in this case. | 166 // a faster path in this case. |
| 167 | 167 |
| 168 // This code will only execute if the matrix has some scale component; | 168 // This code will only execute if the matrix has some scale component; |
| 169 // if it's already pure translate then we won't do this inversion. | 169 // if it's already pure translate then we won't do this inversion. |
| 170 | 170 |
| 171 if (matrix_only_scale_translate(fInvMatrix)) { | 171 if (matrix_only_scale_translate(fInvMatrix)) { |
| 172 SkMatrix forward; | 172 SkMatrix forward; |
| 173 if (fInvMatrix.invert(&forward)) { | 173 if (fInvMatrix.invert(&forward)) { |
| 174 if (clampClamp ? just_trans_clamp(forward, fPixmap) | 174 if (clampClamp ? just_trans_clamp(forward, fPixmap) |
| 175 : just_trans_general(forward)) { | 175 : just_trans_general(forward)) { |
| 176 #ifdef SK_SUPPORT_LEGACY_TRANSLATEROUNDHACK |
| 176 SkScalar tx = -SkScalarRoundToScalar(forward.getTranslateX()); | 177 SkScalar tx = -SkScalarRoundToScalar(forward.getTranslateX()); |
| 177 SkScalar ty = -SkScalarRoundToScalar(forward.getTranslateY()); | 178 SkScalar ty = -SkScalarRoundToScalar(forward.getTranslateY()); |
| 178 fInvMatrix.setTranslate(tx, ty); | 179 fInvMatrix.setTranslate(tx, ty); |
| 180 #else |
| 181 fInvMatrix.setTranslate(-forward.getTranslateX(), -forward.getTr
anslateY()); |
| 182 #endif |
| 179 } | 183 } |
| 180 } | 184 } |
| 181 } | 185 } |
| 182 | 186 |
| 183 fInvProc = fInvMatrix.getMapXYProc(); | 187 fInvProc = fInvMatrix.getMapXYProc(); |
| 184 fInvType = fInvMatrix.getType(); | 188 fInvType = fInvMatrix.getType(); |
| 185 fInvSx = SkScalarToFixed(fInvMatrix.getScaleX()); | 189 fInvSx = SkScalarToFixed(fInvMatrix.getScaleX()); |
| 186 fInvSxFractionalInt = SkScalarToFractionalInt(fInvMatrix.getScaleX()); | 190 fInvSxFractionalInt = SkScalarToFractionalInt(fInvMatrix.getScaleX()); |
| 187 fInvKy = SkScalarToFixed(fInvMatrix.getSkewY()); | 191 fInvKy = SkScalarToFixed(fInvMatrix.getSkewY()); |
| 188 fInvKyFractionalInt = SkScalarToFractionalInt(fInvMatrix.getSkewY()); | 192 fInvKyFractionalInt = SkScalarToFractionalInt(fInvMatrix.getSkewY()); |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 fx += dx; | 827 fx += dx; |
| 824 } | 828 } |
| 825 } else { | 829 } else { |
| 826 for (int i = 0; i < count; ++i) { | 830 for (int i = 0; i < count; ++i) { |
| 827 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; | 831 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; |
| 828 fx += dx; | 832 fx += dx; |
| 829 } | 833 } |
| 830 } | 834 } |
| 831 } | 835 } |
| 832 | 836 |
| OLD | NEW |