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 #ifndef SkBlurMask_DEFINED | 10 #ifndef SkBlurMask_DEFINED |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 static bool Blur(SkMask* dst, const SkMask& src, | 55 static bool Blur(SkMask* dst, const SkMask& src, |
56 SkScalar radius, Style style, Quality quality, | 56 SkScalar radius, Style style, Quality quality, |
57 SkIPoint* margin = NULL); | 57 SkIPoint* margin = NULL); |
58 | 58 |
59 SK_ATTR_DEPRECATED("use sigma version") | 59 SK_ATTR_DEPRECATED("use sigma version") |
60 static bool BlurGroundTruth(SkMask* dst, const SkMask& src, | 60 static bool BlurGroundTruth(SkMask* dst, const SkMask& src, |
61 SkScalar radius, Style style, | 61 SkScalar radius, Style style, |
62 SkIPoint* margin = NULL); | 62 SkIPoint* margin = NULL); |
63 | 63 |
64 static SkScalar ConvertRadiusToSigma(SkScalar radius); | 64 static SkScalar ConvertRadiusToSigma(SkScalar radius); |
| 65 |
| 66 /* Helper functions for analytic rectangle blurs */ |
| 67 |
| 68 /** Look up the intensity of the (one dimnensional) blurred half-plane. |
| 69 @param profile The precomputed 1D blur profile; memory allocated by and
managed by |
| 70 ComputeBlurProfile below. |
| 71 @param loc the location to look up; The lookup will clamp invalid inputs
, but |
| 72 meaningful data are available between 0 and blurred_width |
| 73 @param blurred_width The width of the final, blurred rectangle |
| 74 @param sharp_width The width of the original, unblurred rectangle. |
| 75 */ |
| 76 static uint8_t ProfileLookup(const uint8_t* profile, int loc, int blurred_wi
dth, int sharp_width); |
| 77 |
| 78 /** Allocate memory for and populate the profile of a 1D blurred halfplane.
The caller |
| 79 must free the memory. The amount of memory allocated will be exactly 6*
sigma bytes. |
| 80 @param sigma The standard deviation of the gaussian blur kernel |
| 81 @param profile_out The location to store the allocated profile curve |
| 82 */ |
| 83 |
| 84 static void ComputeBlurProfile(SkScalar sigma, uint8_t** profile_out); |
| 85 |
| 86 /** Compute an entire scanline of a blurred step function. This is a 1D hel
per that |
| 87 will produce both the horizontal and vertical profiles of the blurry rec
tangle. |
| 88 @param pixels Location to store the resulting pixel data; allocated and
managed by caller |
| 89 @param profile Precomputed blur profile computed by ComputeBlurProfile a
bove. |
| 90 @param width Size of the pixels array. |
| 91 @param sigma Standard deviation of the gaussian blur kernel used to comp
ute the profile; |
| 92 this implicitly gives the size of the pixels array. |
| 93 */ |
| 94 |
| 95 static void ComputeBlurredScanline(uint8_t* pixels, const uint8_t* profile, |
| 96 unsigned int width, SkScalar sigma); |
| 97 |
| 98 |
| 99 |
65 }; | 100 }; |
66 | 101 |
67 #endif | 102 #endif |
OLD | NEW |