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 |
11 #include "SkBlurTypes.h" | 11 #include "SkBlurTypes.h" |
12 #include "SkShader.h" | 12 #include "SkShader.h" |
13 #include "SkMask.h" | 13 #include "SkMask.h" |
14 #include "SkRRect.h" | 14 #include "SkRRect.h" |
15 | 15 |
16 class SkBlurMask { | 16 class SkBlurMask { |
17 public: | 17 public: |
18 static bool BlurRect(SkScalar sigma, SkMask *dst, const SkRect &src, SkBlurS
tyle, | 18 static bool BlurRect(SkScalar sigma, SkMask *dst, const SkRect &src, SkBlurS
tyle, |
19 SkIPoint *margin = NULL, | 19 SkIPoint *margin = NULL, |
20 SkMask::CreateMode createMode = | 20 SkMask::CreateMode createMode = |
21 SkMask::kComputeBoundsAndRenderI
mage_CreateMode); | 21 SkMask::kComputeBoundsAndRenderI
mage_CreateMode); |
22 static bool BlurRRect(SkScalar sigma, SkMask *dst, const SkRRect &src, SkBlu
rStyle, | 22 static bool BlurRRect(SkScalar sigma, SkMask *dst, const SkRRect &src, SkBlu
rStyle, |
23 SkIPoint *margin = NULL, | 23 SkIPoint *margin = NULL, |
24 SkMask::CreateMode createMode = | 24 SkMask::CreateMode createMode = |
25 SkMask::kComputeBoundsAndRenderI
mage_CreateMode); | 25 SkMask::kComputeBoundsAndRenderI
mage_CreateMode); |
| 26 |
| 27 // forceQuality will prevent BoxBlur from falling back to the low quality ap
proach when sigma |
| 28 // is very small -- this can be used predict the margin bump ahead of time w
ithout completely |
| 29 // replicating the internal logic. This permits not only simpler caching of
blurred results, |
| 30 // but also being able to predict precisely at what pixels the blurred profi
le of e.g. a |
| 31 // rectangle will lie. |
| 32 |
26 static bool BoxBlur(SkMask* dst, const SkMask& src, | 33 static bool BoxBlur(SkMask* dst, const SkMask& src, |
27 SkScalar sigma, SkBlurStyle style, SkBlurQuality quality
, | 34 SkScalar sigma, SkBlurStyle style, SkBlurQuality quality
, |
28 SkIPoint* margin = NULL); | 35 SkIPoint* margin = NULL, bool force_quality=false); |
29 | 36 |
30 // the "ground truth" blur does a gaussian convolution; it's slow | 37 // the "ground truth" blur does a gaussian convolution; it's slow |
31 // but useful for comparison purposes. | 38 // but useful for comparison purposes. |
32 static bool BlurGroundTruth(SkScalar sigma, SkMask* dst, const SkMask& src,
SkBlurStyle, | 39 static bool BlurGroundTruth(SkScalar sigma, SkMask* dst, const SkMask& src,
SkBlurStyle, |
33 SkIPoint* margin = NULL); | 40 SkIPoint* margin = NULL); |
34 | 41 |
35 static SkScalar ConvertRadiusToSigma(SkScalar radius); | 42 static SkScalar ConvertRadiusToSigma(SkScalar radius); |
36 | 43 |
37 /* Helper functions for analytic rectangle blurs */ | 44 /* Helper functions for analytic rectangle blurs */ |
38 | 45 |
(...skipping 25 matching lines...) Expand all Loading... |
64 */ | 71 */ |
65 | 72 |
66 static void ComputeBlurredScanline(uint8_t* pixels, const uint8_t* profile, | 73 static void ComputeBlurredScanline(uint8_t* pixels, const uint8_t* profile, |
67 unsigned int width, SkScalar sigma); | 74 unsigned int width, SkScalar sigma); |
68 | 75 |
69 | 76 |
70 | 77 |
71 }; | 78 }; |
72 | 79 |
73 #endif | 80 #endif |
OLD | NEW |