diff options
author | Robert Phillips <robertphillips@google.com> | 2016-11-14 13:23:15 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-15 15:05:37 +0000 |
commit | fd01ce05ef7902c49b0272b3524a389693c72b35 (patch) | |
tree | e125464b9dff5c2b81e83c3b0ccde65606986b45 /src/gpu/GrBlurUtils.cpp | |
parent | af49b19582f1f7a55e1300647804212252315b8a (diff) |
Defer more renderTargetContexts in the GPU image filter paths
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4767
Change-Id: I4c1f27247ef340a49d1ac96761810e77e6047ca2
Reviewed-on: https://skia-review.googlesource.com/4767
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrBlurUtils.cpp')
-rw-r--r-- | src/gpu/GrBlurUtils.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp index 58d12af178..d31a7a7fba 100644 --- a/src/gpu/GrBlurUtils.cpp +++ b/src/gpu/GrBlurUtils.cpp @@ -13,6 +13,7 @@ #include "effects/GrSimpleTextureEffect.h" #include "GrStyle.h" #include "GrTexture.h" +#include "GrTextureProxy.h" #include "GrTextureProvider.h" #include "SkDraw.h" #include "SkGrPriv.h" @@ -92,25 +93,25 @@ static bool sw_draw_with_mask_filter(GrRenderTargetContext* renderTargetContext, } // Create a mask of 'devPath' and place the result in 'mask'. -static sk_sp<GrTexture> create_mask_GPU(GrContext* context, - const SkIRect& maskRect, - const SkPath& devPath, - SkStrokeRec::InitStyle fillOrHairline, - bool doAA, - int sampleCnt) { +static sk_sp<GrTextureProxy> create_mask_GPU(GrContext* context, + const SkIRect& maskRect, + const SkPath& devPath, + SkStrokeRec::InitStyle fillOrHairline, + bool doAA, + int sampleCnt) { if (!doAA) { // Don't need MSAA if mask isn't AA sampleCnt = 0; } - sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContextWithFallback( + sk_sp<GrRenderTargetContext> rtContext(context->makeDeferredRenderTargetContextWithFallback( SkBackingFit::kApprox, maskRect.width(), maskRect.height(), kAlpha_8_GrPixelConfig, nullptr, sampleCnt)); - if (!renderTargetContext) { + if (!rtContext) { return nullptr; } - renderTargetContext->clear(nullptr, 0x0, true); + rtContext->clear(nullptr, 0x0, true); GrPaint tempPaint; tempPaint.setAntiAlias(doAA); @@ -124,8 +125,8 @@ static sk_sp<GrTexture> create_mask_GPU(GrContext* context, // the origin using tempPaint. SkMatrix translate; translate.setTranslate(-SkIntToScalar(maskRect.fLeft), -SkIntToScalar(maskRect.fTop)); - renderTargetContext->drawPath(clip, tempPaint, translate, devPath, GrStyle(fillOrHairline)); - return renderTargetContext->asTexture();; + rtContext->drawPath(clip, tempPaint, translate, devPath, GrStyle(fillOrHairline)); + return sk_ref_sp(rtContext->asDeferredTexture()); } static void draw_path_with_mask_filter(GrContext* context, @@ -204,16 +205,17 @@ static void draw_path_with_mask_filter(GrContext* context, return; } - sk_sp<GrTexture> mask(create_mask_GPU(context, - finalIRect, - *path, - fillOrHairline, - paint->isAntiAlias(), - renderTargetContext->numColorSamples())); + sk_sp<GrTextureProxy> mask(create_mask_GPU(context, + finalIRect, + *path, + fillOrHairline, + paint->isAntiAlias(), + renderTargetContext->numColorSamples())); if (mask) { GrTexture* filtered; - if (maskFilter->filterMaskGPU(mask.get(), viewMatrix, finalIRect, &filtered)) { + if (maskFilter->filterMaskGPU(mask->instantiate(context->textureProvider()), + viewMatrix, finalIRect, &filtered)) { // filterMaskGPU gives us ownership of a ref to the result sk_sp<GrTexture> atu(filtered); if (draw_mask(renderTargetContext, clip, viewMatrix, finalIRect, paint, filtered)) { |