OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "SkConvolver.h" | 5 #include "SkConvolver.h" |
6 #include "SkSize.h" | 6 #include "SkSize.h" |
7 #include "SkTypes.h" | 7 #include "SkTypes.h" |
8 | 8 |
9 namespace { | 9 namespace { |
10 | 10 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 outRow[outX * 4 + 0] = ClampTo8(accum[0]); | 152 outRow[outX * 4 + 0] = ClampTo8(accum[0]); |
153 outRow[outX * 4 + 1] = ClampTo8(accum[1]); | 153 outRow[outX * 4 + 1] = ClampTo8(accum[1]); |
154 outRow[outX * 4 + 2] = ClampTo8(accum[2]); | 154 outRow[outX * 4 + 2] = ClampTo8(accum[2]); |
155 if (hasAlpha) { | 155 if (hasAlpha) { |
156 outRow[outX * 4 + 3] = ClampTo8(accum[3]); | 156 outRow[outX * 4 + 3] = ClampTo8(accum[3]); |
157 } | 157 } |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 // There's a bug somewhere here with GCC autovectorization (-ftree-vectorize
) on 32 bit builds. | 161 // There's a bug somewhere here with GCC autovectorization (-ftree-vectorize
) on 32 bit builds. |
162 // Dropping to -O2 disables -ftree-vectorize. http://skbug.com/2575 | 162 // Dropping to -O2 disables -ftree-vectorize. GCC 4.6 needs noinline. http
://skbug.com/2575 |
163 #if defined(__i386) && SK_HAS_ATTRIBUTE(optimize) && defined(SK_RELEASE) | 163 #if defined(__i386) && SK_HAS_ATTRIBUTE(optimize) && defined(SK_RELEASE) |
164 #define SK_MAYBE_DISABLE_VECTORIZATION __attribute__((optimize("O2"))) | 164 #define SK_MAYBE_DISABLE_VECTORIZATION __attribute__((optimize("O2"), no
inline)) |
165 #else | 165 #else |
166 #define SK_MAYBE_DISABLE_VECTORIZATION | 166 #define SK_MAYBE_DISABLE_VECTORIZATION |
167 #endif | 167 #endif |
168 | 168 |
169 SK_MAYBE_DISABLE_VECTORIZATION | 169 SK_MAYBE_DISABLE_VECTORIZATION |
170 static void ConvolveHorizontallyAlpha(const unsigned char* srcData, | 170 static void ConvolveHorizontallyAlpha(const unsigned char* srcData, |
171 const SkConvolutionFilter1D& filter, | 171 const SkConvolutionFilter1D& filter, |
172 unsigned char* outRow) { | 172 unsigned char* outRow) { |
173 return ConvolveHorizontally<true>(srcData, filter, outRow); | 173 return ConvolveHorizontally<true>(srcData, filter, outRow); |
174 } | 174 } |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 filterX.numValues(), curOutputRow
, | 477 filterX.numValues(), curOutputRow
, |
478 sourceHasAlpha); | 478 sourceHasAlpha); |
479 } else { | 479 } else { |
480 ConvolveVertically(filterValues, filterLength, | 480 ConvolveVertically(filterValues, filterLength, |
481 firstRowForFilter, | 481 firstRowForFilter, |
482 filterX.numValues(), curOutputRow, | 482 filterX.numValues(), curOutputRow, |
483 sourceHasAlpha); | 483 sourceHasAlpha); |
484 } | 484 } |
485 } | 485 } |
486 } | 486 } |
OLD | NEW |