Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(272)

Unified Diff: dm/DM.cpp

Issue 1860593002: One signature for creating unit tests that run on premade GrContexts (Closed) Base URL: https://skia.googlesource.com/skia.git@try_no_native
Patch Set: another guess to fix windows Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/BitmapCopyTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DM.cpp
diff --git a/dm/DM.cpp b/dm/DM.cpp
index 00cb279e8116d6567365b81c48696f85daa0634e..4a81cee9e148d5e620f36beda3063373869c720b 100644
--- a/dm/DM.cpp
+++ b/dm/DM.cpp
@@ -72,6 +72,7 @@ DEFINE_bool(simpleCodec, false, "Only decode images to native scale");
using namespace DM;
using sk_gpu_test::GrContextFactory;
using sk_gpu_test::GLTestContext;
+using sk_gpu_test::ContextInfo;
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
@@ -1415,28 +1416,8 @@ int dm_main() {
// TODO: currently many GPU tests are declared outside SK_SUPPORT_GPU guards.
// Thus we export the empty RunWithGPUTestContexts when SK_SUPPORT_GPU=0.
namespace skiatest {
-namespace {
-typedef void(*TestWithGrContext)(skiatest::Reporter*, GrContext*);
-typedef void(*TestWithGrContextAndGLContext)(skiatest::Reporter*, GrContext*, GLTestContext*);
-#if SK_SUPPORT_GPU
-template<typename T>
-void call_test(T test, skiatest::Reporter* reporter, const GrContextFactory::ContextInfo& context);
-template<>
-void call_test(TestWithGrContext test, skiatest::Reporter* reporter,
- const GrContextFactory::ContextInfo& context) {
- test(reporter, context.fGrContext);
-}
-template<>
-void call_test(TestWithGrContextAndGLContext test, skiatest::Reporter* reporter,
- const GrContextFactory::ContextInfo& context) {
- test(reporter, context.fGrContext, context.fGLContext);
-}
-#endif
-} // namespace
-
-template<typename T>
-void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* reporter,
- GrContextFactory* factory) {
+void RunWithGPUTestContexts(GrContextTestFn* test, GPUTestContexts testContexts,
+ Reporter* reporter, GrContextFactory* factory) {
#if SK_SUPPORT_GPU
// Iterate over context types, except use "native" instead of explicitly trying OpenGL and
// OpenGL ES. Do not use GLES on desktop, since tests do not account for not fixing
@@ -1476,29 +1457,18 @@ void RunWithGPUTestContexts(T test, GPUTestContexts testContexts, Reporter* repo
if ((testContexts & contextSelector) == 0) {
continue;
}
- GrContextFactory::ContextInfo context = factory->getContextInfo(contextType);
- if (context.fGrContext) {
- call_test(test, reporter, context);
+ ContextInfo ctxInfo = factory->getContextInfo(contextType);
+ if (ctxInfo.fGrContext) {
+ (*test)(reporter, ctxInfo);
}
- context = factory->getContextInfo(contextType,
+ ctxInfo = factory->getContextInfo(contextType,
GrContextFactory::kEnableNVPR_ContextOptions);
- if (context.fGrContext) {
- call_test(test, reporter, context);
+ if (ctxInfo.fGrContext) {
+ (*test)(reporter, ctxInfo);
}
}
#endif
}
-
-template
-void RunWithGPUTestContexts<TestWithGrContext>(TestWithGrContext test,
- GPUTestContexts testContexts,
- Reporter* reporter,
- GrContextFactory* factory);
-template
-void RunWithGPUTestContexts<TestWithGrContextAndGLContext>(TestWithGrContextAndGLContext test,
- GPUTestContexts testContexts,
- Reporter* reporter,
- GrContextFactory* factory);
} // namespace skiatest
#if !defined(SK_BUILD_FOR_IOS)
« no previous file with comments | « no previous file | tests/BitmapCopyTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698