robertphillips@google.com | 736dd03 | 2013-07-15 15:06:54 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkGpuBlurUtils_DEFINED |
| 9 | #define SkGpuBlurUtils_DEFINED |
| 10 | |
| 11 | #if SK_SUPPORT_GPU |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 12 | #include "GrRenderTargetContext.h" |
reed | c9b5f8b | 2015-10-22 13:20:20 -0700 | [diff] [blame] | 13 | |
robertphillips | f823778 | 2016-05-11 12:41:35 -0700 | [diff] [blame] | 14 | class GrContext; |
robertphillips | 04c84af | 2016-05-12 11:13:00 -0700 | [diff] [blame] | 15 | class GrTexture; |
robertphillips@google.com | 736dd03 | 2013-07-15 15:06:54 +0000 | [diff] [blame] | 16 | |
| 17 | struct SkRect; |
| 18 | |
| 19 | namespace SkGpuBlurUtils { |
robertphillips@google.com | 736dd03 | 2013-07-15 15:06:54 +0000 | [diff] [blame] | 20 | /** |
robertphillips | 04c84af | 2016-05-12 11:13:00 -0700 | [diff] [blame] | 21 | * Applies a 2D Gaussian blur to a given texture. The blurred result is returned |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 22 | * as a renderTargetContext in case the caller wishes to future draw into the result. |
robertphillips | 04c84af | 2016-05-12 11:13:00 -0700 | [diff] [blame] | 23 | * Note: one of sigmaX and sigmaY should be non-zero! |
robertphillips@google.com | 736dd03 | 2013-07-15 15:06:54 +0000 | [diff] [blame] | 24 | * @param context The GPU context |
Robert Phillips | 08c5ec7 | 2017-01-30 12:26:47 -0500 | [diff] [blame^] | 25 | * @param src The source to be blurred. |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 26 | * @param colorSpace Color space of the source (used for the renderTargetContext result, |
| 27 | * too). |
senorblanco | 07d56b1 | 2015-11-10 07:32:37 -0800 | [diff] [blame] | 28 | * @param dstBounds The destination bounds, relative to the source texture. |
| 29 | * @param srcBounds The source bounds, relative to the source texture. If non-null, |
| 30 | * no pixels will be sampled outside of this rectangle. |
robertphillips@google.com | 736dd03 | 2013-07-15 15:06:54 +0000 | [diff] [blame] | 31 | * @param sigmaX The blur's standard deviation in X. |
| 32 | * @param sigmaY The blur's standard deviation in Y. |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 33 | * @param fit backing fit for the returned render target context |
| 34 | * @return The renderTargetContext containing the blurred result. |
robertphillips@google.com | 736dd03 | 2013-07-15 15:06:54 +0000 | [diff] [blame] | 35 | */ |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 36 | sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context, |
Robert Phillips | 08c5ec7 | 2017-01-30 12:26:47 -0500 | [diff] [blame^] | 37 | sk_sp<GrTextureProxy> src, |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 38 | sk_sp<SkColorSpace> colorSpace, |
| 39 | const SkIRect& dstBounds, |
| 40 | const SkIRect* srcBounds, |
| 41 | float sigmaX, |
| 42 | float sigmaY, |
| 43 | SkBackingFit fit = SkBackingFit::kApprox); |
robertphillips@google.com | 736dd03 | 2013-07-15 15:06:54 +0000 | [diff] [blame] | 44 | }; |
| 45 | |
robertphillips@google.com | cce4102 | 2013-07-15 15:47:10 +0000 | [diff] [blame] | 46 | #endif |
robertphillips | 04c84af | 2016-05-12 11:13:00 -0700 | [diff] [blame] | 47 | #endif |