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

Side by Side Diff: src/core/SkBitmapFilter.h

Issue 19013004: fix bug with awesome filtered images sometimes being slightly offset. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/core/SkBitmapFilter.cpp » ('j') | src/core/SkBitmapFilter.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkBitmapFilter_DEFINED 10 #ifndef SkBitmapFilter_DEFINED
11 #define SkBitmapFilter_DEFINED 11 #define SkBitmapFilter_DEFINED
12 12
13 #include "SkMath.h" 13 #include "SkMath.h"
14 14
15 // size of the precomputed bitmap filter tables for high quality filtering. 15 // size of the precomputed bitmap filter tables for high quality filtering.
16 // Used to precompute the shape of the filter kernel. 16 // Used to precompute the shape of the filter kernel.
17 // Table size chosen from experiments to see where I could start to see a differ ence. 17 // Table size chosen from experiments to see where I could start to see a differ ence.
18 18
19 #define SKBITMAP_FILTER_TABLE_SIZE 32 19 #define SKBITMAP_FILTER_TABLE_SIZE 128
20 20
21 class SkBitmapFilter { 21 class SkBitmapFilter {
22 public: 22 public:
23 SkBitmapFilter(float width) 23 SkBitmapFilter(float width)
24 : fWidth(width), fInvWidth(1.f/width) { 24 : fWidth(width), fInvWidth(1.f/width) {
25 precomputed = false; 25 precomputed = false;
26 } 26 }
27 27
28 SkFixed lookup( float x ) const { 28 SkFixed lookup( float x ) const {
29 if (!precomputed) { 29 if (!precomputed) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 float sinc = sk_float_sin(x) / x; 141 float sinc = sk_float_sin(x) / x;
142 float lanczos = sk_float_sin(x * tau) / (x * tau); 142 float lanczos = sk_float_sin(x * tau) / (x * tau);
143 return sinc * lanczos; 143 return sinc * lanczos;
144 } 144 }
145 protected: 145 protected:
146 float tau; 146 float tau;
147 }; 147 };
148 148
149 149
150 #endif 150 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkBitmapFilter.cpp » ('j') | src/core/SkBitmapFilter.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698