| Index: src/core/SkBitmapFilter.h
|
| diff --git a/src/core/SkBitmapFilter.h b/src/core/SkBitmapFilter.h
|
| index ca3e0930f27570ebff359e95370a81f59d189f5c..6fa8edde3460ab3992cc14f0e90c216f83665436 100644
|
| --- a/src/core/SkBitmapFilter.h
|
| +++ b/src/core/SkBitmapFilter.h
|
| @@ -27,6 +27,15 @@
|
| fLookupMultiplier = this->invWidth() * (SKBITMAP_FILTER_TABLE_SIZE-1);
|
| }
|
| virtual ~SkBitmapFilter() {}
|
| +
|
| + SkFixed lookup(float x) const {
|
| + if (!fPrecomputed) {
|
| + precomputeTable();
|
| + }
|
| + int filter_idx = int(sk_float_abs(x * fLookupMultiplier));
|
| + SkASSERT(filter_idx < SKBITMAP_FILTER_TABLE_SIZE);
|
| + return fFilterTable[filter_idx];
|
| + }
|
|
|
| SkScalar lookupScalar(float x) const {
|
| if (!fPrecomputed) {
|
| @@ -58,16 +67,19 @@
|
| float fLookupMultiplier;
|
|
|
| mutable bool fPrecomputed;
|
| + mutable SkFixed fFilterTable[SKBITMAP_FILTER_TABLE_SIZE];
|
| mutable SkScalar fFilterTableScalar[SKBITMAP_FILTER_TABLE_SIZE];
|
|
|
| private:
|
| void precomputeTable() const {
|
| fPrecomputed = true;
|
| + SkFixed *ftp = fFilterTable;
|
| SkScalar *ftpScalar = fFilterTableScalar;
|
| for (int x = 0; x < SKBITMAP_FILTER_TABLE_SIZE; ++x) {
|
| float fx = ((float)x + .5f) * this->width() / SKBITMAP_FILTER_TABLE_SIZE;
|
| float filter_value = evaluate(fx);
|
| *ftpScalar++ = filter_value;
|
| + *ftp++ = SkFloatToFixed(filter_value);
|
| }
|
| }
|
| };
|
|
|