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

Side by Side Diff: src/core/SkBitmapProcState_shaderproc.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_matrix.h ('k') | src/opts/SkBitmapProcState_matrix_neon.h » ('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 2011 Google Inc. 2 * Copyright 2011 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 "SkMathPriv.h" 8 #include "SkMathPriv.h"
9 9
10 #define SCALE_FILTER_NAME MAKENAME(_filter_DX_shaderproc) 10 #define SCALE_FILTER_NAME MAKENAME(_filter_DX_shaderproc)
(...skipping 13 matching lines...) Expand all
24 24
25 const unsigned maxX = s.fPixmap.width() - 1; 25 const unsigned maxX = s.fPixmap.width() - 1;
26 const SkFixed oneX = s.fFilterOneX; 26 const SkFixed oneX = s.fFilterOneX;
27 const SkFixed dx = s.fInvSx; 27 const SkFixed dx = s.fInvSx;
28 SkFixed fx; 28 SkFixed fx;
29 const SRCTYPE* SK_RESTRICT row0; 29 const SRCTYPE* SK_RESTRICT row0;
30 const SRCTYPE* SK_RESTRICT row1; 30 const SRCTYPE* SK_RESTRICT row1;
31 unsigned subY; 31 unsigned subY;
32 32
33 { 33 {
34 SkPoint pt; 34 const SkBitmapProcStateAutoMapper mapper(s, x, y);
35 s.fInvProc(s.fInvMatrix, SkIntToScalar(x) + SK_ScalarHalf, 35 SkFixed fy = SkFractionalIntToFixed(mapper.y());
36 SkIntToScalar(y) + SK_ScalarHalf, &pt);
37 SkFixed fy = SkScalarToFixed(pt.fY) - (s.fFilterOneY >> 1);
38 const unsigned maxY = s.fPixmap.height() - 1; 36 const unsigned maxY = s.fPixmap.height() - 1;
39 // compute our two Y values up front 37 // compute our two Y values up front
40 subY = TILEY_LOW_BITS(fy, maxY); 38 subY = TILEY_LOW_BITS(fy, maxY);
41 int y0 = TILEY_PROCF(fy, maxY); 39 int y0 = TILEY_PROCF(fy, maxY);
42 int y1 = TILEY_PROCF((fy + s.fFilterOneY), maxY); 40 int y1 = TILEY_PROCF((fy + s.fFilterOneY), maxY);
43 41
44 const char* SK_RESTRICT srcAddr = (const char*)s.fPixmap.addr(); 42 const char* SK_RESTRICT srcAddr = (const char*)s.fPixmap.addr();
45 size_t rb = s.fPixmap.rowBytes(); 43 size_t rb = s.fPixmap.rowBytes();
46 row0 = (const SRCTYPE*)(srcAddr + y0 * rb); 44 row0 = (const SRCTYPE*)(srcAddr + y0 * rb);
47 row1 = (const SRCTYPE*)(srcAddr + y1 * rb); 45 row1 = (const SRCTYPE*)(srcAddr + y1 * rb);
48 // now initialize fx 46 // now initialize fx
49 fx = SkScalarToFixed(pt.fX) - (oneX >> 1); 47 fx = SkFractionalIntToFixed(mapper.x());
50 } 48 }
51 49
52 #ifdef PREAMBLE 50 #ifdef PREAMBLE
53 PREAMBLE(s); 51 PREAMBLE(s);
54 #endif 52 #endif
55 53
56 do { 54 do {
57 unsigned subX = TILEX_LOW_BITS(fx, maxX); 55 unsigned subX = TILEX_LOW_BITS(fx, maxX);
58 unsigned x0 = TILEX_PROCF(fx, maxX); 56 unsigned x0 = TILEX_PROCF(fx, maxX);
59 unsigned x1 = TILEX_PROCF((fx + oneX), maxX); 57 unsigned x1 = TILEX_PROCF((fx + oneX), maxX);
(...skipping 22 matching lines...) Expand all
82 #undef TILEY_LOW_BITS 80 #undef TILEY_LOW_BITS
83 #undef MAKENAME 81 #undef MAKENAME
84 #undef SRCTYPE 82 #undef SRCTYPE
85 #undef CHECKSTATE 83 #undef CHECKSTATE
86 #undef SRC_TO_FILTER 84 #undef SRC_TO_FILTER
87 #undef FILTER_TO_DST 85 #undef FILTER_TO_DST
88 #undef PREAMBLE 86 #undef PREAMBLE
89 #undef POSTAMBLE 87 #undef POSTAMBLE
90 88
91 #undef SCALE_FILTER_NAME 89 #undef SCALE_FILTER_NAME
OLDNEW
« no previous file with comments | « src/core/SkBitmapProcState_matrix.h ('k') | src/opts/SkBitmapProcState_matrix_neon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698