Index: src/core/SkBitmapFilter.h |
diff --git a/src/core/SkBitmapFilter.h b/src/core/SkBitmapFilter.h |
index dc3ea693b83f8f04057ce79dea064ee5ca8ae14f..6fa8edde3460ab3992cc14f0e90c216f83665436 100644 |
--- a/src/core/SkBitmapFilter.h |
+++ b/src/core/SkBitmapFilter.h |
@@ -12,9 +12,7 @@ |
#include "SkMath.h" |
#include "SkScalar.h" |
-#ifndef SK_SUPPORT_LEGACY_BITMAP_FILTER |
#include "SkNx.h" |
-#endif |
// size of the precomputed bitmap filter tables for high quality filtering. |
// Used to precompute the shape of the filter kernel. |
@@ -52,7 +50,6 @@ public: |
float invWidth() const { return fInvWidth; } |
virtual float evaluate(float x) const = 0; |
-#ifndef SK_SUPPORT_LEGACY_BITMAP_FILTER |
virtual float evaluate_n(float val, float diff, int count, float* output) const { |
float sum = 0; |
for (int index = 0; index < count; index++) { |
@@ -63,7 +60,6 @@ public: |
} |
return sum; |
} |
-#endif |
protected: |
float fWidth; |
@@ -90,9 +86,6 @@ private: |
class SkMitchellFilter final : public SkBitmapFilter { |
public: |
-#ifdef SK_SUPPORT_LEGACY_BITMAP_FILTER |
- SkMitchellFilter() : INHERITED(2), B(1.f / 3), C(1.f / 3) {} |
-#else |
SkMitchellFilter() |
: INHERITED(2) |
, fB(1.f / 3.f) |
@@ -105,39 +98,20 @@ public: |
, fB2(-18 + 12*fB + 6*fC) |
, fD2(6 - 2*fB) |
{} |
-#endif |
float evaluate(float x) const override { |
x = fabsf(x); |
if (x > 2.f) { |
return 0; |
} else if (x > 1.f) { |
-#ifdef SK_SUPPORT_LEGACY_BITMAP_FILTER |
- return ((-B - 6*C) * x*x*x + (6*B + 30*C) * x*x + |
- (-12*B - 48*C) * x + (8*B + 24*C)) * (1.f/6.f); |
-#else |
return (((fA1 * x + fB1) * x + fC1) * x + fD1) * (1.f/6.f); |
-#endif |
} else { |
-#ifdef SK_SUPPORT_LEGACY_BITMAP_FILTER |
- return ((12 - 9*B - 6*C) * x*x*x + |
- (-18 + 12*B + 6*C) * x*x + |
- (6 - 2*B)) * (1.f/6.f); |
-#else |
return ((fA2 * x + fB2) * x*x + fD2) * (1.f/6.f); |
-#endif |
} |
} |
-#ifndef SK_SUPPORT_LEGACY_BITMAP_FILTER |
- // TODO : native Sk4f abs |
- static Sk4f abs(const Sk4f& x) { |
- Sk4f neg = x < Sk4f(0); |
- return neg.thenElse(Sk4f(0) - x, x); |
- } |
- |
Sk4f evalcore_n(const Sk4f& val) const { |
- Sk4f x = abs(val); |
+ Sk4f x = val.abs(); |
f(malita)
2016/02/18 13:43:04
Hopefully no side effects?
|
Sk4f over2 = x > Sk4f(2); |
Sk4f over1 = x > Sk4f(1); |
Sk4f poly1 = (((Sk4f(fA1) * x + Sk4f(fB1)) * x + Sk4f(fC1)) * x + Sk4f(fD1)) |
@@ -166,16 +140,11 @@ public: |
result += INHERITED::evaluate_n(val, diff, count, output); |
return result; |
} |
-#endif |
protected: |
-#ifdef SK_SUPPORT_LEGACY_BITMAP_FILTER |
- float B, C; |
-#else |
float fB, fC; |
float fA1, fB1, fC1, fD1; |
float fA2, fB2, fD2; |
-#endif |
private: |
typedef SkBitmapFilter INHERITED; |
}; |