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 "CrashHandler.h" | 8 #include "CrashHandler.h" |
9 #include "DMJsonWriter.h" | 9 #include "DMJsonWriter.h" |
10 #include "DMSrcSink.h" | 10 #include "DMSrcSink.h" |
11 #include "DMSrcSinkAndroid.h" | 11 #include "DMSrcSinkAndroid.h" |
12 #include "OverwriteLine.h" | 12 #include "OverwriteLine.h" |
13 #include "ProcStats.h" | 13 #include "ProcStats.h" |
14 #include "SkBBHFactory.h" | 14 #include "SkBBHFactory.h" |
15 #include "SkChecksum.h" | 15 #include "SkChecksum.h" |
16 #include "SkCommonFlags.h" | 16 #include "SkCommonFlags.h" |
17 #include "SkFontMgr.h" | |
17 #include "SkForceLinking.h" | 18 #include "SkForceLinking.h" |
18 #include "SkGraphics.h" | 19 #include "SkGraphics.h" |
19 #include "SkInstCnt.h" | 20 #include "SkInstCnt.h" |
20 #include "SkMD5.h" | 21 #include "SkMD5.h" |
21 #include "SkOSFile.h" | 22 #include "SkOSFile.h" |
22 #include "SkTHash.h" | 23 #include "SkTHash.h" |
23 #include "SkTaskGroup.h" | 24 #include "SkTaskGroup.h" |
24 #include "SkThreadUtils.h" | 25 #include "SkThreadUtils.h" |
25 #include "Test.h" | 26 #include "Test.h" |
26 #include "Timer.h" | 27 #include "Timer.h" |
28 #include "sk_tool_utils.h" | |
27 | 29 |
28 DEFINE_string(src, "tests gm skp image", "Source types to test."); | 30 DEFINE_string(src, "tests gm skp image", "Source types to test."); |
29 DEFINE_bool(nameByHash, false, | 31 DEFINE_bool(nameByHash, false, |
30 "If true, write to FLAGS_writePath[0]/<hash>.png instead of " | 32 "If true, write to FLAGS_writePath[0]/<hash>.png instead of " |
31 "to FLAGS_writePath[0]/<config>/<sourceType>/<sourceOptions>/<name>. png"); | 33 "to FLAGS_writePath[0]/<config>/<sourceType>/<sourceOptions>/<name>. png"); |
32 DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests."); | 34 DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests."); |
33 DEFINE_string(matrix, "1 0 0 1", | 35 DEFINE_string(matrix, "1 0 0 1", |
34 "2x2 scale+skew matrix to apply or upright when using " | 36 "2x2 scale+skew matrix to apply or upright when using " |
35 "'matrix' or 'upright' in config."); | 37 "'matrix' or 'upright' in config."); |
36 DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?"); | 38 DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?"); |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
700 } | 702 } |
701 } | 703 } |
702 SkDebugf("\nCurrently running:%s\n", running.c_str()); | 704 SkDebugf("\nCurrently running:%s\n", running.c_str()); |
703 } | 705 } |
704 } | 706 } |
705 }; | 707 }; |
706 static SkThread* intentionallyLeaked = new SkThread(Loop::forever); | 708 static SkThread* intentionallyLeaked = new SkThread(Loop::forever); |
707 intentionallyLeaked->start(); | 709 intentionallyLeaked->start(); |
708 } | 710 } |
709 | 711 |
712 #define PORTABLE_FONT_PREFIX "Toy Liberation " | |
713 | |
714 static SkTypeface* create_from_name(const char familyName[], SkTypeface::Style s tyle) { | |
715 if (familyName && strlen(familyName) > sizeof(PORTABLE_FONT_PREFIX) | |
716 && !strncmp(familyName, PORTABLE_FONT_PREFIX, sizeof(PORTABLE_FO NT_PREFIX) - 1)) { | |
717 return sk_tool_utils::create_portable_typeface_always(familyName, st yle); | |
mtklein
2015/06/09 17:04:15
Whacky indent here?
caryclark
2015/06/09 17:10:39
Done.
| |
718 } | |
719 // If we called SkTypeface::CreateFromName() here we'd recurse infinitely, | |
720 // so we reimplement its core logic here inline without the recursive aspect . | |
721 if (NULL == familyName) { | |
722 return SkTypeface::RefDefault(style); | |
723 } | |
724 SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); | |
725 return fm->legacyCreateTypeface(familyName, style); | |
726 } | |
727 | |
728 #undef PORTABLE_FONT_PREFIX | |
729 | |
710 int dm_main(); | 730 int dm_main(); |
711 int dm_main() { | 731 int dm_main() { |
712 SetupCrashHandler(); | 732 SetupCrashHandler(); |
713 SkAutoGraphics ag; | 733 SkAutoGraphics ag; |
714 SkTaskGroup::Enabler enabled(FLAGS_threads); | 734 SkTaskGroup::Enabler enabled(FLAGS_threads); |
715 if (FLAGS_leaks) { | 735 if (FLAGS_leaks) { |
716 SkInstCountPrintLeaksOnExit(); | 736 SkInstCountPrintLeaksOnExit(); |
717 } | 737 } |
738 SkTypeface::SetGlobalCreateFromNameDelegate(&create_from_name); | |
718 | 739 |
719 start_keepalive(); | 740 start_keepalive(); |
720 | 741 |
721 gather_gold(); | 742 gather_gold(); |
722 gather_uninteresting_hashes(); | 743 gather_uninteresting_hashes(); |
723 | 744 |
724 gather_srcs(); | 745 gather_srcs(); |
725 gather_sinks(); | 746 gather_sinks(); |
726 gather_tests(); | 747 gather_tests(); |
727 | 748 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
773 } | 794 } |
774 return 0; | 795 return 0; |
775 } | 796 } |
776 | 797 |
777 #if !defined(SK_BUILD_FOR_IOS) | 798 #if !defined(SK_BUILD_FOR_IOS) |
778 int main(int argc, char** argv) { | 799 int main(int argc, char** argv) { |
779 SkCommandLineFlags::Parse(argc, argv); | 800 SkCommandLineFlags::Parse(argc, argv); |
780 return dm_main(); | 801 return dm_main(); |
781 } | 802 } |
782 #endif | 803 #endif |
OLD | NEW |