diff options
author | 2015-11-10 07:32:37 -0800 | |
---|---|---|
committer | 2015-11-10 07:32:37 -0800 | |
commit | 07d56b13927a4cb8dc4db16c8a573dee120937f1 (patch) | |
tree | 6d39a4f4d6aa29738f8cf923cffdeda4d3bb1c1e /src/effects/SkGpuBlurUtils.h | |
parent | 07e2692da3971960f8ae8adcd78ccb4bae7ab446 (diff) |
Make SkBlurImageFilter capable of cropping during blur (GPU path).
This is the GPU equivalent of https://codereview.chromium.org/1415653003/.
It requires passing down the bounds of the crop rect (srcBounds), and
turning the blur 3-patch optimization in convolve_gaussian() into a 5-patch:
clear above and below srcBounds, blur with bounds checks inside left and
right rects, blur without bounds checks in middle rect.
Note: this change causes minor pixels diffs in the
imagefilterscropexpand GM: for odd crop positions relative to the
dstBounds, we are now correctly resampling at an even pixel boundary.
BUG=skia:4502, skia:4526
Committed: https://skia.googlesource.com/skia/+/c57e0ded7d535523cfc6bf07c78e5f3479bb8c42
Review URL: https://codereview.chromium.org/1431593002
Diffstat (limited to 'src/effects/SkGpuBlurUtils.h')
-rw-r--r-- | src/effects/SkGpuBlurUtils.h | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/effects/SkGpuBlurUtils.h b/src/effects/SkGpuBlurUtils.h index 357a0d729c..84e3252cc2 100644 --- a/src/effects/SkGpuBlurUtils.h +++ b/src/effects/SkGpuBlurUtils.h @@ -26,9 +26,9 @@ namespace SkGpuBlurUtils { * @param srcTexture The source texture to be blurred. * @param canClobberSrc If true, srcTexture may be overwritten, and * may be returned as the result. - * @param rect The destination rectangle. - * @param cropToRect If true, do not sample any pixels outside the - * source rect. + * @param dstBounds The destination bounds, relative to the source texture. + * @param srcBounds The source bounds, relative to the source texture. If non-null, + * no pixels will be sampled outside of this rectangle. * @param sigmaX The blur's standard deviation in X. * @param sigmaY The blur's standard deviation in Y. * @return the blurred texture, which may be srcTexture reffed, or a @@ -37,8 +37,8 @@ namespace SkGpuBlurUtils { GrTexture* GaussianBlur(GrContext* context, GrTexture* srcTexture, bool canClobberSrc, - const SkRect& rect, - bool cropToRect, + const SkRect& dstBounds, + const SkRect* srcBounds, float sigmaX, float sigmaY, GrTextureProvider::SizeConstraint); |