aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-12-13 15:00:45 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-13 21:34:20 +0000
commitb67821da87ffa711c07af75ee618b13dbccd6b7d (patch)
tree25179bbe05f6104f0314458f4cdd52475dfed73e /tests
parent81d9f0d42eea5bb428808e0a48e4ef85aec45e10 (diff)
Add GrBackendTexture & GrBackendRenderTarget access methods to GrTexture and GrRenderTarget
Change-Id: I627fcc2cab1d04169f49e33a6c17e161e9a9772a Reviewed-on: https://skia-review.googlesource.com/84621 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/BlendTest.cpp9
-rw-r--r--tests/GrMipMappedTest.cpp10
-rw-r--r--tests/ImageFilterCacheTest.cpp8
-rw-r--r--tests/TextureProxyTest.cpp9
4 files changed, 9 insertions, 27 deletions
diff --git a/tests/BlendTest.cpp b/tests/BlendTest.cpp
index 354bb3cebb..52f41dce59 100644
--- a/tests/BlendTest.cpp
+++ b/tests/BlendTest.cpp
@@ -100,13 +100,8 @@ static sk_sp<SkSurface> create_gpu_surface_backend_texture_as_render_target(
return nullptr;
}
- GrBackendTexture backendTex =
- GrTest::CreateBackendTexture(context->contextPriv().getBackend(),
- width,
- height,
- config,
- GrMipMapped::kNo,
- (*backingSurface)->getTextureHandle());
+ GrBackendTexture backendTex = (*backingSurface)->getBackendTexture();
+
sk_sp<SkSurface> surface =
SkSurface::MakeFromBackendTextureAsRenderTarget(context, backendTex, origin,
sampleCnt, nullptr, nullptr);
diff --git a/tests/GrMipMappedTest.cpp b/tests/GrMipMappedTest.cpp
index 7caa4bb01c..58faec4f8b 100644
--- a/tests/GrMipMappedTest.cpp
+++ b/tests/GrMipMappedTest.cpp
@@ -159,21 +159,19 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter,
return;
}
- GrBackendObject genBackendObject = genTexture->getTextureHandle();
+ GrBackendTexture genBackendTex = genTexture->getBackendTexture();
- if (kOpenGL_GrBackend == context->contextPriv().getBackend()) {
+ if (const GrGLTextureInfo* genTexInfo = genBackendTex.getGLTextureInfo()) {
const GrGLTextureInfo* origTexInfo = backendTex.getGLTextureInfo();
- GrGLTextureInfo* genTexInfo = (GrGLTextureInfo*)genBackendObject;
if (willUseMips && GrMipMapped::kNo == mipMapped) {
// We did a copy so the texture IDs should be different
REPORTER_ASSERT(reporter, origTexInfo->fID != genTexInfo->fID);
} else {
REPORTER_ASSERT(reporter, origTexInfo->fID == genTexInfo->fID);
}
- } else if (kVulkan_GrBackend == context->contextPriv().getBackend()) {
#ifdef SK_VULKAN
+ } else if (const GrVkImageInfo* genImageInfo = genBackendTex.getVkImageInfo()) {
const GrVkImageInfo* origImageInfo = backendTex.getVkImageInfo();
- GrVkImageInfo* genImageInfo = (GrVkImageInfo*)genBackendObject;
if (willUseMips && GrMipMapped::kNo == mipMapped) {
// We did a copy so the texture IDs should be different
REPORTER_ASSERT(reporter, origImageInfo->fImage != genImageInfo->fImage);
@@ -181,8 +179,6 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrBackendTextureImageMipMappedTest, reporter,
REPORTER_ASSERT(reporter, origImageInfo->fImage == genImageInfo->fImage);
}
#endif
- } else if (kMetal_GrBackend == context->contextPriv().getBackend()) {
- REPORTER_ASSERT(reporter, false);
} else {
REPORTER_ASSERT(reporter, false);
}
diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp
index 449b252acf..bcd451127b 100644
--- a/tests/ImageFilterCacheTest.cpp
+++ b/tests/ImageFilterCacheTest.cpp
@@ -215,12 +215,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageFilterCache_ImageBackedGPU, reporter, ct
}
GrTexture* tex = srcProxy->priv().peekTexture();
- GrBackendTexture backendTex = GrTest::CreateBackendTexture(context->contextPriv().getBackend(),
- kFullSize,
- kFullSize,
- kRGBA_8888_GrPixelConfig,
- GrMipMapped::kNo,
- tex->getTextureHandle());
+ GrBackendTexture backendTex = tex->getBackendTexture();
+
GrSurfaceOrigin texOrigin = kTopLeft_GrSurfaceOrigin;
sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(context,
backendTex,
diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp
index a4b93c8d7a..393e8c69e1 100644
--- a/tests/TextureProxyTest.cpp
+++ b/tests/TextureProxyTest.cpp
@@ -114,19 +114,14 @@ static sk_sp<GrTextureProxy> create_wrapped_backend(GrContext* context, SkBackin
sk_sp<GrTexture>* backingSurface) {
GrResourceProvider* provider = context->resourceProvider();
- GrSurfaceDesc desc = make_desc(kNone_GrSurfaceFlags);
+ const GrSurfaceDesc desc = make_desc(kNone_GrSurfaceFlags);
*backingSurface = provider->createTexture(desc, SkBudgeted::kNo);
if (!(*backingSurface)) {
return nullptr;
}
- GrBackendTexture backendTex =
- GrTest::CreateBackendTexture(context->contextPriv().getBackend(),
- 64, 64,
- kRGBA_8888_GrPixelConfig,
- GrMipMapped::kNo,
- (*backingSurface)->getTextureHandle());
+ GrBackendTexture backendTex = (*backingSurface)->getBackendTexture();
return GrSurfaceProxy::MakeWrappedBackend(context, backendTex, kBottomLeft_GrSurfaceOrigin);
}