| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkBitmapProcState.h" | 8 #include "SkBitmapProcState.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColor.h" | 10 #include "SkColor.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 __m128 weight = _mm_setzero_ps(); | 66 __m128 weight = _mm_setzero_ps(); |
| 67 __m128 accum = _mm_setzero_ps(); | 67 __m128 accum = _mm_setzero_ps(); |
| 68 | 68 |
| 69 int y0 = SkTMax(0, int(ceil(sy-s.getBitmapFilter()->width() + 0.5f))); | 69 int y0 = SkTMax(0, int(ceil(sy-s.getBitmapFilter()->width() + 0.5f))); |
| 70 int y1 = SkTMin(maxY, int(floor(sy+s.getBitmapFilter()->width() + 0.5f))
); | 70 int y1 = SkTMin(maxY, int(floor(sy+s.getBitmapFilter()->width() + 0.5f))
); |
| 71 int x0 = SkTMax(0, int(ceil(sx-s.getBitmapFilter()->width() + 0.5f))); | 71 int x0 = SkTMax(0, int(ceil(sx-s.getBitmapFilter()->width() + 0.5f))); |
| 72 int x1 = SkTMin(maxX, int(floor(sx+s.getBitmapFilter()->width() + 0.5f))
); | 72 int x1 = SkTMin(maxX, int(floor(sx+s.getBitmapFilter()->width() + 0.5f))
); |
| 73 | 73 |
| 74 for (int src_y = y0; src_y <= y1; src_y++) { | 74 for (int src_y = y0; src_y <= y1; src_y++) { |
| 75 float yweight = s.getBitmapFilter()->lookupFloat( (srcPt.fY - src_y)
); | 75 float yweight = SkScalarToFloat(s.getBitmapFilter()->lookupScalar(sr
cPt.fY - src_y)); |
| 76 | 76 |
| 77 for (int src_x = x0; src_x <= x1 ; src_x++) { | 77 for (int src_x = x0; src_x <= x1 ; src_x++) { |
| 78 float xweight = s.getBitmapFilter()->lookupFloat( (srcPt.fX - sr
c_x) ); | 78 float xweight = SkScalarToFloat(s.getBitmapFilter()->lookupScala
r(srcPt.fX - src_x)); |
| 79 | 79 |
| 80 float combined_weight = xweight * yweight; | 80 float combined_weight = xweight * yweight; |
| 81 | 81 |
| 82 SkPMColor color = *s.fBitmap->getAddr32(src_x, src_y); | 82 SkPMColor color = *s.fBitmap->getAddr32(src_x, src_y); |
| 83 | 83 |
| 84 __m128i c = _mm_cvtsi32_si128( color ); | 84 __m128i c = _mm_cvtsi32_si128( color ); |
| 85 c = _mm_unpacklo_epi8(c, _mm_setzero_si128()); | 85 c = _mm_unpacklo_epi8(c, _mm_setzero_si128()); |
| 86 c = _mm_unpacklo_epi16(c, _mm_setzero_si128()); | 86 c = _mm_unpacklo_epi16(c, _mm_setzero_si128()); |
| 87 | 87 |
| 88 __m128 cfloat = _mm_cvtepi32_ps( c ); | 88 __m128 cfloat = _mm_cvtepi32_ps( c ); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 int sx = SkScalarFloorToInt(srcPt.fX); | 133 int sx = SkScalarFloorToInt(srcPt.fX); |
| 134 | 134 |
| 135 float weight = 0; | 135 float weight = 0; |
| 136 __m128 accum = _mm_setzero_ps(); | 136 __m128 accum = _mm_setzero_ps(); |
| 137 | 137 |
| 138 int x0 = SkTMax(0, int(ceil(sx-s.getBitmapFilter()->width() + 0.5f))); | 138 int x0 = SkTMax(0, int(ceil(sx-s.getBitmapFilter()->width() + 0.5f))); |
| 139 int x1 = SkTMin(maxX, int(floor(sx+s.getBitmapFilter()->width() + 0.5f))
); | 139 int x1 = SkTMin(maxX, int(floor(sx+s.getBitmapFilter()->width() + 0.5f))
); |
| 140 | 140 |
| 141 for (int src_y = y0; src_y <= y1; src_y++) { | 141 for (int src_y = y0; src_y <= y1; src_y++) { |
| 142 float yweight = s.getBitmapFilter()->lookupFloat( (srcPt.fY - src_y)
); | 142 float yweight = SkScalarToFloat(s.getBitmapFilter()->lookupScalar(sr
cPt.fY - src_y)); |
| 143 | 143 |
| 144 for (int src_x = x0; src_x <= x1 ; src_x++) { | 144 for (int src_x = x0; src_x <= x1 ; src_x++) { |
| 145 float xweight = s.getBitmapFilter()->lookupFloat( (srcPt.fX - sr
c_x) ); | 145 float xweight = SkScalarToFloat(s.getBitmapFilter()->lookupScala
r(srcPt.fX - src_x)); |
| 146 | 146 |
| 147 float combined_weight = xweight * yweight; | 147 float combined_weight = xweight * yweight; |
| 148 | 148 |
| 149 SkPMColor color = *s.fBitmap->getAddr32(src_x, src_y); | 149 SkPMColor color = *s.fBitmap->getAddr32(src_x, src_y); |
| 150 | 150 |
| 151 __m128 c = _mm_set_ps((float)SkGetPackedB32(color), | 151 __m128 c = _mm_set_ps((float)SkGetPackedB32(color), |
| 152 (float)SkGetPackedG32(color), | 152 (float)SkGetPackedG32(color), |
| 153 (float)SkGetPackedR32(color), | 153 (float)SkGetPackedR32(color), |
| 154 (float)SkGetPackedA32(color)); | 154 (float)SkGetPackedA32(color)); |
| 155 | 155 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 173 | 173 |
| 174 *colors++ = SkPackARGB32(a, r, g, b); | 174 *colors++ = SkPackARGB32(a, r, g, b); |
| 175 | 175 |
| 176 x++; | 176 x++; |
| 177 | 177 |
| 178 s.fInvProc(*s.fInvMatrix, SkIntToScalar(x), | 178 s.fInvProc(*s.fInvMatrix, SkIntToScalar(x), |
| 179 SkIntToScalar(y), &srcPt); | 179 SkIntToScalar(y), &srcPt); |
| 180 | 180 |
| 181 } | 181 } |
| 182 } | 182 } |
| OLD | NEW |