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

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

Issue 1656833002: Sampler bias for all nofilter flavors (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_matrixProcs.cpp ('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 20 matching lines...) Expand all
31 uint32_t xy[], int count, int x, int y) { 31 uint32_t xy[], int count, int x, int y) {
32 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | 32 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
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 SkPoint pt; 41 const SkBitmapProcStateAutoMapper mapper(s, x, y);
42 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf,
43 SkIntToScalar(y) + SK_ScalarHalf, &pt);
44 fx = SkScalarToFractionalInt(pt.fY);
45 const unsigned maxY = s.fPixmap.height() - 1; 42 const unsigned maxY = s.fPixmap.height() - 1;
46 *xy++ = TILEY_PROCF(SkFractionalIntToFixed(fx), maxY); 43 *xy++ = TILEY_PROCF(SkFractionalIntToFixed(mapper.y()), maxY);
47 fx = SkScalarToFractionalInt(pt.fX); 44 fx = mapper.x();
48 } 45 }
49 46
50 if (0 == maxX) { 47 if (0 == maxX) {
51 // all of the following X values must be 0 48 // all of the following X values must be 0
52 memset(xy, 0, count * sizeof(uint16_t)); 49 memset(xy, 0, count * sizeof(uint16_t));
53 return; 50 return;
54 } 51 }
55 52
56 const SkFractionalInt dx = s.fInvSxFractionalInt; 53 const SkFractionalInt dx = s.fInvSxFractionalInt;
57 54
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 108 }
112 109
113 static void AFFINE_NOFILTER_NAME(const SkBitmapProcState& s, 110 static void AFFINE_NOFILTER_NAME(const SkBitmapProcState& s,
114 uint32_t xy[], int count, int x, int y) { 111 uint32_t xy[], int count, int x, int y) {
115 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask); 112 SkASSERT(s.fInvType & SkMatrix::kAffine_Mask);
116 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask | 113 SkASSERT((s.fInvType & ~(SkMatrix::kTranslate_Mask |
117 SkMatrix::kScale_Mask | 114 SkMatrix::kScale_Mask |
118 SkMatrix::kAffine_Mask)) == 0); 115 SkMatrix::kAffine_Mask)) == 0);
119 116
120 PREAMBLE(s); 117 PREAMBLE(s);
121 SkPoint srcPt; 118 const SkBitmapProcStateAutoMapper mapper(s, x, y);
122 s.fInvProc(s.fInvMatrix,
123 SkIntToScalar(x) + SK_ScalarHalf,
124 SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
125 119
126 SkFractionalInt fx = SkScalarToFractionalInt(srcPt.fX); 120 SkFractionalInt fx = mapper.x();
127 SkFractionalInt fy = SkScalarToFractionalInt(srcPt.fY); 121 SkFractionalInt fy = mapper.y();
128 SkFractionalInt dx = s.fInvSxFractionalInt; 122 SkFractionalInt dx = s.fInvSxFractionalInt;
129 SkFractionalInt dy = s.fInvKyFractionalInt; 123 SkFractionalInt dy = s.fInvKyFractionalInt;
130 int maxX = s.fPixmap.width() - 1; 124 int maxX = s.fPixmap.width() - 1;
131 int maxY = s.fPixmap.height() - 1; 125 int maxY = s.fPixmap.height() - 1;
132 126
133 if (count >= 8) { 127 if (count >= 8) {
134 SkFractionalInt dx4 = dx * 4; 128 SkFractionalInt dx4 = dx * 4;
135 SkFractionalInt dy4 = dy * 4; 129 SkFractionalInt dy4 = dy * 4;
136 SkFractionalInt dx8 = dx * 8; 130 SkFractionalInt dx8 = dx * 8;
137 SkFractionalInt dy8 = dy * 8; 131 SkFractionalInt dy8 = dy * 8;
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 #undef PERSP_FILTER_NAME 496 #undef PERSP_FILTER_NAME
503 497
504 #undef PREAMBLE 498 #undef PREAMBLE
505 #undef PREAMBLE_PARAM_X 499 #undef PREAMBLE_PARAM_X
506 #undef PREAMBLE_PARAM_Y 500 #undef PREAMBLE_PARAM_Y
507 #undef PREAMBLE_ARG_X 501 #undef PREAMBLE_ARG_X
508 #undef PREAMBLE_ARG_Y 502 #undef PREAMBLE_ARG_Y
509 503
510 #undef TILEX_LOW_BITS 504 #undef TILEX_LOW_BITS
511 #undef TILEY_LOW_BITS 505 #undef TILEY_LOW_BITS
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState_matrixProcs.cpp ('k') | src/opts/SkBitmapProcState_opts_SSE2.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698