diff options
author | Robert Phillips <robertphillips@google.com> | 2017-01-19 16:59:04 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-20 15:10:18 +0000 |
commit | c949ce9d808dbf7c2db7dc0b85271969ba46b69a (patch) | |
tree | 14cce659a0861b970f99d80dbfb69a52975498a3 /src/gpu/GrBlurUtils.cpp | |
parent | 4c76c41c981dd7ea95062a1895a6e3415b70bce1 (diff) |
Replace some GrSurface:read/writePixels with the GrSurfaceContext equivalent
Change-Id: I7b11a323b0c74ee70f52b1bd8be376fb7188cb19
Reviewed-on: https://skia-review.googlesource.com/7204
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/GrBlurUtils.cpp')
-rw-r--r-- | src/gpu/GrBlurUtils.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp index 23a3c6ce0b..66abadbf98 100644 --- a/src/gpu/GrBlurUtils.cpp +++ b/src/gpu/GrBlurUtils.cpp @@ -9,6 +9,7 @@ #include "GrRenderTargetContext.h" #include "GrCaps.h" #include "GrContext.h" +#include "GrContextPriv.h" #include "GrFixedClip.h" #include "GrRenderTargetContextPriv.h" #include "effects/GrSimpleTextureEffect.h" @@ -91,25 +92,21 @@ static bool sw_draw_with_mask_filter(GrContext* context, desc.fHeight = dstM.fBounds.height(); desc.fConfig = kAlpha_8_GrPixelConfig; - sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeDeferred(*context->caps(), desc, - SkBackingFit::kApprox, - SkBudgeted::kYes)); - if (!proxy || !proxy->asTextureProxy()) { + sk_sp<GrSurfaceContext> sContext = context->contextPriv().makeDeferredSurfaceContext( + desc, + SkBackingFit::kApprox, + SkBudgeted::kYes); + if (!sContext) { return false; } - // This is a bit goofy but, until writePixels is moved to GrSurfaceContext, we're stuck - // instantiating here to do the writePixels - GrTexture* texture = proxy->asTextureProxy()->instantiate(context->textureProvider()); - if (!texture) { + SkImageInfo ii = SkImageInfo::MakeA8(desc.fWidth, desc.fHeight); + if (!sContext->writePixels(ii, dstM.fImage, dstM.fRowBytes, 0, 0)) { return false; } - texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig, - dstM.fImage, dstM.fRowBytes); - return draw_mask(renderTargetContext, context->textureProvider(), clipData, viewMatrix, - dstM.fBounds, std::move(paint), sk_ref_sp(proxy->asTextureProxy())); + dstM.fBounds, std::move(paint), sk_ref_sp(sContext->asDeferredTexture())); } // Create a mask of 'devPath' and place the result in 'mask'. |