OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkBlurMask.h" | 10 #include "SkBlurMask.h" |
11 #include "SkMath.h" | 11 #include "SkMath.h" |
12 #include "SkTemplates.h" | 12 #include "SkTemplates.h" |
13 #include "SkEndian.h" | 13 #include "SkEndian.h" |
14 | 14 |
15 // scale factor for the blur radius to match the behavior of the all existing bl
ur | 15 const SkScalar SkBlurMask::kBlurRadiusFudgeFactor = SkFloatToScalar(.57735f); |
16 // code (both on the CPU and the GPU). This magic constant is 1/sqrt(3). | |
17 | |
18 // TODO: get rid of this fudge factor and move any required fudging up into | |
19 // the calling library | |
20 | |
21 #define kBlurRadiusFudgeFactor SkFloatToScalar( .57735f ) | |
22 | 16 |
23 #define UNROLL_SEPARABLE_LOOPS | 17 #define UNROLL_SEPARABLE_LOOPS |
24 | 18 |
25 /** | 19 /** |
26 * This function performs a box blur in X, of the given radius. If the | 20 * This function performs a box blur in X, of the given radius. If the |
27 * "transpose" parameter is true, it will transpose the pixels on write, | 21 * "transpose" parameter is true, it will transpose the pixels on write, |
28 * such that X and Y are swapped. Reads are always performed from contiguous | 22 * such that X and Y are swapped. Reads are always performed from contiguous |
29 * memory in X, for speed. The destination buffer (dst) must be at least | 23 * memory in X, for speed. The destination buffer (dst) must be at least |
30 * (width + leftRadius + rightRadius) * height bytes in size. | 24 * (width + leftRadius + rightRadius) * height bytes in size. |
31 * | 25 * |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 (void)autoCall.detach(); | 976 (void)autoCall.detach(); |
983 } | 977 } |
984 | 978 |
985 if (style == kInner_Style) { | 979 if (style == kInner_Style) { |
986 dst->fBounds = src.fBounds; // restore trimmed bounds | 980 dst->fBounds = src.fBounds; // restore trimmed bounds |
987 dst->fRowBytes = src.fRowBytes; | 981 dst->fRowBytes = src.fRowBytes; |
988 } | 982 } |
989 | 983 |
990 return true; | 984 return true; |
991 } | 985 } |
OLD | NEW |