Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: src/opts/SkBitmapProcState_matrix_neon.h

Issue 1661613002: Use SkBitmapProcStateAutoMapper for filter samplers also (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkBitmapProcState_shaderproc.h ('k') | src/opts/SkBitmapProcState_opts_SSE2.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 SkASSERT(s.fInvKy == 0); 291 SkASSERT(s.fInvKy == 0);
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 SkPoint pt; 301 const SkBitmapProcStateAutoMapper mapper(s, x, y);
302 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, 302 const SkFixed fy = SkFractionalIntToFixed(mapper.y());
303 SkIntToScalar(y) + SK_ScalarHalf, &pt);
304 const SkFixed fy = SkScalarToFixed(pt.fY) - (s.fFilterOneY >> 1);
305 const unsigned maxY = s.fPixmap.height() - 1; 303 const unsigned maxY = s.fPixmap.height() - 1;
306 // compute our two Y values up front 304 // compute our two Y values up front
307 *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);
308 // now initialize fx 306 // now initialize fx
309 fx = SkScalarToFractionalInt(pt.fX) - (SkFixedToFractionalInt(one) >> 1) ; 307 fx = mapper.x();
310 } 308 }
311 309
312 #ifdef CHECK_FOR_DECAL 310 #ifdef CHECK_FOR_DECAL
313 // test if we don't need to apply the tile proc 311 // test if we don't need to apply the tile proc
314 if (can_truncate_to_fixed_for_decal(fx, dx, count, maxX)) { 312 if (can_truncate_to_fixed_for_decal(fx, dx, count, maxX)) {
315 decal_filter_scale_neon(xy, SkFractionalIntToFixed(fx), 313 decal_filter_scale_neon(xy, SkFractionalIntToFixed(fx),
316 SkFractionalIntToFixed(dx), count); 314 SkFractionalIntToFixed(dx), count);
317 return; 315 return;
318 } 316 }
319 #endif 317 #endif
(...skipping 30 matching lines...) Expand all
350 } 348 }
351 349
352 static void AFFINE_FILTER_NAME(const SkBitmapProcState& s, 350 static void AFFINE_FILTER_NAME(const SkBitmapProcState& s,
353 uint32_t xy[], int count, int x, int y) { 351 uint32_t xy[], int count, int x, int y) {
354 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask); 352 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask);
355 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | 353 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
356 SkMatrix::kScale_Mask | 354 SkMatrix::kScale_Mask |
357 SkMatrix::kAffine_Mask)) == 0); 355 SkMatrix::kAffine_Mask)) == 0);
358 356
359 PREAMBLE(s); 357 PREAMBLE(s);
360 SkPoint srcPt; 358 const SkBitmapProcStateAutoMapper mapper(s, x, y);
361 s.fInvProc(s.fInvMatrix,
362 SkIntToScalar(x) + SK_ScalarHalf,
363 SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
364 359
365 SkFixed oneX = s.fFilterOneX; 360 SkFixed oneX = s.fFilterOneX;
366 SkFixed oneY = s.fFilterOneY; 361 SkFixed oneY = s.fFilterOneY;
367 SkFixed fx = SkScalarToFixed(srcPt.fX) - (oneX >> 1); 362 SkFixed fx = SkFractionalIntToFixed(mapper.x());
368 SkFixed fy = SkScalarToFixed(srcPt.fY) - (oneY >> 1); 363 SkFixed fy = SkFractionalIntToFixed(mapper.y());
369 SkFixed dx = s.fInvSx; 364 SkFixed dx = s.fInvSx;
370 SkFixed dy = s.fInvKy; 365 SkFixed dy = s.fInvKy;
371 unsigned maxX = s.fPixmap.width() - 1; 366 unsigned maxX = s.fPixmap.width() - 1;
372 unsigned maxY = s.fPixmap.height() - 1; 367 unsigned maxY = s.fPixmap.height() - 1;
373 368
374 if (count >= 4) { 369 if (count >= 4) {
375 int32x4_t wide_fy, wide_fx; 370 int32x4_t wide_fy, wide_fx;
376 371
377 wide_fx = vdupq_n_s32(fx); 372 wide_fx = vdupq_n_s32(fx);
378 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
496 #undef PERSP_FILTER_NAME 491 #undef PERSP_FILTER_NAME
497 492
498 #undef PREAMBLE 493 #undef PREAMBLE
499 #undef PREAMBLE_PARAM_X 494 #undef PREAMBLE_PARAM_X
500 #undef PREAMBLE_PARAM_Y 495 #undef PREAMBLE_PARAM_Y
501 #undef PREAMBLE_ARG_X 496 #undef PREAMBLE_ARG_X
502 #undef PREAMBLE_ARG_Y 497 #undef PREAMBLE_ARG_Y
503 498
504 #undef TILEX_LOW_BITS 499 #undef TILEX_LOW_BITS
505 #undef TILEY_LOW_BITS 500 #undef TILEY_LOW_BITS
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState_shaderproc.h ('k') | src/opts/SkBitmapProcState_opts_SSE2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698