Fix GrGLGpu::createTestingOnlyBackendRenderTarget()
The format field wasn't being set.
Make GrContext_colorTypeSupportedAsSurface test that surfaces can be
created from GrBackendRenderTargets.
Change-Id: Ib5ae4671faa3f44102c6436593c7a987a05b3b88
Reviewed-on: https://skia-review.googlesource.com/150134
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index af17791..569bcb0 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -168,6 +168,20 @@
if (backendTex.isValid()) {
gpu->deleteTestingOnlyBackendTexture(backendTex);
}
+
+ GrBackendRenderTarget backendRenderTarget = gpu->createTestingOnlyBackendRenderTarget(
+ 16, 16, SkColorTypeToGrColorType(colorType));
+ can = ctxInfo.grContext()->colorTypeSupportedAsSurface(colorType);
+ surf = SkSurface::MakeFromBackendRenderTarget(ctxInfo.grContext(), backendRenderTarget,
+ kTopLeft_GrSurfaceOrigin, colorType, nullptr,
+ nullptr);
+ REPORTER_ASSERT(reporter, can == SkToBool(surf), "ct: %d, can: %d, surf: %d", colorType,
+ can, SkToBool(surf));
+ surf.reset();
+ ctxInfo.grContext()->flush();
+ if (backendRenderTarget.isValid()) {
+ gpu->deleteTestingOnlyBackendRenderTarget(backendRenderTarget);
+ }
}
}