Fix up flags to SkGpuBlurUtils::GaussianBlur

This fixes a bug introduced in: https://codereview.chromium.org/1961953002/ (Reland of Simplify SkGpuBlurUtils::GaussianBlur method)

Although the 'canOverwriteSrc' flag is/was being used I still believe we're better off re-adding it after the mask-blur refactoring finishes.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2100873002

Review-Url: https://codereview.chromium.org/2100873002
This commit is contained in:
robertphillips 2016-06-27 11:11:05 -07:00 committed by Commit bot
parent db7979a24c
commit 8bad3acce5
4 changed files with 8 additions and 12 deletions

View File

@ -133,16 +133,14 @@ public:
/**
* This function is used to implement filters that require an explicit src mask. It should only
* be called if canFilterMaskGPU returned true and the maskRect param should be the output from
* that call. canOverwriteSrc indicates whether the implementation may treat src as a scratch
* texture and overwrite its contents. When true it is also legal to return src as the result.
* that call.
* Implementations are free to get the GrContext from the src texture in order to create
* additional textures and perform multiple passes.
*/
virtual bool filterMaskGPU(GrTexture* src,
const SkMatrix& ctm,
const SkIRect& maskRect,
GrTexture** result,
bool canOverwriteSrc) const;
GrTexture** result) const;
#endif
/**

View File

@ -337,8 +337,7 @@ bool SkMaskFilter::directFilterRRectMaskGPU(GrTextureProvider* texProvider,
bool SkMaskFilter::filterMaskGPU(GrTexture* src,
const SkMatrix& ctm,
const SkIRect& maskRect,
GrTexture** result,
bool canOverwriteSrc) const {
GrTexture** result) const {
return false;
}
#endif

View File

@ -67,8 +67,7 @@ public:
bool filterMaskGPU(GrTexture* src,
const SkMatrix& ctm,
const SkIRect& maskRect,
GrTexture** result,
bool canOverwriteSrc) const override;
GrTexture** result) const override;
#endif
void computeFastBounds(const SkRect&, SkRect*) const override;
@ -1235,8 +1234,7 @@ bool SkBlurMaskFilterImpl::canFilterMaskGPU(const SkRRect& devRRect,
bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
const SkMatrix& ctm,
const SkIRect& maskRect,
GrTexture** result,
bool canOverwriteSrc) const {
GrTexture** result) const {
// 'maskRect' isn't snapped to the UL corner but the mask in 'src' is.
const SkIRect clipRect = SkIRect::MakeWH(maskRect.width(), maskRect.height());
@ -1247,9 +1245,10 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
// If we're doing a normal blur, we can clobber the pathTexture in the
// gaussianBlur. Otherwise, we need to save it for later compositing.
static const bool kIsGammaCorrect = false;
bool isNormalBlur = (kNormal_SkBlurStyle == fBlurStyle);
sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur(context, src,
isNormalBlur && canOverwriteSrc,
kIsGammaCorrect,
clipRect, nullptr,
xformedSigma, xformedSigma));
if (!drawContext) {

View File

@ -220,7 +220,7 @@ static void draw_path_with_mask_filter(GrContext* context,
if (mask) {
GrTexture* filtered;
if (maskFilter->filterMaskGPU(mask.get(), viewMatrix, finalIRect, &filtered, true)) {
if (maskFilter->filterMaskGPU(mask.get(), viewMatrix, finalIRect, &filtered)) {
// filterMaskGPU gives us ownership of a ref to the result
SkAutoTUnref<GrTexture> atu(filtered);
if (draw_mask(drawContext, clip, viewMatrix, finalIRect, paint, filtered)) {