| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "DMJsonWriter.h" | 8 #include "DMJsonWriter.h" |
| 9 #include "DMSrcSink.h" | 9 #include "DMSrcSink.h" |
| 10 #include "DMSrcSinkAndroid.h" | 10 #include "DMSrcSinkAndroid.h" |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 #else | 818 #else |
| 819 return false; | 819 return false; |
| 820 #endif | 820 #endif |
| 821 } | 821 } |
| 822 | 822 |
| 823 static Sink* create_sink(const SkCommandLineConfig* config) { | 823 static Sink* create_sink(const SkCommandLineConfig* config) { |
| 824 #if SK_SUPPORT_GPU | 824 #if SK_SUPPORT_GPU |
| 825 if (gpu_supported()) { | 825 if (gpu_supported()) { |
| 826 if (const SkCommandLineConfigGpu* gpuConfig = config->asConfigGpu()) { | 826 if (const SkCommandLineConfigGpu* gpuConfig = config->asConfigGpu()) { |
| 827 GrContextFactory::ContextType contextType = gpuConfig->getContextTyp
e(); | 827 GrContextFactory::ContextType contextType = gpuConfig->getContextTyp
e(); |
| 828 GrContextFactory::ContextOptions contextOptions = | 828 GrContextFactory::ContextOptions contextOptions = gpuConfig->getCont
extOptions(); |
| 829 GrContextFactory::kNone_ContextOptions; | |
| 830 if (gpuConfig->getUseNVPR()) { | |
| 831 contextOptions = static_cast<GrContextFactory::ContextOptions>( | |
| 832 contextOptions | GrContextFactory::kEnableNVPR_ContextOption
s); | |
| 833 } | |
| 834 if (gpuConfig->getUseInstanced()) { | |
| 835 contextOptions = static_cast<GrContextFactory::ContextOptions>( | |
| 836 contextOptions | GrContextFactory::kUseInstanced_ContextOpti
ons); | |
| 837 } | |
| 838 if (SkColorAndColorSpaceAreGammaCorrect(gpuConfig->getColorType(), | |
| 839 gpuConfig->getColorSpace()))
{ | |
| 840 contextOptions = static_cast<GrContextFactory::ContextOptions>( | |
| 841 contextOptions | GrContextFactory::kRequireSRGBSupport_Conte
xtOptions); | |
| 842 } | |
| 843 GrContextFactory testFactory; | 829 GrContextFactory testFactory; |
| 844 if (!testFactory.get(contextType, contextOptions)) { | 830 if (!testFactory.get(contextType, contextOptions)) { |
| 845 info("WARNING: can not create GPU context for config '%s'. " | 831 info("WARNING: can not create GPU context for config '%s'. " |
| 846 "GM tests will be skipped.\n", gpuConfig->getTag().c_str())
; | 832 "GM tests will be skipped.\n", gpuConfig->getTag().c_str())
; |
| 847 return nullptr; | 833 return nullptr; |
| 848 } | 834 } |
| 849 return new GPUSink(contextType, contextOptions, gpuConfig->getSample
s(), | 835 return new GPUSink(contextType, contextOptions, gpuConfig->getSample
s(), |
| 850 gpuConfig->getUseDIText(), gpuConfig->getColorTyp
e(), | 836 gpuConfig->getUseDIText(), gpuConfig->getColorTyp
e(), |
| 851 sk_ref_sp(gpuConfig->getColorSpace()), FLAGS_gpu_
threading); | 837 sk_ref_sp(gpuConfig->getColorSpace()), FLAGS_gpu_
threading); |
| 852 } | 838 } |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1422 if (contextType == GrContextFactory::kGL_ContextType || | 1408 if (contextType == GrContextFactory::kGL_ContextType || |
| 1423 contextType == GrContextFactory::kGLES_ContextType) { | 1409 contextType == GrContextFactory::kGLES_ContextType) { |
| 1424 if (contextType != GrContextFactory::kNativeGL_ContextType) { | 1410 if (contextType != GrContextFactory::kNativeGL_ContextType) { |
| 1425 continue; | 1411 continue; |
| 1426 } | 1412 } |
| 1427 } | 1413 } |
| 1428 if (ctxInfo.grContext()) { | 1414 if (ctxInfo.grContext()) { |
| 1429 (*test)(reporter, ctxInfo); | 1415 (*test)(reporter, ctxInfo); |
| 1430 } | 1416 } |
| 1431 ctxInfo = factory->getContextInfo(contextType, | 1417 ctxInfo = factory->getContextInfo(contextType, |
| 1432 GrContextFactory::kEnableNVPR_ContextO
ptions); | 1418 GrContextFactory::ContextOptions::kEna
bleNVPR); |
| 1433 if (ctxInfo.grContext()) { | 1419 if (ctxInfo.grContext()) { |
| 1434 (*test)(reporter, ctxInfo); | 1420 (*test)(reporter, ctxInfo); |
| 1435 } | 1421 } |
| 1436 } | 1422 } |
| 1437 #endif | 1423 #endif |
| 1438 } | 1424 } |
| 1439 } // namespace skiatest | 1425 } // namespace skiatest |
| 1440 | 1426 |
| 1441 #if !defined(SK_BUILD_FOR_IOS) | 1427 #if !defined(SK_BUILD_FOR_IOS) |
| 1442 int main(int argc, char** argv) { | 1428 int main(int argc, char** argv) { |
| 1443 SkCommandLineFlags::Parse(argc, argv); | 1429 SkCommandLineFlags::Parse(argc, argv); |
| 1444 return dm_main(); | 1430 return dm_main(); |
| 1445 } | 1431 } |
| 1446 #endif | 1432 #endif |
| OLD | NEW |