diff options
author | 2017-01-23 15:30:35 -0500 | |
---|---|---|
committer | 2017-01-24 12:23:28 +0000 | |
commit | bc7a4fb06780f9829b4b21470fe6f0503d2297cd (patch) | |
tree | d8a2460df05c73909530a3316cdc8b6192d5c55e /src/image | |
parent | ad24145e41b473012a900818933291541e80815c (diff) |
Make GrYUVEffect take GrTextureProxies
This opens the door for swapping all the effects over to taking GrTextureProxies.
Change-Id: I3b03ba93a68f9945c9a8fee008fd170ed57616eb
Reviewed-on: https://skia-review.googlesource.com/7344
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/image')
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index fb93350039..a1ecf5bdad 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -18,6 +18,7 @@ #include "GrRenderTargetContext.h" #include "GrTextureAdjuster.h" #include "GrTexturePriv.h" +#include "GrTextureProxy.h" #include "effects/GrYUVEffect.h" #include "SkCanvas.h" #include "SkBitmapCache.h" @@ -272,11 +273,16 @@ static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac sk_sp<GrTexture> yTex( ctx->textureProvider()->wrapBackendTexture(yDesc, kBorrow_GrWrapOwnership)); + sk_sp<GrSurfaceProxy> yProxy = GrSurfaceProxy::MakeWrapped(std::move(yTex)); + sk_sp<GrTexture> uTex( ctx->textureProvider()->wrapBackendTexture(uDesc, kBorrow_GrWrapOwnership)); - sk_sp<GrTexture> vTex; + sk_sp<GrSurfaceProxy> uProxy = GrSurfaceProxy::MakeWrapped(std::move(uTex)); + + sk_sp<GrSurfaceProxy> vProxy; + if (nv12) { - vTex = uTex; + vProxy = uProxy; } else { GrBackendTextureDesc vDesc; vDesc.fConfig = kConfig; @@ -286,10 +292,11 @@ static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac vDesc.fWidth = yuvSizes[2].fWidth; vDesc.fHeight = yuvSizes[2].fHeight; - vTex = sk_sp<GrTexture>( + sk_sp<GrTexture> vTex = sk_sp<GrTexture>( ctx->textureProvider()->wrapBackendTexture(vDesc, kBorrow_GrWrapOwnership)); + vProxy = GrSurfaceProxy::MakeWrapped(std::move(vTex)); } - if (!yTex || !uTex || !vTex) { + if (!yProxy || !uProxy || !vProxy) { return nullptr; } @@ -311,7 +318,10 @@ static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac GrPaint paint; paint.setPorterDuffXPFactory(SkBlendMode::kSrc); paint.addColorFragmentProcessor( - GrYUVEffect::MakeYUVToRGB(yTex.get(), uTex.get(), vTex.get(), yuvSizes, colorSpace, nv12)); + GrYUVEffect::MakeYUVToRGB(ctx, + sk_ref_sp(yProxy->asTextureProxy()), + sk_ref_sp(uProxy->asTextureProxy()), + sk_ref_sp(vProxy->asTextureProxy()), yuvSizes, colorSpace, nv12)); const SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height)); |