| OLD | NEW |
| 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 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 mutable SkFixed fFilterTable[SKBITMAP_FILTER_TABLE_SIZE]; | 60 mutable SkFixed fFilterTable[SKBITMAP_FILTER_TABLE_SIZE]; |
| 61 mutable SkScalar fFilterTableScalar[SKBITMAP_FILTER_TABLE_SIZE]; | 61 mutable SkScalar fFilterTableScalar[SKBITMAP_FILTER_TABLE_SIZE]; |
| 62 private: | 62 private: |
| 63 void precomputeTable() const { | 63 void precomputeTable() const { |
| 64 fPrecomputed = true; | 64 fPrecomputed = true; |
| 65 SkFixed *ftp = fFilterTable; | 65 SkFixed *ftp = fFilterTable; |
| 66 SkScalar *ftpScalar = fFilterTableScalar; | 66 SkScalar *ftpScalar = fFilterTableScalar; |
| 67 for (int x = 0; x < SKBITMAP_FILTER_TABLE_SIZE; ++x) { | 67 for (int x = 0; x < SKBITMAP_FILTER_TABLE_SIZE; ++x) { |
| 68 float fx = ((float)x + .5f) * this->width() / SKBITMAP_FILTER_TABL
E_SIZE; | 68 float fx = ((float)x + .5f) * this->width() / SKBITMAP_FILTER_TABL
E_SIZE; |
| 69 float filter_value = evaluate(fx); | 69 float filter_value = evaluate(fx); |
| 70 *ftpScalar++ = SkFloatToScalar(filter_value); | 70 *ftpScalar++ = filter_value; |
| 71 *ftp++ = SkFloatToFixed(filter_value); | 71 *ftp++ = SkFloatToFixed(filter_value); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 class SkMitchellFilter: public SkBitmapFilter { | 76 class SkMitchellFilter: public SkBitmapFilter { |
| 77 public: | 77 public: |
| 78 SkMitchellFilter(float b, float c, float width=2.0f) | 78 SkMitchellFilter(float b, float c, float width=2.0f) |
| 79 : SkBitmapFilter(width), B(b), C(c) { | 79 : SkBitmapFilter(width), B(b), C(c) { |
| 80 } | 80 } |
| (...skipping 85 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 |