diff options
author | Robert Phillips <robertphillips@google.com> | 2018-01-16 08:06:32 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-01-16 13:28:43 +0000 |
commit | 0bd24dc41f2351d84f5fce32130668a5792d134b (patch) | |
tree | c46dc6fb7636fd7c2185e1f855f1dd582512fcc4 /src/image | |
parent | 3167aa0c9c84cab1b0252031166e4a345e2afe2d (diff) |
Funnel most proxy creation through GrProxyProvider
This is to provide a choke point for DDL to create Lazy Proxies.
Change-Id: If178da13bc6447b31b7601810236d34502d9efbd
Reviewed-on: https://skia-review.googlesource.com/93303
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/image')
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 30 | ||||
-rw-r--r-- | src/image/SkImage_Lazy.cpp | 2 |
2 files changed, 19 insertions, 13 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index e70ba05be5..20e8349aa2 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -19,6 +19,7 @@ #include "GrContextPriv.h" #include "GrGpu.h" #include "GrImageTextureMaker.h" +#include "GrProxyProvider.h" #include "GrRenderTargetContext.h" #include "GrResourceProvider.h" #include "GrSemaphore.h" @@ -291,10 +292,10 @@ static sk_sp<SkImage> new_wrapped_texture_common(GrContext* ctx, tex->setRelease(releaseProc, releaseCtx); } - const SkBudgeted budgeted = SkBudgeted::kNo; sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(tex), origin)); + return sk_make_sp<SkImage_Gpu>(ctx, kNeedNewImageUniqueID, - at, std::move(proxy), std::move(colorSpace), budgeted); + at, std::move(proxy), std::move(colorSpace), SkBudgeted::kNo); } sk_sp<SkImage> SkImage::MakeFromTexture(GrContext* ctx, @@ -394,20 +395,22 @@ static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac const SkISize yuvSizes[], GrSurfaceOrigin origin, sk_sp<SkColorSpace> imageColorSpace) { + GrProxyProvider* proxyProvider = ctx->contextPriv().proxyProvider(); + if (!are_yuv_sizes_valid(yuvSizes, nv12)) { return nullptr; } - sk_sp<GrTextureProxy> yProxy = GrSurfaceProxy::MakeWrappedBackend(ctx, yuvBackendTextures[0], - origin); - sk_sp<GrTextureProxy> uProxy = GrSurfaceProxy::MakeWrappedBackend(ctx, yuvBackendTextures[1], - origin); + sk_sp<GrTextureProxy> yProxy = proxyProvider->createWrappedTextureProxy(yuvBackendTextures[0], + origin); + sk_sp<GrTextureProxy> uProxy = proxyProvider->createWrappedTextureProxy(yuvBackendTextures[1], + origin); sk_sp<GrTextureProxy> vProxy; if (nv12) { vProxy = uProxy; } else { - vProxy = GrSurfaceProxy::MakeWrappedBackend(ctx, yuvBackendTextures[2], origin); + vProxy = proxyProvider->createWrappedTextureProxy(yuvBackendTextures[2], origin); } if (!yProxy || !uProxy || !vProxy) { return nullptr; @@ -605,15 +608,16 @@ sk_sp<SkImage> SkImage::MakeCrossContextFromPixmap(GrContext* context, const SkP return SkImage::MakeRasterCopy(pixmap); } + GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); // Turn the pixmap into a GrTextureProxy sk_sp<GrTextureProxy> proxy; if (buildMips) { SkBitmap bmp; bmp.installPixels(pixmap); - proxy = GrGenerateMipMapsAndUploadToTextureProxy(context, bmp, dstColorSpace); + proxy = GrGenerateMipMapsAndUploadToTextureProxy(proxyProvider, bmp, dstColorSpace); } else { - proxy = GrUploadPixmapToTextureProxy(context->contextPriv().proxyProvider(), - pixmap, SkBudgeted::kYes, dstColorSpace); + proxy = GrUploadPixmapToTextureProxy(proxyProvider, pixmap, SkBudgeted::kYes, + dstColorSpace); } if (!proxy) { @@ -1089,6 +1093,8 @@ sk_sp<SkImage> SkImage::MakeTextureFromMipMap(GrContext* ctx, const SkImageInfo& if (!ctx) { return nullptr; } + GrProxyProvider* proxyProvider = ctx->contextPriv().proxyProvider(); + // For images where the client is passing the mip data we require that all the mip levels have // valid data. for (int i = 0; i < mipLevelCount; ++i) { @@ -1096,8 +1102,8 @@ sk_sp<SkImage> SkImage::MakeTextureFromMipMap(GrContext* ctx, const SkImageInfo& return nullptr; } } - sk_sp<GrTextureProxy> proxy(GrUploadMipMapToTextureProxy(ctx, info, texels, mipLevelCount, - colorMode)); + sk_sp<GrTextureProxy> proxy(GrUploadMipMapToTextureProxy(proxyProvider, info, + texels, mipLevelCount, colorMode)); if (!proxy) { return nullptr; } diff --git a/src/image/SkImage_Lazy.cpp b/src/image/SkImage_Lazy.cpp index ae4dfd6c70..53ebc0ccff 100644 --- a/src/image/SkImage_Lazy.cpp +++ b/src/image/SkImage_Lazy.cpp @@ -829,7 +829,7 @@ sk_sp<GrTextureProxy> SkImage_Lazy::lockTextureProxy(GrContext* ctx, SkBitmap bitmap; if (!proxy && this->lockAsBitmap(&bitmap, chint, format, genPixelsInfo, behavior)) { if (willBeMipped) { - proxy = GrGenerateMipMapsAndUploadToTextureProxy(ctx, bitmap, dstColorSpace); + proxy = GrGenerateMipMapsAndUploadToTextureProxy(proxyProvider, bitmap, dstColorSpace); } if (!proxy) { proxy = GrUploadBitmapToTextureProxy(proxyProvider, bitmap, dstColorSpace); |