| 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::kBLUR_SIGMA_SCALE = SkFloatToScalar(0.6f); |
| 16 // code (both on the CPU and the GPU). This magic constant is 1/sqrt(3). | 16 const SkScalar SkBlurMask::kMAX_BLUR_RADIUS = SkIntToScalar(128); |
| 17 | 17 const SkScalar SkBlurMask::kBlurRadiusFudgeFactor = SkFloatToScalar(.57735f); |
| 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 | 18 |
| 23 #define UNROLL_SEPARABLE_LOOPS | 19 #define UNROLL_SEPARABLE_LOOPS |
| 24 | 20 |
| 25 /** | 21 /** |
| 26 * This function performs a box blur in X, of the given radius. If the | 22 * 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, | 23 * "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 | 24 * 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 | 25 * memory in X, for speed. The destination buffer (dst) must be at least |
| 30 * (width + leftRadius + rightRadius) * height bytes in size. | 26 * (width + leftRadius + rightRadius) * height bytes in size. |
| 31 * | 27 * |
| (...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 (void)autoCall.detach(); | 978 (void)autoCall.detach(); |
| 983 } | 979 } |
| 984 | 980 |
| 985 if (style == kInner_Style) { | 981 if (style == kInner_Style) { |
| 986 dst->fBounds = src.fBounds; // restore trimmed bounds | 982 dst->fBounds = src.fBounds; // restore trimmed bounds |
| 987 dst->fRowBytes = src.fRowBytes; | 983 dst->fRowBytes = src.fRowBytes; |
| 988 } | 984 } |
| 989 | 985 |
| 990 return true; | 986 return true; |
| 991 } | 987 } |
| OLD | NEW |