diff options
author | Brian Salomon <bsalomon@google.com> | 2018-03-07 14:39:54 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-07 20:00:20 +0000 |
commit | 7578f3ecddf62853005782ea7414466d6a62db21 (patch) | |
tree | 87fca02e056baeaf7dd6a41d7328264cd0662a39 | |
parent | af4adefd8ccb46c148f7a16b54afc226b86c0fcc (diff) |
Rename wrap backend tex/rt methods on GrProxyProvider
This makes them more consistent with similar methods on GrResourceProvider.
Change-Id: Ice7e5dbe8100481781015b386445e9b7101bd75e
Reviewed-on: https://skia-review.googlesource.com/112821
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
-rw-r--r-- | src/gpu/GrContext.cpp | 13 | ||||
-rw-r--r-- | src/gpu/GrProxyProvider.cpp | 27 | ||||
-rw-r--r-- | src/gpu/GrProxyProvider.h | 24 | ||||
-rw-r--r-- | src/image/SkImage_Gpu.cpp | 12 | ||||
-rw-r--r-- | tests/GrPorterDuffTest.cpp | 4 | ||||
-rw-r--r-- | tests/ProxyConversionTest.cpp | 2 | ||||
-rw-r--r-- | tests/ProxyTest.cpp | 28 | ||||
-rw-r--r-- | tests/RectangleTextureTest.cpp | 3 | ||||
-rw-r--r-- | tests/ResourceAllocatorTest.cpp | 2 | ||||
-rw-r--r-- | tests/TextureProxyTest.cpp | 2 |
10 files changed, 51 insertions, 66 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 16dfab35cd..611fe16377 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -1241,7 +1241,7 @@ sk_sp<GrTextureContext> GrContextPriv::makeBackendTextureContext(const GrBackend sk_sp<SkColorSpace> colorSpace) { ASSERT_SINGLE_OWNER_PRIV - sk_sp<GrSurfaceProxy> proxy = this->proxyProvider()->createWrappedTextureProxy(tex, origin); + sk_sp<GrSurfaceProxy> proxy = this->proxyProvider()->wrapBackendTexture(tex, origin); if (!proxy) { return nullptr; } @@ -1258,8 +1258,8 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContex ASSERT_SINGLE_OWNER_PRIV SkASSERT(sampleCnt > 0); - sk_sp<GrTextureProxy> proxy(this->proxyProvider()->createWrappedTextureProxy(tex, origin, - sampleCnt)); + sk_sp<GrTextureProxy> proxy( + this->proxyProvider()->wrapRenderableBackendTexture(tex, origin, sampleCnt)); if (!proxy) { return nullptr; } @@ -1275,8 +1275,7 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendRenderTargetRenderTargetC const SkSurfaceProps* surfaceProps) { ASSERT_SINGLE_OWNER_PRIV - sk_sp<GrSurfaceProxy> proxy = this->proxyProvider()->createWrappedRenderTargetProxy(backendRT, - origin); + sk_sp<GrSurfaceProxy> proxy = this->proxyProvider()->wrapBackendRenderTarget(backendRT, origin); if (!proxy) { return nullptr; } @@ -1294,8 +1293,8 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureAsRenderTargetRend const SkSurfaceProps* props) { ASSERT_SINGLE_OWNER_PRIV SkASSERT(sampleCnt > 0); - sk_sp<GrSurfaceProxy> proxy(this->proxyProvider()->createWrappedRenderTargetProxy(tex, origin, - sampleCnt)); + sk_sp<GrSurfaceProxy> proxy( + this->proxyProvider()->wrapBackendTextureAsRenderTarget(tex, origin, sampleCnt)); if (!proxy) { return nullptr; } diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp index 536cd137bd..5091228a60 100644 --- a/src/gpu/GrProxyProvider.cpp +++ b/src/gpu/GrProxyProvider.cpp @@ -399,12 +399,11 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrSurfaceDesc& desc, new GrTextureProxy(copyDesc, origin, mipMapped, fit, budgeted, flags)); } -sk_sp<GrTextureProxy> GrProxyProvider::createWrappedTextureProxy( - const GrBackendTexture& backendTex, - GrSurfaceOrigin origin, - GrWrapOwnership ownership, - ReleaseProc releaseProc, - ReleaseContext releaseCtx) { +sk_sp<GrTextureProxy> GrProxyProvider::wrapBackendTexture(const GrBackendTexture& backendTex, + GrSurfaceOrigin origin, + GrWrapOwnership ownership, + ReleaseProc releaseProc, + ReleaseContext releaseCtx) { if (this->isAbandoned()) { return nullptr; } @@ -456,9 +455,8 @@ sk_sp<GrTextureProxy> GrProxyProvider::createWrappedTextureProxy( return proxy; } -sk_sp<GrTextureProxy> GrProxyProvider::createWrappedTextureProxy(const GrBackendTexture& backendTex, - GrSurfaceOrigin origin, - int sampleCnt) { +sk_sp<GrTextureProxy> GrProxyProvider::wrapRenderableBackendTexture( + const GrBackendTexture& backendTex, GrSurfaceOrigin origin, int sampleCnt) { if (this->isAbandoned()) { return nullptr; } @@ -513,9 +511,8 @@ sk_sp<GrTextureProxy> GrProxyProvider::createWrappedTextureProxy(const GrBackend return proxy; } -sk_sp<GrSurfaceProxy> GrProxyProvider::createWrappedRenderTargetProxy( - const GrBackendRenderTarget& backendRT, - GrSurfaceOrigin origin) { +sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendRenderTarget( + const GrBackendRenderTarget& backendRT, GrSurfaceOrigin origin) { if (this->isAbandoned()) { return nullptr; } @@ -565,10 +562,8 @@ sk_sp<GrSurfaceProxy> GrProxyProvider::createWrappedRenderTargetProxy( return proxy; } -sk_sp<GrSurfaceProxy> GrProxyProvider::createWrappedRenderTargetProxy( - const GrBackendTexture& backendTex, - GrSurfaceOrigin origin, - int sampleCnt) { +sk_sp<GrSurfaceProxy> GrProxyProvider::wrapBackendTextureAsRenderTarget( + const GrBackendTexture& backendTex, GrSurfaceOrigin origin, int sampleCnt) { if (this->isAbandoned()) { return nullptr; } diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h index 12ff10c005..0500e2f17c 100644 --- a/src/gpu/GrProxyProvider.h +++ b/src/gpu/GrProxyProvider.h @@ -120,30 +120,28 @@ public: /* * Create a texture proxy that wraps a (non-renderable) backend texture. */ - sk_sp<GrTextureProxy> createWrappedTextureProxy(const GrBackendTexture&, GrSurfaceOrigin, - GrWrapOwnership = kBorrow_GrWrapOwnership, - ReleaseProc = nullptr, - ReleaseContext = nullptr); + sk_sp<GrTextureProxy> wrapBackendTexture(const GrBackendTexture&, GrSurfaceOrigin, + GrWrapOwnership = kBorrow_GrWrapOwnership, + ReleaseProc = nullptr, ReleaseContext = nullptr); /* * Create a texture proxy that wraps a backend texture and is both texture-able and renderable */ - sk_sp<GrTextureProxy> createWrappedTextureProxy(const GrBackendTexture&, - GrSurfaceOrigin, - int sampleCnt); + sk_sp<GrTextureProxy> wrapRenderableBackendTexture(const GrBackendTexture&, + GrSurfaceOrigin, + int sampleCnt); /* * Create a render target proxy that wraps a backend rendertarget */ - sk_sp<GrSurfaceProxy> createWrappedRenderTargetProxy(const GrBackendRenderTarget&, - GrSurfaceOrigin); + sk_sp<GrSurfaceProxy> wrapBackendRenderTarget(const GrBackendRenderTarget&, GrSurfaceOrigin); /* - * Create a render target proxy that wraps a backend texture? + * Create a render target proxy that wraps a backend texture */ - sk_sp<GrSurfaceProxy> createWrappedRenderTargetProxy(const GrBackendTexture& tex, - GrSurfaceOrigin origin, - int sampleCnt); + sk_sp<GrSurfaceProxy> wrapBackendTextureAsRenderTarget(const GrBackendTexture& tex, + GrSurfaceOrigin origin, + int sampleCnt); using LazyInstantiateCallback = std::function<sk_sp<GrSurface>(GrResourceProvider*)>; enum class Textureable : bool { diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp index 86f89db813..6ed3e15bb2 100644 --- a/src/image/SkImage_Gpu.cpp +++ b/src/image/SkImage_Gpu.cpp @@ -305,8 +305,8 @@ static sk_sp<SkImage> new_wrapped_texture_common(GrContext* ctx, } GrProxyProvider* proxyProvider = ctx->contextPriv().proxyProvider(); - sk_sp<GrTextureProxy> proxy = proxyProvider->createWrappedTextureProxy( - backendTex, origin, ownership, releaseProc, releaseCtx); + sk_sp<GrTextureProxy> proxy = proxyProvider->wrapBackendTexture(backendTex, origin, ownership, + releaseProc, releaseCtx); if (!proxy) { return nullptr; } @@ -422,16 +422,14 @@ static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac return nullptr; } - sk_sp<GrTextureProxy> yProxy = proxyProvider->createWrappedTextureProxy(yuvBackendTextures[0], - origin); - sk_sp<GrTextureProxy> uProxy = proxyProvider->createWrappedTextureProxy(yuvBackendTextures[1], - origin); + sk_sp<GrTextureProxy> yProxy = proxyProvider->wrapBackendTexture(yuvBackendTextures[0], origin); + sk_sp<GrTextureProxy> uProxy = proxyProvider->wrapBackendTexture(yuvBackendTextures[1], origin); sk_sp<GrTextureProxy> vProxy; if (nv12) { vProxy = uProxy; } else { - vProxy = proxyProvider->createWrappedTextureProxy(yuvBackendTextures[2], origin); + vProxy = proxyProvider->wrapBackendTexture(yuvBackendTextures[2], origin); } if (!yProxy || !uProxy || !vProxy) { return nullptr; diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp index 7e938c7761..f0c157f149 100644 --- a/tests/GrPorterDuffTest.cpp +++ b/tests/GrPorterDuffTest.cpp @@ -1075,8 +1075,8 @@ DEF_GPUTEST(PorterDuffNoDualSourceBlending, reporter, options) { GrXferProcessor::DstProxy fakeDstProxy; { - sk_sp<GrTextureProxy> proxy = proxyProvider->createWrappedTextureProxy( - backendTex, kTopLeft_GrSurfaceOrigin); + sk_sp<GrTextureProxy> proxy = + proxyProvider->wrapBackendTexture(backendTex, kTopLeft_GrSurfaceOrigin); fakeDstProxy.setProxy(std::move(proxy)); } diff --git a/tests/ProxyConversionTest.cpp b/tests/ProxyConversionTest.cpp index a4c4a60449..3ebfbf4778 100644 --- a/tests/ProxyConversionTest.cpp +++ b/tests/ProxyConversionTest.cpp @@ -28,7 +28,7 @@ static sk_sp<GrSurfaceProxy> make_wrapped_FBO0(GrProxyProvider* provider, GrBackendRenderTarget backendRT(desc.fWidth, desc.fHeight, desc.fSampleCnt, 8, desc.fConfig, fboInfo); - return provider->createWrappedRenderTargetProxy(backendRT, origin); + return provider->wrapBackendRenderTarget(backendRT, origin); } static sk_sp<GrSurfaceProxy> make_wrapped_offscreen_rt(GrProxyProvider* provider, diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp index f346f876bd..9d52281763 100644 --- a/tests/ProxyTest.cpp +++ b/tests/ProxyTest.cpp @@ -207,15 +207,15 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { } // External on-screen render target. - // Tests createWrappedRenderTargetProxy with a GrBackendRenderTarget + // Tests wrapBackendRenderTarget with a GrBackendRenderTarget { GrGLFramebufferInfo fboInfo; fboInfo.fFBOID = 0; GrBackendRenderTarget backendRT(kWidthHeight, kWidthHeight, numSamples, 8, config, fboInfo); - sk_sp<GrSurfaceProxy> sProxy(proxyProvider->createWrappedRenderTargetProxy( - backendRT, origin)); + sk_sp<GrSurfaceProxy> sProxy( + proxyProvider->wrapBackendRenderTarget(backendRT, origin)); check_surface(reporter, sProxy.get(), origin, kWidthHeight, kWidthHeight, backendRT.testingOnly_getPixelConfig(), SkBudgeted::kNo); @@ -224,15 +224,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { supportedNumSamples, SkBackingFit::kExact, 0); } - // Tests createWrappedRenderTargetProxy with a GrBackendTexture + // Tests wrapBackendRenderTarget with a GrBackendTexture { GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(nullptr, kWidthHeight, kWidthHeight, colorType, true, GrMipMapped::kNo); - sk_sp<GrSurfaceProxy> sProxy = - proxyProvider->createWrappedRenderTargetProxy(backendTex, origin, - supportedNumSamples); + sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTextureAsRenderTarget( + backendTex, origin, supportedNumSamples); if (!sProxy) { gpu->deleteTestingOnlyBackendTexture(&backendTex); continue; // This can fail on Mesa @@ -249,16 +248,15 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { gpu->deleteTestingOnlyBackendTexture(&backendTex); } - // Tests createWrappedTextureProxy that is only renderable + // Tests wrapBackendTexture that is only renderable { GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(nullptr, kWidthHeight, kWidthHeight, colorType, true, GrMipMapped::kNo); - sk_sp<GrSurfaceProxy> sProxy = - proxyProvider->createWrappedTextureProxy(backendTex, origin, - supportedNumSamples); + sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapRenderableBackendTexture( + backendTex, origin, supportedNumSamples); if (!sProxy) { gpu->deleteTestingOnlyBackendTexture(&backendTex); continue; // This can fail on Mesa @@ -275,7 +273,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { gpu->deleteTestingOnlyBackendTexture(&backendTex); } - // Tests createWrappedTextureProxy that is only textureable + // Tests wrapBackendTexture that is only textureable { // Internal offscreen texture GrBackendTexture backendTex = @@ -283,10 +281,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) { kWidthHeight, colorType, false, GrMipMapped::kNo); - sk_sp<GrSurfaceProxy> sProxy = - proxyProvider->createWrappedTextureProxy(backendTex, origin, - kBorrow_GrWrapOwnership, - nullptr, nullptr); + sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTexture( + backendTex, origin, kBorrow_GrWrapOwnership, nullptr, nullptr); if (!sProxy) { gpu->deleteTestingOnlyBackendTexture(&backendTex); continue; diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp index 08cedd0be3..e7512fb6bb 100644 --- a/tests/RectangleTextureTest.cpp +++ b/tests/RectangleTextureTest.cpp @@ -127,8 +127,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(RectangleTexture, reporter, ctxInfo) { } } - sk_sp<GrTextureProxy> rectProxy = proxyProvider->createWrappedTextureProxy( - rectangleTex, origin); + sk_sp<GrTextureProxy> rectProxy = proxyProvider->wrapBackendTexture(rectangleTex, origin); if (!rectProxy) { ERRORF(reporter, "Error creating proxy for rectangle texture."); diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp index f424463321..7647e89687 100644 --- a/tests/ResourceAllocatorTest.cpp +++ b/tests/ResourceAllocatorTest.cpp @@ -51,7 +51,7 @@ static sk_sp<GrSurfaceProxy> make_backend(GrContext* context, const ProxyParams& p.fConfig, false, GrMipMapped::kNo); - return proxyProvider->createWrappedTextureProxy(*backendTex, p.fOrigin); + return proxyProvider->wrapBackendTexture(*backendTex, p.fOrigin); } static void cleanup_backend(GrContext* context, GrBackendTexture* backendTex) { diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp index 0c93977a74..5745e4ebd4 100644 --- a/tests/TextureProxyTest.cpp +++ b/tests/TextureProxyTest.cpp @@ -109,7 +109,7 @@ static sk_sp<GrTextureProxy> create_wrapped_backend(GrContext* context, SkBackin GrBackendTexture backendTex = (*backingSurface)->getBackendTexture(); - return proxyProvider->createWrappedTextureProxy(backendTex, kBottomLeft_GrSurfaceOrigin); + return proxyProvider->wrapBackendTexture(backendTex, kBottomLeft_GrSurfaceOrigin); } |