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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // Store the new pixel. | 151 // Store the new pixel. |
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
). We originally |
| 162 // thought this was 32 bit only, but subsequent tests show that some 64 bit
gcc compiles |
| 163 // suffer here too. |
| 164 // |
162 // Dropping to -O2 disables -ftree-vectorize. GCC 4.6 needs noinline. http
://skbug.com/2575 | 165 // 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) | 166 #if SK_HAS_ATTRIBUTE(optimize) && defined(SK_RELEASE) |
164 #define SK_MAYBE_DISABLE_VECTORIZATION __attribute__((optimize("O2"), no
inline)) | 167 #define SK_MAYBE_DISABLE_VECTORIZATION __attribute__((optimize("O2"), no
inline)) |
165 #else | 168 #else |
166 #define SK_MAYBE_DISABLE_VECTORIZATION | 169 #define SK_MAYBE_DISABLE_VECTORIZATION |
167 #endif | 170 #endif |
168 | 171 |
169 SK_MAYBE_DISABLE_VECTORIZATION | 172 SK_MAYBE_DISABLE_VECTORIZATION |
170 static void ConvolveHorizontallyAlpha(const unsigned char* srcData, | 173 static void ConvolveHorizontallyAlpha(const unsigned char* srcData, |
171 const SkConvolutionFilter1D& filter, | 174 const SkConvolutionFilter1D& filter, |
172 unsigned char* outRow) { | 175 unsigned char* outRow) { |
173 return ConvolveHorizontally<true>(srcData, filter, outRow); | 176 return ConvolveHorizontally<true>(srcData, filter, outRow); |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 filterX.numValues(), curOutputRow
, | 480 filterX.numValues(), curOutputRow
, |
478 sourceHasAlpha); | 481 sourceHasAlpha); |
479 } else { | 482 } else { |
480 ConvolveVertically(filterValues, filterLength, | 483 ConvolveVertically(filterValues, filterLength, |
481 firstRowForFilter, | 484 firstRowForFilter, |
482 filterX.numValues(), curOutputRow, | 485 filterX.numValues(), curOutputRow, |
483 sourceHasAlpha); | 486 sourceHasAlpha); |
484 } | 487 } |
485 } | 488 } |
486 } | 489 } |
OLD | NEW |