OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 /* | 8 /* |
9 * Code for the "gm" (Golden Master) rendering comparison tool. | 9 * Code for the "gm" (Golden Master) rendering comparison tool. |
10 * | 10 * |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 { SkBitmap::kARGB_8888_Config, kRaster_Backend, kDontCare_GLContextType,
0, kRW_ConfigFlag, "8888", true }, | 983 { SkBitmap::kARGB_8888_Config, kRaster_Backend, kDontCare_GLContextType,
0, kRW_ConfigFlag, "8888", true }, |
984 #if 0 // stop testing this (for now at least) since we want to remove support
for it (soon please!!!) | 984 #if 0 // stop testing this (for now at least) since we want to remove support
for it (soon please!!!) |
985 { SkBitmap::kARGB_4444_Config, kRaster_Backend, kDontCare_GLContextType,
0, kRW_ConfigFlag, "4444", true }, | 985 { SkBitmap::kARGB_4444_Config, kRaster_Backend, kDontCare_GLContextType,
0, kRW_ConfigFlag, "4444", true }, |
986 #endif | 986 #endif |
987 { SkBitmap::kRGB_565_Config, kRaster_Backend, kDontCare_GLContextType,
0, kRW_ConfigFlag, "565", true }, | 987 { SkBitmap::kRGB_565_Config, kRaster_Backend, kDontCare_GLContextType,
0, kRW_ConfigFlag, "565", true }, |
988 #if SK_SUPPORT_GPU | 988 #if SK_SUPPORT_GPU |
989 { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kNative_GL
ContextType, 0, kRW_ConfigFlag, "gpu", true }, | 989 { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kNative_GL
ContextType, 0, kRW_ConfigFlag, "gpu", true }, |
990 { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kNative_GL
ContextType, 16, kRW_ConfigFlag, "msaa16", true }, | 990 { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kNative_GL
ContextType, 16, kRW_ConfigFlag, "msaa16", true }, |
991 { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kNative_GL
ContextType, 4, kRW_ConfigFlag, "msaa4", false}, | 991 { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kNative_GL
ContextType, 4, kRW_ConfigFlag, "msaa4", false}, |
992 /* The debug context does not generate images */ | 992 /* The debug context does not generate images */ |
993 { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kDebug_GLC
ontextType, 0, kNone_ConfigFlag, "debug", true }, | 993 { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kDebug_GLC
ontextType, 0, kNone_ConfigFlag, "gpudebug", GR_DEBUG}, |
994 #if SK_ANGLE | 994 #if SK_ANGLE |
995 { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kANGLE_GLC
ontextType, 0, kRW_ConfigFlag, "angle", true }, | 995 { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kANGLE_GLC
ontextType, 0, kRW_ConfigFlag, "angle", true }, |
996 { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kANGLE_GLC
ontextType, 16, kRW_ConfigFlag, "anglemsaa16", true }, | 996 { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kANGLE_GLC
ontextType, 16, kRW_ConfigFlag, "anglemsaa16", true }, |
997 #endif // SK_ANGLE | 997 #endif // SK_ANGLE |
998 #ifdef SK_MESA | 998 #ifdef SK_MESA |
999 { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kMESA_GLCo
ntextType, 0, kRW_ConfigFlag, "mesa", true }, | 999 { SkBitmap::kARGB_8888_Config, kGPU_Backend, GrContextFactory::kMESA_GLCo
ntextType, 0, kRW_ConfigFlag, "mesa", true }, |
1000 #endif // SK_MESA | 1000 #endif // SK_MESA |
1001 #endif // SK_SUPPORT_GPU | 1001 #endif // SK_SUPPORT_GPU |
1002 #ifdef SK_SUPPORT_XPS | 1002 #ifdef SK_SUPPORT_XPS |
1003 /* At present we have no way of comparing XPS files (either natively or by c
onverting to PNG). */ | 1003 /* At present we have no way of comparing XPS files (either natively or by c
onverting to PNG). */ |
1004 { SkBitmap::kARGB_8888_Config, kXPS_Backend, kDontCare_GLContextType,
0, kWrite_ConfigFlag, "xps", true }, | 1004 { SkBitmap::kARGB_8888_Config, kXPS_Backend, kDontCare_GLContextType,
0, kWrite_ConfigFlag, "xps", true }, |
1005 #endif // SK_SUPPORT_XPS | 1005 #endif // SK_SUPPORT_XPS |
1006 #ifdef SK_SUPPORT_PDF | 1006 #ifdef SK_SUPPORT_PDF |
1007 { SkBitmap::kARGB_8888_Config, kPDF_Backend, kDontCare_GLContextType,
0, kPDFConfigFlags, "pdf", true }, | 1007 { SkBitmap::kARGB_8888_Config, kPDF_Backend, kDontCare_GLContextType,
0, kPDFConfigFlags, "pdf", true }, |
1008 #endif // SK_SUPPORT_PDF | 1008 #endif // SK_SUPPORT_PDF |
1009 }; | 1009 }; |
1010 | 1010 |
1011 static SkString configUsage() { | 1011 static SkString configUsage() { |
1012 SkString result("Possible options for --config: ["); | 1012 SkString result; |
| 1013 result.appendf("Space delimited list of which configs to run. Possible optio
ns: ["); |
1013 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { | 1014 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { |
1014 if (i > 0) { | 1015 if (i > 0) { |
1015 result.appendf("|"); | 1016 result.append("|"); |
1016 } | 1017 } |
1017 result.appendf("%s", gRec[i].fName); | 1018 result.appendf("%s", gRec[i].fName); |
1018 } | 1019 } |
1019 result.appendf("]"); | 1020 result.append("]\n"); |
| 1021 result.appendf("The default value is: \""); |
| 1022 for (size_t i = 0; i < SK_ARRAY_COUNT(gRec); ++i) { |
| 1023 if (gRec[i].fRunByDefault) { |
| 1024 if (i > 0) { |
| 1025 result.append(" "); |
| 1026 } |
| 1027 result.appendf("%s", gRec[i].fName); |
| 1028 } |
| 1029 } |
| 1030 result.appendf("\""); |
| 1031 |
1020 return result; | 1032 return result; |
1021 } | 1033 } |
1022 | 1034 |
1023 // Alphabetized ignoring "no" prefix ("readPath", "noreplay", "resourcePath"). | 1035 // Alphabetized ignoring "no" prefix ("readPath", "noreplay", "resourcePath"). |
1024 DEFINE_string(config, "", "Space delimited list of which configs to run. " | 1036 DEFINE_string(config, "", configUsage().c_str()); |
1025 "Possible configs listed above. If none are specified, " | |
1026 "all will be run."); | |
1027 DEFINE_bool(deferred, true, "Exercise the deferred rendering test pass."); | 1037 DEFINE_bool(deferred, true, "Exercise the deferred rendering test pass."); |
1028 DEFINE_bool(enableMissingWarning, true, "Print message to stderr (but don't fail
) if " | 1038 DEFINE_bool(enableMissingWarning, true, "Print message to stderr (but don't fail
) if " |
1029 "unable to read a reference image for any tests."); | 1039 "unable to read a reference image for any tests."); |
1030 DEFINE_string(excludeConfig, "", "Space delimited list of configs to skip."); | 1040 DEFINE_string(excludeConfig, "", "Space delimited list of configs to skip."); |
1031 DEFINE_bool(forceBWtext, false, "Disable text anti-aliasing."); | 1041 DEFINE_bool(forceBWtext, false, "Disable text anti-aliasing."); |
1032 #if SK_SUPPORT_GPU | 1042 #if SK_SUPPORT_GPU |
1033 DEFINE_string(gpuCacheSize, "", "<bytes> <count>: Limit the gpu cache to byte si
ze or " | 1043 DEFINE_string(gpuCacheSize, "", "<bytes> <count>: Limit the gpu cache to byte si
ze or " |
1034 "object count. -1 for either value means use the default. 0 for ei
ther " | 1044 "object count. -1 for either value means use the default. 0 for ei
ther " |
1035 "disables the cache."); | 1045 "disables the cache."); |
1036 #endif | 1046 #endif |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 setSystemPreferences(); | 1154 setSystemPreferences(); |
1145 GMMain gmmain; | 1155 GMMain gmmain; |
1146 | 1156 |
1147 SkTDArray<size_t> configs; | 1157 SkTDArray<size_t> configs; |
1148 SkTDArray<size_t> excludeConfigs; | 1158 SkTDArray<size_t> excludeConfigs; |
1149 SkTDArray<SkScalar> tileGridReplayScales; | 1159 SkTDArray<SkScalar> tileGridReplayScales; |
1150 *tileGridReplayScales.append() = SK_Scalar1; // By default only test at scal
e 1.0 | 1160 *tileGridReplayScales.append() = SK_Scalar1; // By default only test at scal
e 1.0 |
1151 bool userConfig = false; | 1161 bool userConfig = false; |
1152 | 1162 |
1153 SkString usage; | 1163 SkString usage; |
1154 usage.printf("Run the golden master tests.\n\t%s", configUsage().c_str()); | 1164 usage.printf("Run the golden master tests.\n"); |
1155 SkFlags::SetUsage(usage.c_str()); | 1165 SkFlags::SetUsage(usage.c_str()); |
1156 SkFlags::ParseCommandLine(argc, argv); | 1166 SkFlags::ParseCommandLine(argc, argv); |
1157 | 1167 |
1158 #if SK_SUPPORT_GPU | 1168 #if SK_SUPPORT_GPU |
1159 struct { | 1169 struct { |
1160 int fBytes; | 1170 int fBytes; |
1161 int fCount; | 1171 int fCount; |
1162 } gpuCacheSize = { -1, -1 }; // -1s mean use the default | 1172 } gpuCacheSize = { -1, -1 }; // -1s mean use the default |
1163 | 1173 |
1164 if (FLAGS_gpuCacheSize.count() > 0) { | 1174 if (FLAGS_gpuCacheSize.count() > 0) { |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1628 if (FLAGS_forceBWtext) { | 1638 if (FLAGS_forceBWtext) { |
1629 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); | 1639 canvas->setDrawFilter(SkNEW(BWTextDrawFilter))->unref(); |
1630 } | 1640 } |
1631 } | 1641 } |
1632 | 1642 |
1633 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) | 1643 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) |
1634 int main(int argc, char * const argv[]) { | 1644 int main(int argc, char * const argv[]) { |
1635 return tool_main(argc, (char**) argv); | 1645 return tool_main(argc, (char**) argv); |
1636 } | 1646 } |
1637 #endif | 1647 #endif |
OLD | NEW |