aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/viewer
diff options
context:
space:
mode:
authorGravatar Ben Wagner <bungeman@google.com>2018-02-20 17:06:07 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-21 03:31:14 +0000
commit483c772cfdd646fad3ae8aa187136191ae3babdc (patch)
tree6bfe0818629abcf41fab36a48daeb0327e2ec6a4 /tools/viewer
parent14b7375aa648ef88135396ec14296aa676f40004 (diff)
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 <bungeman@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'tools/viewer')
-rw-r--r--tools/viewer/Viewer.cpp27
1 files changed, 7 insertions, 20 deletions
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);