diff options
author | 2018-01-17 13:35:46 -0500 | |
---|---|---|
committer | 2018-01-17 19:43:57 +0000 | |
commit | adbe1328789071d1f742023edd93b6948eed9470 (patch) | |
tree | 952806d1cb29fc01b5743b433f6bfaabc6d6869e /tests | |
parent | fe266c2bce2b8ac4ef953f16c8e1a7801da9c57d (diff) |
Remove GrSurfaceProxy::MakeWrapped (take 2)
TBR=bsalomon@google.com
Change-Id: I26fd911da502fb00addacb8b2c1a263efc5aa4ec
Reviewed-on: https://skia-review.googlesource.com/95881
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/TextureProxyTest.cpp | 37 |
1 files changed, 12 insertions, 25 deletions
diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp index 914e83e7df..d422b076ad 100644 --- a/tests/TextureProxyTest.cpp +++ b/tests/TextureProxyTest.cpp @@ -43,8 +43,7 @@ static GrSurfaceDesc make_desc(GrSurfaceFlags flags) { // Basic test static sk_sp<GrTextureProxy> deferred_tex(skiatest::Reporter* reporter, - GrContext* context, SkBackingFit fit) { - GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); + GrProxyProvider* proxyProvider, SkBackingFit fit) { const GrSurfaceDesc desc = make_desc(kNone_GrSurfaceFlags); sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(desc, fit, SkBudgeted::kYes); @@ -54,8 +53,7 @@ static sk_sp<GrTextureProxy> deferred_tex(skiatest::Reporter* reporter, } static sk_sp<GrTextureProxy> deferred_texRT(skiatest::Reporter* reporter, - GrContext* context, SkBackingFit fit) { - GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); + GrProxyProvider* proxyProvider, SkBackingFit fit) { const GrSurfaceDesc desc = make_desc(kRenderTarget_GrSurfaceFlag); sk_sp<GrTextureProxy> proxy = proxyProvider->createProxy(desc, fit, SkBudgeted::kYes); @@ -65,8 +63,7 @@ static sk_sp<GrTextureProxy> deferred_texRT(skiatest::Reporter* reporter, } static sk_sp<GrTextureProxy> wrapped(skiatest::Reporter* reporter, - GrContext* context, SkBackingFit fit) { - GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider(); + GrProxyProvider* proxyProvider, SkBackingFit fit) { const GrSurfaceDesc desc = make_desc(kNone_GrSurfaceFlags); sk_sp<GrTextureProxy> proxy = proxyProvider->createInstantiatedProxy(desc, fit, @@ -77,9 +74,7 @@ static sk_sp<GrTextureProxy> wrapped(skiatest::Reporter* reporter, } static sk_sp<GrTextureProxy> wrapped_with_key(skiatest::Reporter* reporter, - GrContext* context, SkBackingFit fit) { - GrResourceProvider* resourceProvider = context->contextPriv().resourceProvider(); - + GrProxyProvider* proxyProvider, SkBackingFit fit) { static GrUniqueKey::Domain d = GrUniqueKey::GenerateDomain(); static int kUniqueKeyData = 0; @@ -91,18 +86,10 @@ static sk_sp<GrTextureProxy> wrapped_with_key(skiatest::Reporter* reporter, const GrSurfaceDesc desc = make_desc(kNone_GrSurfaceFlags); - sk_sp<GrTexture> tex; - if (SkBackingFit::kApprox == fit) { - tex = sk_sp<GrTexture>(resourceProvider->createApproxTexture(desc, 0)); - } else { - // Only budgeted & wrapped external proxies get to carry uniqueKeys - tex = resourceProvider->createTexture(desc, SkBudgeted::kYes); - } - - tex->resourcePriv().setUniqueKey(key); - - sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeWrapped(std::move(tex), - kBottomLeft_GrSurfaceOrigin); + // Only budgeted & wrapped external proxies get to carry uniqueKeys + sk_sp<GrTextureProxy> proxy = proxyProvider->createInstantiatedProxy(desc, fit, + SkBudgeted::kYes, 0); + SkAssertResult(proxyProvider->assignUniqueKeyToProxy(key, proxy.get())); REPORTER_ASSERT(reporter, proxy->getUniqueKey().isValid()); return proxy; } @@ -147,7 +134,7 @@ static void basic_test(GrContext* context, // Assigning the uniqueKey adds the proxy to the hash but doesn't force instantiation REPORTER_ASSERT(reporter, !proxyProvider->numUniqueKeyProxies_TestOnly()); - proxyProvider->assignUniqueKeyToProxy(key, proxy.get()); + SkAssertResult(proxyProvider->assignUniqueKeyToProxy(key, proxy.get())); } REPORTER_ASSERT(reporter, 1 == proxyProvider->numUniqueKeyProxies_TestOnly()); @@ -265,8 +252,8 @@ static void invalidation_and_instantiation_test(GrContext* context, skiatest::Re builder.finish(); // Create proxy, assign unique key - sk_sp<GrTextureProxy> proxy = deferred_tex(reporter, context, SkBackingFit::kExact); - proxyProvider->assignUniqueKeyToProxy(key, proxy.get()); + sk_sp<GrTextureProxy> proxy = deferred_tex(reporter, proxyProvider, SkBackingFit::kExact); + SkAssertResult(proxyProvider->assignUniqueKeyToProxy(key, proxy.get())); // Send an invalidation message, which will be sitting in the cache's inbox SkMessageBus<GrUniqueKeyInvalidatedMessage>::Post(GrUniqueKeyInvalidatedMessage(key)); @@ -302,7 +289,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(TextureProxyTest, reporter, ctxInfo) { for (auto fit : { SkBackingFit::kExact, SkBackingFit::kApprox }) { for (auto create : { deferred_tex, deferred_texRT, wrapped, wrapped_with_key }) { REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); - basic_test(context, reporter, create(reporter, context, fit), true); + basic_test(context, reporter, create(reporter, proxyProvider, fit), true); } REPORTER_ASSERT(reporter, 0 == cache->getResourceCount()); |