OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
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 SkGpuBlurUtils_DEFINED | 8 #ifndef SkGpuBlurUtils_DEFINED |
9 #define SkGpuBlurUtils_DEFINED | 9 #define SkGpuBlurUtils_DEFINED |
10 | 10 |
11 #if SK_SUPPORT_GPU | 11 #if SK_SUPPORT_GPU |
12 #include "GrDrawContext.h" | 12 #include "GrTextureProvider.h" |
13 | 13 |
| 14 class GrTexture; |
14 class GrContext; | 15 class GrContext; |
15 class GrTexture; | 16 #endif |
16 | 17 |
17 struct SkRect; | 18 struct SkRect; |
18 | 19 |
19 namespace SkGpuBlurUtils { | 20 namespace SkGpuBlurUtils { |
| 21 |
| 22 #if SK_SUPPORT_GPU |
20 /** | 23 /** |
21 * Applies a 2D Gaussian blur to a given texture. The blurred result is retur
ned | 24 * Applies a 2D Gaussian blur to a given texture. |
22 * as a drawContext in case the caller wishes to future draw into the result. | |
23 * Note: one of sigmaX and sigmaY should be non-zero! | |
24 * @param context The GPU context | 25 * @param context The GPU context |
25 * @param srcTexture The source texture to be blurred. | 26 * @param srcTexture The source texture to be blurred. |
26 * @param gammaCorrect Should blur be gamma-correct (sRGB to linear, etc..
.) | 27 * @param gammaCorrect Should blur be gamma-correct (sRGB to linear, etc..
.) |
27 * @param dstBounds The destination bounds, relative to the source text
ure. | 28 * @param dstBounds The destination bounds, relative to the source text
ure. |
28 * @param srcBounds The source bounds, relative to the source texture.
If non-null, | 29 * @param srcBounds The source bounds, relative to the source texture.
If non-null, |
29 * no pixels will be sampled outside of this rectangle
. | 30 * no pixels will be sampled outside of this rectangle
. |
30 * @param sigmaX The blur's standard deviation in X. | 31 * @param sigmaX The blur's standard deviation in X. |
31 * @param sigmaY The blur's standard deviation in Y. | 32 * @param sigmaY The blur's standard deviation in Y. |
32 * @return The drawContext containing the blurred result. | 33 * @return the blurred texture, which may be srcTexture reffed, or a |
| 34 * new texture. It is the caller's responsibility to unref this texture. |
33 */ | 35 */ |
34 sk_sp<GrDrawContext> GaussianBlur(GrContext* context, | 36 GrTexture* GaussianBlur(GrContext* context, |
35 GrTexture* srcTexture, | 37 GrTexture* srcTexture, |
36 bool gammaCorrect, | 38 bool gammaCorrect, |
37 const SkRect& dstBounds, | 39 const SkRect& dstBounds, |
38 const SkRect* srcBounds, | 40 const SkRect* srcBounds, |
39 float sigmaX, | 41 float sigmaX, |
40 float sigmaY); | 42 float sigmaY); |
| 43 #endif |
41 | 44 |
42 }; | 45 }; |
43 | 46 |
44 #endif | 47 #endif |
45 #endif | |
OLD | NEW |