aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-01-17 12:13:11 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-17 17:40:47 +0000
commit2ac5868f4a695b30777c7c57ffd493fed0fa597b (patch)
tree2453c3317a488f28a163640eef06f2f44997dac2 /tests
parent8008df1080f5623bf1cf13c713082c2b732d4eb2 (diff)
Remove GrSurfaceProxy::MakeWrapped
Change-Id: Ic44cf1745dc3be21cbbaa1dc4ac85c8b1b21c6bb Reviewed-on: https://skia-review.googlesource.com/94101 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/TextureProxyTest.cpp37
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());