diff options
author | robertphillips <robertphillips@google.com> | 2016-04-27 10:47:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-27 10:47:51 -0700 |
commit | 6c7e325236b7fbb9c9b14ebb4715f88a59718695 (patch) | |
tree | 892db20f12b2f02968a3d67b54719aca3a84a8df /src/effects | |
parent | b4bb7d825566042ed64697be49457dbac060e6c4 (diff) |
Bring sk_sp to GrDrawContext
This is split out of: https://codereview.chromium.org/1914883002/ (Refactor drawContext/RenderTarget creation)
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1918003003
Review-Url: https://codereview.chromium.org/1918003003
Diffstat (limited to 'src/effects')
-rw-r--r-- | src/effects/SkAlphaThresholdFilter.cpp | 3 | ||||
-rw-r--r-- | src/effects/SkBlurMaskFilter.cpp | 3 | ||||
-rw-r--r-- | src/effects/SkDisplacementMapEffect.cpp | 2 | ||||
-rw-r--r-- | src/effects/SkGpuBlurUtils.cpp | 32 | ||||
-rw-r--r-- | src/effects/SkLightingImageFilter.cpp | 2 | ||||
-rw-r--r-- | src/effects/SkMorphologyImageFilter.cpp | 12 | ||||
-rw-r--r-- | src/effects/SkXfermodeImageFilter.cpp | 2 |
7 files changed, 29 insertions, 27 deletions
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp index bf2a3fda1c..bfbcfd21f8 100644 --- a/src/effects/SkAlphaThresholdFilter.cpp +++ b/src/effects/SkAlphaThresholdFilter.cpp @@ -111,7 +111,8 @@ sk_sp<GrTexture> SkAlphaThresholdFilterImpl::createMaskTexture(GrContext* contex return nullptr; } - sk_sp<GrDrawContext> drawContext(context->drawContext(maskTexture->asRenderTarget())); + sk_sp<GrDrawContext> drawContext( + context->drawContext(sk_ref_sp(maskTexture->asRenderTarget()))); if (!drawContext) { return nullptr; } diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index 2afb42f0fa..6eb8474a2e 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -1276,7 +1276,8 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src, paint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op); } - SkAutoTUnref<GrDrawContext> drawContext(context->drawContext((*result)->asRenderTarget())); + sk_sp<GrDrawContext> drawContext( + context->drawContext(sk_ref_sp((*result)->asRenderTarget()))); if (!drawContext) { return false; } diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp index a8f0b81d73..797bd972dd 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -346,7 +346,7 @@ sk_sp<SkSpecialImage> SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou SkMatrix matrix; matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colorBounds.y())); - SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(dst->asRenderTarget())); + sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(dst->asRenderTarget()))); if (!drawContext) { return nullptr; } diff --git a/src/effects/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp index 0ecc5010c3..c3681faca5 100644 --- a/src/effects/SkGpuBlurUtils.cpp +++ b/src/effects/SkGpuBlurUtils.cpp @@ -228,7 +228,7 @@ GrTexture* GaussianBlur(GrContext* context, return nullptr; } - SkAutoTUnref<GrDrawContext> srcDrawContext; + sk_sp<GrDrawContext> srcDrawContext; for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) { GrPaint paint; @@ -258,8 +258,8 @@ GrTexture* GaussianBlur(GrContext* context, scale_rect(&dstRect, i < scaleFactorX ? 0.5f : 1.0f, i < scaleFactorY ? 0.5f : 1.0f); - SkAutoTUnref<GrDrawContext> dstDrawContext( - context->drawContext(dstTexture->asRenderTarget())); + sk_sp<GrDrawContext> dstDrawContext( + context->drawContext(sk_ref_sp(dstTexture->asRenderTarget()))); if (!dstDrawContext) { return nullptr; } @@ -283,12 +283,12 @@ GrTexture* GaussianBlur(GrContext* context, // We shouldn't be scaling because this is a small size blur SkASSERT((1 == scaleFactorX) && (1 == scaleFactorY)); - SkAutoTUnref<GrDrawContext> dstDrawContext( - context->drawContext(dstTexture->asRenderTarget(), &props)); + sk_sp<GrDrawContext> dstDrawContext( + context->drawContext(sk_ref_sp(dstTexture->asRenderTarget()), &props)); if (!dstDrawContext) { return nullptr; } - convolve_gaussian_2d(dstDrawContext, clip, srcRect, srcOffset, + convolve_gaussian_2d(dstDrawContext.get(), clip, srcRect, srcOffset, srcTexture, radiusX, radiusY, sigmaX, sigmaY, srcBounds); srcDrawContext.swap(dstDrawContext); @@ -304,7 +304,7 @@ GrTexture* GaussianBlur(GrContext* context, if (scaleFactorX > 1) { // TODO: if we pass in the source draw context we don't need this here if (!srcDrawContext) { - srcDrawContext.reset(context->drawContext(srcTexture->asRenderTarget())); + srcDrawContext = context->drawContext(sk_ref_sp(srcTexture->asRenderTarget())); if (!srcDrawContext) { return nullptr; } @@ -317,12 +317,12 @@ GrTexture* GaussianBlur(GrContext* context, srcDrawContext->clear(&clearRect, 0x0, false); } - SkAutoTUnref<GrDrawContext> dstDrawContext( - context->drawContext(dstTexture->asRenderTarget(), &props)); + sk_sp<GrDrawContext> dstDrawContext( + context->drawContext(sk_ref_sp(dstTexture->asRenderTarget()), &props)); if (!dstDrawContext) { return nullptr; } - convolve_gaussian(dstDrawContext, clip, srcRect, + convolve_gaussian(dstDrawContext.get(), clip, srcRect, srcTexture, Gr1DKernelEffect::kX_Direction, radiusX, sigmaX, srcBounds, srcOffset); srcDrawContext.swap(dstDrawContext); @@ -337,7 +337,7 @@ GrTexture* GaussianBlur(GrContext* context, if (scaleFactorY > 1 || sigmaX > 0.0f) { // TODO: if we pass in the source draw context we don't need this here if (!srcDrawContext) { - srcDrawContext.reset(context->drawContext(srcTexture->asRenderTarget())); + srcDrawContext = context->drawContext(sk_ref_sp(srcTexture->asRenderTarget())); if (!srcDrawContext) { return nullptr; } @@ -350,12 +350,12 @@ GrTexture* GaussianBlur(GrContext* context, srcDrawContext->clear(&clearRect, 0x0, false); } - SkAutoTUnref<GrDrawContext> dstDrawContext( - context->drawContext(dstTexture->asRenderTarget(), &props)); + sk_sp<GrDrawContext> dstDrawContext( + context->drawContext(sk_ref_sp(dstTexture->asRenderTarget()), &props)); if (!dstDrawContext) { return nullptr; } - convolve_gaussian(dstDrawContext, clip, srcRect, + convolve_gaussian(dstDrawContext.get(), clip, srcRect, srcTexture, Gr1DKernelEffect::kY_Direction, radiusY, sigmaY, srcBounds, srcOffset); @@ -391,8 +391,8 @@ GrTexture* GaussianBlur(GrContext* context, SkRect dstRect(srcRect); scale_rect(&dstRect, (float) scaleFactorX, (float) scaleFactorY); - SkAutoTUnref<GrDrawContext> dstDrawContext( - context->drawContext(dstTexture->asRenderTarget())); + sk_sp<GrDrawContext> dstDrawContext( + context->drawContext(sk_ref_sp(dstTexture->asRenderTarget()))); if (!dstDrawContext) { return nullptr; } diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index 4252831c1b..7223ae5a1e 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -418,7 +418,7 @@ sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(SkSpecialIma return nullptr; } - sk_sp<GrDrawContext> drawContext(context->drawContext(dst->asRenderTarget())); + sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(dst->asRenderTarget()))); if (!drawContext) { return nullptr; } diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 810d0e13e4..9e87fe04a4 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -496,13 +496,13 @@ static sk_sp<SkSpecialImage> apply_morphology(GrContext* context, if (!scratch) { return nullptr; } - SkAutoTUnref<GrDrawContext> dstDrawContext( - context->drawContext(scratch->asRenderTarget())); + sk_sp<GrDrawContext> dstDrawContext( + context->drawContext(sk_ref_sp(scratch->asRenderTarget()))); if (!dstDrawContext) { return nullptr; } - apply_morphology_pass(dstDrawContext, clip, srcTexture.get(), + apply_morphology_pass(dstDrawContext.get(), clip, srcTexture.get(), srcRect, dstRect, radius.fWidth, morphType, Gr1DKernelEffect::kX_Direction); SkIRect clearRect = SkIRect::MakeXYWH(dstRect.fLeft, dstRect.fBottom, @@ -520,13 +520,13 @@ static sk_sp<SkSpecialImage> apply_morphology(GrContext* context, if (!scratch) { return nullptr; } - SkAutoTUnref<GrDrawContext> dstDrawContext( - context->drawContext(scratch->asRenderTarget())); + sk_sp<GrDrawContext> dstDrawContext( + context->drawContext(sk_ref_sp(scratch->asRenderTarget()))); if (!dstDrawContext) { return nullptr; } - apply_morphology_pass(dstDrawContext, clip, srcTexture.get(), + apply_morphology_pass(dstDrawContext.get(), clip, srcTexture.get(), srcRect, dstRect, radius.fHeight, morphType, Gr1DKernelEffect::kY_Direction); diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp index f4e896ece6..b1ac1c32e0 100644 --- a/src/effects/SkXfermodeImageFilter.cpp +++ b/src/effects/SkXfermodeImageFilter.cpp @@ -248,7 +248,7 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter::filterImageGPU(SkSpecialImage* sour paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); - SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(dst->asRenderTarget())); + sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(dst->asRenderTarget()))); if (!drawContext) { return nullptr; } |