OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkMath.h" | 9 #include "SkMath.h" |
10 #include "SkMathPriv.h" | 10 #include "SkMathPriv.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 const unsigned maxX = s.fPixmap.width() - 1; | 58 const unsigned maxX = s.fPixmap.width() - 1; |
59 const SkFixed one = s.fFilterOneX; | 59 const SkFixed one = s.fFilterOneX; |
60 const SkFractionalInt dx = s.fInvSxFractionalInt; | 60 const SkFractionalInt dx = s.fInvSxFractionalInt; |
61 SkFractionalInt fx; | 61 SkFractionalInt fx; |
62 | 62 |
63 { | 63 { |
64 SkPoint pt; | 64 SkPoint pt; |
65 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, | 65 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, |
66 SkIntToScalar(y) + SK_ScalarHalf, &pt); | 66 SkIntToScalar(y) + SK_ScalarHalf, &pt); |
67 const SkFixed fy = SkScalarToFixed(pt.fY) - (s.fFilterOneY >> 1) | 67 const SkFixed fy = SkScalarToFixed(pt.fY) - (s.fFilterOneY >> 1); |
68 + bitmap_sampler_inv_bias(s.fInvMatrix.getScaleY()); | |
69 const unsigned maxY = s.fPixmap.height() - 1; | 68 const unsigned maxY = s.fPixmap.height() - 1; |
70 // compute our two Y values up front | 69 // compute our two Y values up front |
71 *xy++ = PACK_FILTER_Y_NAME(fy, maxY, s.fFilterOneY PREAMBLE_ARG_Y); | 70 *xy++ = PACK_FILTER_Y_NAME(fy, maxY, s.fFilterOneY PREAMBLE_ARG_Y); |
72 // now initialize fx | 71 // now initialize fx |
73 fx = SkScalarToFractionalInt(pt.fX) - (SkFixedToFractionalInt(one) >> 1) | 72 fx = SkScalarToFractionalInt(pt.fX) - (SkFixedToFractionalInt(one) >> 1)
; |
74 + bitmap_sampler_inv_bias(s.fInvMatrix.getScaleX()); | |
75 } | 73 } |
76 | 74 |
77 #ifdef CHECK_FOR_DECAL | 75 #ifdef CHECK_FOR_DECAL |
78 if (can_truncate_to_fixed_for_decal(fx, dx, count, maxX)) { | 76 if (can_truncate_to_fixed_for_decal(fx, dx, count, maxX)) { |
79 decal_filter_scale(xy, SkFractionalIntToFixed(fx), | 77 decal_filter_scale(xy, SkFractionalIntToFixed(fx), |
80 SkFractionalIntToFixed(dx), count); | 78 SkFractionalIntToFixed(dx), count); |
81 } else | 79 } else |
82 #endif | 80 #endif |
83 { | 81 { |
84 do { | 82 do { |
(...skipping 12 matching lines...) Expand all Loading... |
97 SkMatrix::kAffine_Mask)) == 0); | 95 SkMatrix::kAffine_Mask)) == 0); |
98 | 96 |
99 PREAMBLE(s); | 97 PREAMBLE(s); |
100 SkPoint srcPt; | 98 SkPoint srcPt; |
101 s.fInvProc(s.fInvMatrix, | 99 s.fInvProc(s.fInvMatrix, |
102 SkIntToScalar(x) + SK_ScalarHalf, | 100 SkIntToScalar(x) + SK_ScalarHalf, |
103 SkIntToScalar(y) + SK_ScalarHalf, &srcPt); | 101 SkIntToScalar(y) + SK_ScalarHalf, &srcPt); |
104 | 102 |
105 SkFixed oneX = s.fFilterOneX; | 103 SkFixed oneX = s.fFilterOneX; |
106 SkFixed oneY = s.fFilterOneY; | 104 SkFixed oneY = s.fFilterOneY; |
107 SkFixed fx = SkScalarToFixed(srcPt.fX) - (oneX >> 1) | 105 SkFixed fx = SkScalarToFixed(srcPt.fX) - (oneX >> 1); |
108 + bitmap_sampler_inv_bias(s.fInvMatrix.getScaleX()); | 106 SkFixed fy = SkScalarToFixed(srcPt.fY) - (oneY >> 1); |
109 SkFixed fy = SkScalarToFixed(srcPt.fY) - (oneY >> 1) | |
110 + bitmap_sampler_inv_bias(s.fInvMatrix.getScaleY()); | |
111 SkFixed dx = s.fInvSx; | 107 SkFixed dx = s.fInvSx; |
112 SkFixed dy = s.fInvKy; | 108 SkFixed dy = s.fInvKy; |
113 unsigned maxX = s.fPixmap.width() - 1; | 109 unsigned maxX = s.fPixmap.width() - 1; |
114 unsigned maxY = s.fPixmap.height() - 1; | 110 unsigned maxY = s.fPixmap.height() - 1; |
115 | 111 |
116 do { | 112 do { |
117 *xy++ = PACK_FILTER_Y_NAME(fy, maxY, oneY PREAMBLE_ARG_Y); | 113 *xy++ = PACK_FILTER_Y_NAME(fy, maxY, oneY PREAMBLE_ARG_Y); |
118 fy += dy; | 114 fy += dy; |
119 *xy++ = PACK_FILTER_X_NAME(fx, maxX, oneX PREAMBLE_ARG_X); | 115 *xy++ = PACK_FILTER_X_NAME(fx, maxX, oneX PREAMBLE_ARG_X); |
120 fx += dx; | 116 fx += dx; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 #undef PERSP_FILTER_NAME | 156 #undef PERSP_FILTER_NAME |
161 | 157 |
162 #undef PREAMBLE | 158 #undef PREAMBLE |
163 #undef PREAMBLE_PARAM_X | 159 #undef PREAMBLE_PARAM_X |
164 #undef PREAMBLE_PARAM_Y | 160 #undef PREAMBLE_PARAM_Y |
165 #undef PREAMBLE_ARG_X | 161 #undef PREAMBLE_ARG_X |
166 #undef PREAMBLE_ARG_Y | 162 #undef PREAMBLE_ARG_Y |
167 | 163 |
168 #undef TILEX_LOW_BITS | 164 #undef TILEX_LOW_BITS |
169 #undef TILEY_LOW_BITS | 165 #undef TILEY_LOW_BITS |
OLD | NEW |