From 483c772cfdd646fad3ae8aa187136191ae3babdc Mon Sep 17 00:00:00 2001 From: Ben Wagner Date: Tue, 20 Feb 2018 17:06:07 -0500 Subject: Add nativeFonts flag to Viewer. This moves DMFontMgr and several related files which are tightly related to fonts into tools/fonts, moves some flags around to prevent duplication, and adds the nativeFonts handling to Viewer. Change-Id: Id1bdad708a6b74319ac5ac9adfe21025db4ca0b2 Reviewed-on: https://skia-review.googlesource.com/108904 Commit-Queue: Ben Wagner Reviewed-by: Mike Klein --- tools/viewer/Viewer.cpp | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) (limited to 'tools/viewer') diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp index 6582490d50..8aff1cedb0 100644 --- a/tools/viewer/Viewer.cpp +++ b/tools/viewer/Viewer.cpp @@ -20,9 +20,11 @@ #include "SkCanvas.h" #include "SkColorSpacePriv.h" #include "SkColorSpaceXformCanvas.h" +#include "SkCommonFlags.h" #include "SkCommandLineFlags.h" #include "SkCommonFlagsGpu.h" #include "SkEventTracingPriv.h" +#include "SkFontMgrPriv.h" #include "SkGraphics.h" #include "SkImagePriv.h" #include "SkOSFile.h" @@ -33,6 +35,7 @@ #include "SkStream.h" #include "SkSurface.h" #include "SkTaskGroup.h" +#include "SkTestFontMgr.h" #include "SkThreadedBMPDevice.h" #include "imgui.h" @@ -50,16 +53,6 @@ Application* Application::Create(int argc, char** argv, void* platformData) { return new Viewer(argc, argv, platformData); } -static DEFINE_string2(match, m, nullptr, - "[~][^]substring[$] [...] of bench name to run.\n" - "Multiple matches may be separated by spaces.\n" - "~ causes a matching bench to always be skipped\n" - "^ requires the start of the bench to match\n" - "$ requires the end of the bench to match\n" - "^ and $ requires an exact match\n" - "If a bench does not match any list entry,\n" - "it is skipped unless some list entry starts with ~"); - static DEFINE_string(slide, "", "Start on this sample."); static DEFINE_bool(list, false, "List samples?"); @@ -69,16 +62,6 @@ static DEFINE_bool(list, false, "List samples?"); # define BACKENDS_STR "\"sw\" and \"gl\"" #endif -#ifdef SK_BUILD_FOR_ANDROID -static DEFINE_string(skps, "/data/local/tmp/skps", "Directory to read skps from."); -static DEFINE_string(jpgs, "/data/local/tmp/resources", "Directory to read jpgs from."); -static DEFINE_string(jsons, "/data/local/tmp/jsons", "Directory to read (Bodymovin) jsons from."); -#else -static DEFINE_string(skps, "skps", "Directory to read skps from."); -static DEFINE_string(jpgs, "jpgs", "Directory to read jpgs from."); -static DEFINE_string(jsons, "jsons", "Directory to read (Bodymovin) jsons from."); -#endif - static DEFINE_string2(backend, b, "sw", "Backend to use. Allowed values are " BACKENDS_STR "."); static DEFINE_int32(msaa, 1, "Number of subpixel samples. 0 for no HW antialiasing."); @@ -219,6 +202,10 @@ Viewer::Viewer(int argc, char** argv, void* platformData) SetResourcePath("/data/local/tmp/resources"); #endif + if (!FLAGS_nativeFonts) { + gSkFontMgr_DefaultFactory = &sk_tool_utils::MakePortableFontMgr; + } + initializeEventTracingForTools(); static SkTaskGroup::Enabler kTaskGroupEnabler(FLAGS_threads); -- cgit v1.2.3