OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkBlurMask_DEFINED | 8 #ifndef SkBlurMask_DEFINED |
9 #define SkBlurMask_DEFINED | 9 #define SkBlurMask_DEFINED |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 /* Helper functions for analytic rectangle blurs */ | 47 /* Helper functions for analytic rectangle blurs */ |
48 | 48 |
49 /** Look up the intensity of the (one dimnensional) blurred half-plane. | 49 /** Look up the intensity of the (one dimnensional) blurred half-plane. |
50 @param profile The precomputed 1D blur profile; memory allocated by and
managed by | 50 @param profile The precomputed 1D blur profile; memory allocated by and
managed by |
51 ComputeBlurProfile below. | 51 ComputeBlurProfile below. |
52 @param loc the location to look up; The lookup will clamp invalid inputs
, but | 52 @param loc the location to look up; The lookup will clamp invalid inputs
, but |
53 meaningful data are available between 0 and blurred_width | 53 meaningful data are available between 0 and blurred_width |
54 @param blurred_width The width of the final, blurred rectangle | 54 @param blurred_width The width of the final, blurred rectangle |
55 @param sharp_width The width of the original, unblurred rectangle. | 55 @param sharp_width The width of the original, unblurred rectangle. |
56 */ | 56 */ |
57 static uint8_t ProfileLookup(const uint8_t* profile, int loc, int blurred_wi
dth, int sharp_width); | 57 static uint8_t ProfileLookup(const uint8_t* profile, int loc, int blurredWid
th, int sharpWidth); |
58 | 58 |
59 /** Allocate memory for and populate the profile of a 1D blurred halfplane.
The caller | 59 /** Allocate memory for and populate the profile of a 1D blurred halfplane.
The caller |
60 must free the memory. The amount of memory allocated will be exactly 6*
sigma bytes. | 60 must free the memory. The amount of memory allocated will be exactly 6*
sigma bytes. |
61 @param sigma The standard deviation of the gaussian blur kernel | 61 @param sigma The standard deviation of the gaussian blur kernel |
62 @param profile_out The location to store the allocated profile curve | |
63 */ | 62 */ |
64 | 63 |
65 static void ComputeBlurProfile(SkScalar sigma, uint8_t** profile_out); | 64 static uint8_t* ComputeBlurProfile(SkScalar sigma); |
66 | 65 |
67 /** Compute an entire scanline of a blurred step function. This is a 1D hel
per that | 66 /** Compute an entire scanline of a blurred step function. This is a 1D hel
per that |
68 will produce both the horizontal and vertical profiles of the blurry rec
tangle. | 67 will produce both the horizontal and vertical profiles of the blurry rec
tangle. |
69 @param pixels Location to store the resulting pixel data; allocated and
managed by caller | 68 @param pixels Location to store the resulting pixel data; allocated and
managed by caller |
70 @param profile Precomputed blur profile computed by ComputeBlurProfile a
bove. | 69 @param profile Precomputed blur profile computed by ComputeBlurProfile a
bove. |
71 @param width Size of the pixels array. | 70 @param width Size of the pixels array. |
72 @param sigma Standard deviation of the gaussian blur kernel used to comp
ute the profile; | 71 @param sigma Standard deviation of the gaussian blur kernel used to comp
ute the profile; |
73 this implicitly gives the size of the pixels array. | 72 this implicitly gives the size of the pixels array. |
74 */ | 73 */ |
75 | 74 |
76 static void ComputeBlurredScanline(uint8_t* pixels, const uint8_t* profile, | 75 static void ComputeBlurredScanline(uint8_t* pixels, const uint8_t* profile, |
77 unsigned int width, SkScalar sigma); | 76 unsigned int width, SkScalar sigma); |
78 | 77 |
79 | 78 |
80 | 79 |
81 }; | 80 }; |
82 | 81 |
83 #endif | 82 #endif |
OLD | NEW |