| 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 SkPoint pt; | 823 const SkBitmapProcStateAutoMapper mapper(s, x, y); |
| 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()); | |
| 828 const unsigned maxY = s.fPixmap.height() - 1; | 824 const unsigned maxY = s.fPixmap.height() - 1; |
| 829 dstY = SkClampMax(SkFractionalIntToInt(fx), maxY); | 825 dstY = SkClampMax(SkFractionalIntToInt(mapper.y()), maxY); |
| 830 fx = SkScalarToFractionalInt(pt.fX) | 826 fx = mapper.x(); |
| 831 + bitmap_sampler_inv_bias(s.fInvMatrix.getScaleX()); | |
| 832 } | 827 } |
| 833 | 828 |
| 834 const SkPMColor* SK_RESTRICT src = s.fPixmap.addr32(0, dstY); | 829 const SkPMColor* SK_RESTRICT src = s.fPixmap.addr32(0, dstY); |
| 835 const SkFractionalInt dx = s.fInvSxFractionalInt; | 830 const SkFractionalInt dx = s.fInvSxFractionalInt; |
| 836 | 831 |
| 837 // Check if we're safely inside [0...maxX] so no need to clamp each computed
index. | 832 // Check if we're safely inside [0...maxX] so no need to clamp each computed
index. |
| 838 // | 833 // |
| 839 if ((uint64_t)SkFractionalIntToInt(fx) <= maxX && | 834 if ((uint64_t)SkFractionalIntToInt(fx) <= maxX && |
| 840 (uint64_t)SkFractionalIntToInt(fx + dx * (count - 1)) <= maxX) | 835 (uint64_t)SkFractionalIntToInt(fx + dx * (count - 1)) <= maxX) |
| 841 { | 836 { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 858 fx += dx; | 853 fx += dx; |
| 859 } | 854 } |
| 860 } else { | 855 } else { |
| 861 for (int i = 0; i < count; ++i) { | 856 for (int i = 0; i < count; ++i) { |
| 862 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; | 857 dst[i] = src[SkClampMax(SkFractionalIntToInt(fx), maxX)]; |
| 863 fx += dx; | 858 fx += dx; |
| 864 } | 859 } |
| 865 } | 860 } |
| 866 } | 861 } |
| 867 | 862 |
| OLD | NEW |