| 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_FONT_P
REFIX) - 1)) { |
| 717 return sk_tool_utils::create_portable_typeface_always(familyName, style)
; |
| 718 } |
| 719 return NULL; |
| 720 } |
| 721 |
| 722 #undef PORTABLE_FONT_PREFIX |
| 723 |
| 724 extern SkTypeface* (*gCreateTypefaceDelegate)(const char [], SkTypeface::Style )
; |
| 725 |
| 710 int dm_main(); | 726 int dm_main(); |
| 711 int dm_main() { | 727 int dm_main() { |
| 712 SetupCrashHandler(); | 728 SetupCrashHandler(); |
| 713 SkAutoGraphics ag; | 729 SkAutoGraphics ag; |
| 714 SkTaskGroup::Enabler enabled(FLAGS_threads); | 730 SkTaskGroup::Enabler enabled(FLAGS_threads); |
| 715 if (FLAGS_leaks) { | 731 if (FLAGS_leaks) { |
| 716 SkInstCountPrintLeaksOnExit(); | 732 SkInstCountPrintLeaksOnExit(); |
| 717 } | 733 } |
| 734 gCreateTypefaceDelegate = &create_from_name; |
| 718 | 735 |
| 719 start_keepalive(); | 736 start_keepalive(); |
| 720 | 737 |
| 721 gather_gold(); | 738 gather_gold(); |
| 722 gather_uninteresting_hashes(); | 739 gather_uninteresting_hashes(); |
| 723 | 740 |
| 724 gather_srcs(); | 741 gather_srcs(); |
| 725 gather_sinks(); | 742 gather_sinks(); |
| 726 gather_tests(); | 743 gather_tests(); |
| 727 | 744 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 } | 790 } |
| 774 return 0; | 791 return 0; |
| 775 } | 792 } |
| 776 | 793 |
| 777 #if !defined(SK_BUILD_FOR_IOS) | 794 #if !defined(SK_BUILD_FOR_IOS) |
| 778 int main(int argc, char** argv) { | 795 int main(int argc, char** argv) { |
| 779 SkCommandLineFlags::Parse(argc, argv); | 796 SkCommandLineFlags::Parse(argc, argv); |
| 780 return dm_main(); | 797 return dm_main(); |
| 781 } | 798 } |
| 782 #endif | 799 #endif |
| OLD | NEW |