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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 | 813 |
814 void Clamp_S32_opaque_D32_nofilter_DX_shaderproc(const SkBitmapProcState& s, in
t x, int y, | 814 void Clamp_S32_opaque_D32_nofilter_DX_shaderproc(const SkBitmapProcState& s, in
t x, int y, |
815 SkPMColor* SK_RESTRICT dst, in
t count) { | 815 SkPMColor* SK_RESTRICT dst, in
t count) { |
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 const SkBitmapProcStateAutoMapper mapper(s, x, y); | 823 SkPoint pt; |
| 824 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, SkIntToScalar
(y) + SK_ScalarHalf, |
| 825 &pt); |
| 826 fx = SkScalarToFractionalInt(pt.fY) |
| 827 + bitmap_sampler_inv_bias(s.fInvMatrix.getScaleY()); |
824 const unsigned maxY = s.fPixmap.height() - 1; | 828 const unsigned maxY = s.fPixmap.height() - 1; |
825 dstY = SkClampMax(SkFixedFloorToInt(mapper.y()), maxY); | 829 dstY = SkClampMax(SkFractionalIntToInt(fx), maxY); |
826 fx = SkFixedToFractionalInt(mapper.x()); | 830 fx = SkScalarToFractionalInt(pt.fX) |
| 831 + bitmap_sampler_inv_bias(s.fInvMatrix.getScaleX()); |
827 } | 832 } |
828 | 833 |
829 const SkPMColor* SK_RESTRICT src = s.fPixmap.addr32(0, dstY); | 834 const SkPMColor* SK_RESTRICT src = s.fPixmap.addr32(0, dstY); |
830 const SkFractionalInt dx = s.fInvSxFractionalInt; | 835 const SkFractionalInt dx = s.fInvSxFractionalInt; |
831 | 836 |
832 // 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. |
833 // | 838 // |
834 if ((uint64_t)SkFractionalIntToInt(fx) <= maxX && | 839 if ((uint64_t)SkFractionalIntToInt(fx) <= maxX && |
835 (uint64_t)SkFractionalIntToInt(fx + dx * (count - 1)) <= maxX) | 840 (uint64_t)SkFractionalIntToInt(fx + dx * (count - 1)) <= maxX) |
836 { | 841 { |
(...skipping 15 matching lines...) Expand all Loading... |
852 *dst++ = src[index]; | 857 *dst++ = src[index]; |
853 fx += dx; | 858 fx += dx; |
854 } | 859 } |
855 } else { | 860 } else { |
856 for (int i = 0; i < count; ++i) { | 861 for (int i = 0; i < count; ++i) { |
857 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; | 862 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; |
858 fx += dx; | 863 fx += dx; |
859 } | 864 } |
860 } | 865 } |
861 } | 866 } |
| 867 |
OLD | NEW |