OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 <arm_neon.h> | 8 #include <arm_neon.h> |
9 | 9 |
10 #define SCALE_NOFILTER_NAME MAKENAME(_nofilter_scale) | 10 #define SCALE_NOFILTER_NAME MAKENAME(_nofilter_scale) |
(...skipping 22 matching lines...) Expand all Loading... |
33 SkMatrix::kScale_Mask)) == 0); | 33 SkMatrix::kScale_Mask)) == 0); |
34 | 34 |
35 PREAMBLE(s); | 35 PREAMBLE(s); |
36 | 36 |
37 // we store y, x, x, x, x, x | 37 // we store y, x, x, x, x, x |
38 const unsigned maxX = s.fPixmap.width() - 1; | 38 const unsigned maxX = s.fPixmap.width() - 1; |
39 SkFractionalInt fx; | 39 SkFractionalInt fx; |
40 { | 40 { |
41 const SkBitmapProcStateAutoMapper mapper(s, x, y); | 41 const SkBitmapProcStateAutoMapper mapper(s, x, y); |
42 const unsigned maxY = s.fPixmap.height() - 1; | 42 const unsigned maxY = s.fPixmap.height() - 1; |
43 *xy++ = TILEY_PROCF(SkFractionalIntToFixed(mapper.y()), maxY); | 43 *xy++ = TILEY_PROCF(mapper.fixedY(), maxY); |
44 fx = mapper.x(); | 44 fx = mapper.fractionalIntX(); |
45 } | 45 } |
46 | 46 |
47 if (0 == maxX) { | 47 if (0 == maxX) { |
48 // all of the following X values must be 0 | 48 // all of the following X values must be 0 |
49 memset(xy, 0, count * sizeof(uint16_t)); | 49 memset(xy, 0, count * sizeof(uint16_t)); |
50 return; | 50 return; |
51 } | 51 } |
52 | 52 |
53 const SkFractionalInt dx = s.fInvSxFractionalInt; | 53 const SkFractionalInt dx = s.fInvSxFractionalInt; |
54 | 54 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 static void AFFINE_NOFILTER_NAME(const SkBitmapProcState& s, | 110 static void AFFINE_NOFILTER_NAME(const SkBitmapProcState& s, |
111 uint32_t xy[], int count, int x, int y) { | 111 uint32_t xy[], int count, int x, int y) { |
112 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask); | 112 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask); |
113 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | | 113 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | |
114 SkMatrix::kScale_Mask | | 114 SkMatrix::kScale_Mask | |
115 SkMatrix::kAffine_Mask)) == 0); | 115 SkMatrix::kAffine_Mask)) == 0); |
116 | 116 |
117 PREAMBLE(s); | 117 PREAMBLE(s); |
118 const SkBitmapProcStateAutoMapper mapper(s, x, y); | 118 const SkBitmapProcStateAutoMapper mapper(s, x, y); |
119 | 119 |
120 SkFractionalInt fx = mapper.x(); | 120 SkFractionalInt fx = mapper.fractionalIntX(); |
121 SkFractionalInt fy = mapper.y(); | 121 SkFractionalInt fy = mapper.fractionalIntY(); |
122 SkFractionalInt dx = s.fInvSxFractionalInt; | 122 SkFractionalInt dx = s.fInvSxFractionalInt; |
123 SkFractionalInt dy = s.fInvKyFractionalInt; | 123 SkFractionalInt dy = s.fInvKyFractionalInt; |
124 int maxX = s.fPixmap.width() - 1; | 124 int maxX = s.fPixmap.width() - 1; |
125 int maxY = s.fPixmap.height() - 1; | 125 int maxY = s.fPixmap.height() - 1; |
126 | 126 |
127 if (count >= 8) { | 127 if (count >= 8) { |
128 SkFractionalInt dx4 = dx * 4; | 128 SkFractionalInt dx4 = dx * 4; |
129 SkFractionalInt dy4 = dy * 4; | 129 SkFractionalInt dy4 = dy * 4; |
130 SkFractionalInt dx8 = dx * 8; | 130 SkFractionalInt dx8 = dx * 8; |
131 SkFractionalInt dy8 = dy * 8; | 131 SkFractionalInt dy8 = dy * 8; |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 | 292 |
293 PREAMBLE(s); | 293 PREAMBLE(s); |
294 | 294 |
295 const unsigned maxX = s.fPixmap.width() - 1; | 295 const unsigned maxX = s.fPixmap.width() - 1; |
296 const SkFixed one = s.fFilterOneX; | 296 const SkFixed one = s.fFilterOneX; |
297 const SkFractionalInt dx = s.fInvSxFractionalInt; | 297 const SkFractionalInt dx = s.fInvSxFractionalInt; |
298 SkFractionalInt fx; | 298 SkFractionalInt fx; |
299 | 299 |
300 { | 300 { |
301 const SkBitmapProcStateAutoMapper mapper(s, x, y); | 301 const SkBitmapProcStateAutoMapper mapper(s, x, y); |
302 const SkFixed fy = SkFractionalIntToFixed(mapper.y()); | 302 const SkFixed fy = mapper.fixedY(); |
303 const unsigned maxY = s.fPixmap.height() - 1; | 303 const unsigned maxY = s.fPixmap.height() - 1; |
304 // compute our two Y values up front | 304 // compute our two Y values up front |
305 *xy++ = PACK_FILTER_Y_NAME(fy, maxY, s.fFilterOneY PREAMBLE_ARG_Y); | 305 *xy++ = PACK_FILTER_Y_NAME(fy, maxY, s.fFilterOneY PREAMBLE_ARG_Y); |
306 // now initialize fx | 306 // now initialize fx |
307 fx = mapper.x(); | 307 fx = mapper.fractionalIntX(); |
308 } | 308 } |
309 | 309 |
310 #ifdef CHECK_FOR_DECAL | 310 #ifdef CHECK_FOR_DECAL |
311 // test if we don't need to apply the tile proc | 311 // test if we don't need to apply the tile proc |
312 if (can_truncate_to_fixed_for_decal(fx, dx, count, maxX)) { | 312 if (can_truncate_to_fixed_for_decal(fx, dx, count, maxX)) { |
313 decal_filter_scale_neon(xy, SkFractionalIntToFixed(fx), | 313 decal_filter_scale_neon(xy, SkFractionalIntToFixed(fx), |
314 SkFractionalIntToFixed(dx), count); | 314 SkFractionalIntToFixed(dx), count); |
315 return; | 315 return; |
316 } | 316 } |
317 #endif | 317 #endif |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask); | 352 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask); |
353 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | | 353 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | |
354 SkMatrix::kScale_Mask | | 354 SkMatrix::kScale_Mask | |
355 SkMatrix::kAffine_Mask)) == 0); | 355 SkMatrix::kAffine_Mask)) == 0); |
356 | 356 |
357 PREAMBLE(s); | 357 PREAMBLE(s); |
358 const SkBitmapProcStateAutoMapper mapper(s, x, y); | 358 const SkBitmapProcStateAutoMapper mapper(s, x, y); |
359 | 359 |
360 SkFixed oneX = s.fFilterOneX; | 360 SkFixed oneX = s.fFilterOneX; |
361 SkFixed oneY = s.fFilterOneY; | 361 SkFixed oneY = s.fFilterOneY; |
362 SkFixed fx = SkFractionalIntToFixed(mapper.x()); | 362 SkFixed fx = mapper.fixedX(); |
363 SkFixed fy = SkFractionalIntToFixed(mapper.y()); | 363 SkFixed fy = mapper.fixedY(); |
364 SkFixed dx = s.fInvSx; | 364 SkFixed dx = s.fInvSx; |
365 SkFixed dy = s.fInvKy; | 365 SkFixed dy = s.fInvKy; |
366 unsigned maxX = s.fPixmap.width() - 1; | 366 unsigned maxX = s.fPixmap.width() - 1; |
367 unsigned maxY = s.fPixmap.height() - 1; | 367 unsigned maxY = s.fPixmap.height() - 1; |
368 | 368 |
369 if (count >= 4) { | 369 if (count >= 4) { |
370 int32x4_t wide_fy, wide_fx; | 370 int32x4_t wide_fy, wide_fx; |
371 | 371 |
372 wide_fx = vdupq_n_s32(fx); | 372 wide_fx = vdupq_n_s32(fx); |
373 wide_fx = vsetq_lane_s32(fx+dx, wide_fx, 1); | 373 wide_fx = vsetq_lane_s32(fx+dx, wide_fx, 1); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 #undef PERSP_FILTER_NAME | 491 #undef PERSP_FILTER_NAME |
492 | 492 |
493 #undef PREAMBLE | 493 #undef PREAMBLE |
494 #undef PREAMBLE_PARAM_X | 494 #undef PREAMBLE_PARAM_X |
495 #undef PREAMBLE_PARAM_Y | 495 #undef PREAMBLE_PARAM_Y |
496 #undef PREAMBLE_ARG_X | 496 #undef PREAMBLE_ARG_X |
497 #undef PREAMBLE_ARG_Y | 497 #undef PREAMBLE_ARG_Y |
498 | 498 |
499 #undef TILEX_LOW_BITS | 499 #undef TILEX_LOW_BITS |
500 #undef TILEY_LOW_BITS | 500 #undef TILEY_LOW_BITS |
OLD | NEW |