Index: src/core/SkConvolver.cpp |
diff --git a/src/core/SkConvolver.cpp b/src/core/SkConvolver.cpp |
index 08d9f454968c4763bcb571236e4729835282f277..0ef683c5f73f871cf6cae823108a6ef0296d28f4 100644 |
--- a/src/core/SkConvolver.cpp |
+++ b/src/core/SkConvolver.cpp |
@@ -158,6 +158,31 @@ template<bool hasAlpha> |
} |
} |
+ // There's a bug somewhere here with GCC autovectorization (-ftree-vectorize) on 32 bit builds. |
+ // Dropping to -O2 disables -ftree-vectorize. http://skbug.com/2575 |
+ #if defined(__i386) && SK_HAS_ATTRIBUTE(optimize) && defined(SK_RELEASE) |
+ #define SK_MAYBE_DISABLE_VECTORIZATION __attribute__((optimize("O2"))) |
+ #else |
+ #define SK_MAYBE_DISABLE_VECTORIZATION |
+ #endif |
+ |
+ SK_MAYBE_DISABLE_VECTORIZATION |
+ static void ConvolveHorizontallyAlpha(const unsigned char* srcData, |
+ const SkConvolutionFilter1D& filter, |
+ unsigned char* outRow) { |
+ return ConvolveHorizontally<true>(srcData, filter, outRow); |
+ } |
+ |
+ SK_MAYBE_DISABLE_VECTORIZATION |
+ static void ConvolveHorizontallyNoAlpha(const unsigned char* srcData, |
+ const SkConvolutionFilter1D& filter, |
+ unsigned char* outRow) { |
+ return ConvolveHorizontally<false>(srcData, filter, outRow); |
+ } |
+ |
+ #undef SK_MAYBE_DISABLE_VECTORIZATION |
+ |
+ |
// Does vertical convolution to produce one output row. The filter values and |
// length are given in the first two parameters. These are applied to each |
// of the rows pointed to in the |sourceDataRows| array, with each row |
@@ -330,11 +355,6 @@ const SkConvolutionFilter1D::ConvolutionFixed* SkConvolutionFilter1D::GetSingleF |
return &fFilterValues[filter.fDataLocation]; |
} |
-// There's a bug somewhere in here with GCC autovectorization (-ftree-vectorize) on 32 bit builds. |
-// Dropping to -O2 disables -ftree-vectorize. http://skbug.com/2575 |
-#if defined(__i386) && SK_HAS_ATTRIBUTE(optimize) && defined(SK_RELEASE) |
- __attribute__((optimize("O2"))) |
-#endif |
void BGRAConvolve2D(const unsigned char* sourceData, |
int sourceByteRowStride, |
bool sourceHasAlpha, |
@@ -425,11 +445,11 @@ void BGRAConvolve2D(const unsigned char* sourceData, |
filterX, rowBuffer.advanceRow(), sourceHasAlpha); |
} else { |
if (sourceHasAlpha) { |
- ConvolveHorizontally<true>( |
+ ConvolveHorizontallyAlpha( |
&sourceData[(uint64_t)nextXRow * sourceByteRowStride], |
filterX, rowBuffer.advanceRow()); |
} else { |
- ConvolveHorizontally<false>( |
+ ConvolveHorizontallyNoAlpha( |
&sourceData[(uint64_t)nextXRow * sourceByteRowStride], |
filterX, rowBuffer.advanceRow()); |
} |