| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 PREAMBLE(s); | 56 PREAMBLE(s); |
| 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 const SkBitmapProcStateAutoMapper mapper(s, x, y); | 64 const SkBitmapProcStateAutoMapper mapper(s, x, y); |
| 65 const SkFixed fy = SkFractionalIntToFixed(mapper.y()); | 65 const SkFixed fy = mapper.fixedY(); |
| 66 const unsigned maxY = s.fPixmap.height() - 1; | 66 const unsigned maxY = s.fPixmap.height() - 1; |
| 67 // compute our two Y values up front | 67 // compute our two Y values up front |
| 68 *xy++ = PACK_FILTER_Y_NAME(fy, maxY, s.fFilterOneY PREAMBLE_ARG_Y); | 68 *xy++ = PACK_FILTER_Y_NAME(fy, maxY, s.fFilterOneY PREAMBLE_ARG_Y); |
| 69 // now initialize fx | 69 // now initialize fx |
| 70 fx = mapper.x(); | 70 fx = mapper.fractionalIntX(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 #ifdef CHECK_FOR_DECAL | 73 #ifdef CHECK_FOR_DECAL |
| 74 if (can_truncate_to_fixed_for_decal(fx, dx, count, maxX)) { | 74 if (can_truncate_to_fixed_for_decal(fx, dx, count, maxX)) { |
| 75 decal_filter_scale(xy, SkFractionalIntToFixed(fx), | 75 decal_filter_scale(xy, SkFractionalIntToFixed(fx), |
| 76 SkFractionalIntToFixed(dx), count); | 76 SkFractionalIntToFixed(dx), count); |
| 77 } else | 77 } else |
| 78 #endif | 78 #endif |
| 79 { | 79 { |
| 80 do { | 80 do { |
| 81 SkFixed fixedFx = SkFractionalIntToFixed(fx); | 81 SkFixed fixedFx = SkFractionalIntToFixed(fx); |
| 82 *xy++ = PACK_FILTER_X_NAME(fixedFx, maxX, one PREAMBLE_ARG_X); | 82 *xy++ = PACK_FILTER_X_NAME(fixedFx, maxX, one PREAMBLE_ARG_X); |
| 83 fx += dx; | 83 fx += dx; |
| 84 } while (--count != 0); | 84 } while (--count != 0); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 void AFFINE_FILTER_NAME(const SkBitmapProcState& s, | 88 void AFFINE_FILTER_NAME(const SkBitmapProcState& s, |
| 89 uint32_t xy[], int count, int x, int y) { | 89 uint32_t xy[], int count, int x, int y) { |
| 90 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask); | 90 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask); |
| 91 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | | 91 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | |
| 92 SkMatrix::kScale_Mask | | 92 SkMatrix::kScale_Mask | |
| 93 SkMatrix::kAffine_Mask)) == 0); | 93 SkMatrix::kAffine_Mask)) == 0); |
| 94 | 94 |
| 95 PREAMBLE(s); | 95 PREAMBLE(s); |
| 96 const SkBitmapProcStateAutoMapper mapper(s, x, y); | 96 const SkBitmapProcStateAutoMapper mapper(s, x, y); |
| 97 | 97 |
| 98 SkFixed oneX = s.fFilterOneX; | 98 SkFixed oneX = s.fFilterOneX; |
| 99 SkFixed oneY = s.fFilterOneY; | 99 SkFixed oneY = s.fFilterOneY; |
| 100 SkFixed fx = SkFractionalIntToFixed(mapper.x()); | 100 SkFixed fx = mapper.fixedX(); |
| 101 SkFixed fy = SkFractionalIntToFixed(mapper.y()); | 101 SkFixed fy = mapper.fixedY(); |
| 102 SkFixed dx = s.fInvSx; | 102 SkFixed dx = s.fInvSx; |
| 103 SkFixed dy = s.fInvKy; | 103 SkFixed dy = s.fInvKy; |
| 104 unsigned maxX = s.fPixmap.width() - 1; | 104 unsigned maxX = s.fPixmap.width() - 1; |
| 105 unsigned maxY = s.fPixmap.height() - 1; | 105 unsigned maxY = s.fPixmap.height() - 1; |
| 106 | 106 |
| 107 do { | 107 do { |
| 108 *xy++ = PACK_FILTER_Y_NAME(fy, maxY, oneY PREAMBLE_ARG_Y); | 108 *xy++ = PACK_FILTER_Y_NAME(fy, maxY, oneY PREAMBLE_ARG_Y); |
| 109 fy += dy; | 109 fy += dy; |
| 110 *xy++ = PACK_FILTER_X_NAME(fx, maxX, oneX PREAMBLE_ARG_X); | 110 *xy++ = PACK_FILTER_X_NAME(fx, maxX, oneX PREAMBLE_ARG_X); |
| 111 fx += dx; | 111 fx += dx; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 #undef PERSP_FILTER_NAME | 151 #undef PERSP_FILTER_NAME |
| 152 | 152 |
| 153 #undef PREAMBLE | 153 #undef PREAMBLE |
| 154 #undef PREAMBLE_PARAM_X | 154 #undef PREAMBLE_PARAM_X |
| 155 #undef PREAMBLE_PARAM_Y | 155 #undef PREAMBLE_PARAM_Y |
| 156 #undef PREAMBLE_ARG_X | 156 #undef PREAMBLE_ARG_X |
| 157 #undef PREAMBLE_ARG_Y | 157 #undef PREAMBLE_ARG_Y |
| 158 | 158 |
| 159 #undef TILEX_LOW_BITS | 159 #undef TILEX_LOW_BITS |
| 160 #undef TILEY_LOW_BITS | 160 #undef TILEY_LOW_BITS |
| OLD | NEW |