OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
4 * | 3 * |
5 * 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 |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 | 7 |
9 | |
10 #ifndef SkBitmapFilter_DEFINED | 8 #ifndef SkBitmapFilter_DEFINED |
11 #define SkBitmapFilter_DEFINED | 9 #define SkBitmapFilter_DEFINED |
12 | 10 |
| 11 #include "SkFixed.h" |
13 #include "SkMath.h" | 12 #include "SkMath.h" |
| 13 #include "SkScalar.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 128 | 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) |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 return 1.0f; // Special case the discontinuity at the origin. | 166 return 1.0f; // Special case the discontinuity at the origin. |
167 } | 167 } |
168 float xpi = x * static_cast<float>(SK_ScalarPI); | 168 float xpi = x * static_cast<float>(SK_ScalarPI); |
169 return (sk_float_sin(xpi) / xpi) * // sinc(x) | 169 return (sk_float_sin(xpi) / xpi) * // sinc(x) |
170 sk_float_sin(xpi / fWidth) / (xpi / fWidth); // sinc(x/fWidth
) | 170 sk_float_sin(xpi / fWidth) / (xpi / fWidth); // sinc(x/fWidth
) |
171 } | 171 } |
172 }; | 172 }; |
173 | 173 |
174 | 174 |
175 #endif | 175 #endif |
OLD | NEW |