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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | | 816 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | |
817 SkMatrix::kScale_Mask)) == 0); | 817 SkMatrix::kScale_Mask)) == 0); |
818 | 818 |
819 const unsigned maxX = s.fPixmap.width() - 1; | 819 const unsigned maxX = s.fPixmap.width() - 1; |
820 SkFractionalInt fx; | 820 SkFractionalInt fx; |
821 int dstY; | 821 int dstY; |
822 { | 822 { |
823 SkPoint pt; | 823 SkPoint pt; |
824 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, SkIntToScalar
(y) + SK_ScalarHalf, | 824 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, SkIntToScalar
(y) + SK_ScalarHalf, |
825 &pt); | 825 &pt); |
826 fx = SkScalarToFractionalInt(pt.fY); | 826 fx = SkScalarToFractionalInt(pt.fY) |
| 827 + bitmap_sampler_inv_bias(s.fInvMatrix.getScaleY()); |
827 const unsigned maxY = s.fPixmap.height() - 1; | 828 const unsigned maxY = s.fPixmap.height() - 1; |
828 dstY = SkClampMax(SkFractionalIntToInt(fx), maxY); | 829 dstY = SkClampMax(SkFractionalIntToInt(fx), maxY); |
829 fx = SkScalarToFractionalInt(pt.fX); | 830 fx = SkScalarToFractionalInt(pt.fX) |
| 831 + bitmap_sampler_inv_bias(s.fInvMatrix.getScaleX()); |
830 } | 832 } |
831 | 833 |
832 const SkPMColor* SK_RESTRICT src = s.fPixmap.addr32(0, dstY); | 834 const SkPMColor* SK_RESTRICT src = s.fPixmap.addr32(0, dstY); |
833 const SkFractionalInt dx = s.fInvSxFractionalInt; | 835 const SkFractionalInt dx = s.fInvSxFractionalInt; |
834 | 836 |
835 // Check if we're safely inside [0...maxX] so no need to clamp each computed
index. | 837 // Check if we're safely inside [0...maxX] so no need to clamp each computed
index. |
836 // | 838 // |
837 if ((uint64_t)SkFractionalIntToInt(fx) <= maxX && | 839 if ((uint64_t)SkFractionalIntToInt(fx) <= maxX && |
838 (uint64_t)SkFractionalIntToInt(fx + dx * (count - 1)) <= maxX) | 840 (uint64_t)SkFractionalIntToInt(fx + dx * (count - 1)) <= maxX) |
839 { | 841 { |
(...skipping 16 matching lines...) Expand all Loading... |
856 fx += dx; | 858 fx += dx; |
857 } | 859 } |
858 } else { | 860 } else { |
859 for (int i = 0; i < count; ++i) { | 861 for (int i = 0; i < count; ++i) { |
860 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; | 862 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; |
861 fx += dx; | 863 fx += dx; |
862 } | 864 } |
863 } | 865 } |
864 } | 866 } |
865 | 867 |
OLD | NEW |