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

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

Issue 85463005: remove SkFloatToScalar macro (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add flag to expose SkFloatToScalar to chromium Created 7 years 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 | « src/core/SkBBoxRecord.cpp ('k') | src/core/SkBitmapFilter.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 /* 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
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
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
OLDNEW
« no previous file with comments | « src/core/SkBBoxRecord.cpp ('k') | src/core/SkBitmapFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698