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 12 #include "GrRenderTargetContext.h" 13 14 class GrContext; 15 class GrTexture; 16 17 struct SkRect; 18 19 namespace SkGpuBlurUtils { 20 /** 21 * Applies a 2D Gaussian blur to a given texture. The blurred result is returned 22 * as a renderTargetContext 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 src The source to be blurred. 26 * @param colorSpace Color space of the source (used for the renderTargetContext result, 27 * too). 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. 31 * @param sigmaX The blur's standard deviation in X. 32 * @param sigmaY The blur's standard deviation in Y. 33 * @param fit backing fit for the returned render target context 34 * @return The renderTargetContext containing the blurred result. 35 */ 36 sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context, 37 sk_sp<GrTextureProxy> src, 38 sk_sp<SkColorSpace> colorSpace, 39 const SkIRect& dstBounds, 40 const SkIRect* srcBounds, 41 float sigmaX, 42 float sigmaY, 43 SkBackingFit fit = SkBackingFit::kApprox); 44 }; 45 46 #endif 47 #endif 48