factor out SetAnalyticAAFromCommonFlags()

This wraps up the behavior for --analyticAA and --forceAnalyticAA
in one place, like we've done for the various GPU flags covered by
SetCtxOptionsFromCommonFlags().

It seems at least midly useful to have common flags centralized when
there is really a common mechanism they control.  Most of the rest
of these flags only serve analogous purposes in the various binaries
that use them, and I think it might be better for them to be split
out rather than centralized (so they don't show up confusingly in
binaries that _don't_ use them).

Change-Id: I27dbe53586363d4b262c1679ea73138015811ed1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/203095
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
Mike Klein 2019-03-22 11:39:09 -05:00 committed by Skia Commit-Bot
parent 1432733fce
commit 03fa5d4083
4 changed files with 20 additions and 20 deletions

View File

@ -39,7 +39,6 @@
#include "SkOSFile.h"
#include "SkOSPath.h"
#include "SkPictureRecorder.h"
#include "SkScan.h"
#include "SkString.h"
#include "SkSurface.h"
#include "SkTaskGroup.h"
@ -1191,11 +1190,8 @@ int main(int argc, char** argv) {
start_keepalive();
}
gSkUseAnalyticAA = FLAGS_analyticAA;
SetAnalyticAAFromCommonFlags();
if (FLAGS_forceAnalyticAA) {
gSkForceAnalyticAA = true;
}
if (FLAGS_forceRasterPipeline) {
gSkForceRasterPipelineBlitter = true;
}

View File

@ -32,7 +32,6 @@
#include "SkMutex.h"
#include "SkOSFile.h"
#include "SkOSPath.h"
#include "SkScan.h"
#include "SkSpinlock.h"
#include "SkTHash.h"
#include "SkTaskGroup.h"
@ -1537,11 +1536,8 @@ int main(int argc, char** argv) {
setbuf(stdout, nullptr);
setup_crash_handler();
gSkUseAnalyticAA = FLAGS_analyticAA;
SetAnalyticAAFromCommonFlags();
if (FLAGS_forceAnalyticAA) {
gSkForceAnalyticAA = true;
}
if (FLAGS_forceRasterPipeline) {
gSkForceRasterPipelineBlitter = true;
}

View File

@ -11,6 +11,7 @@
#include "SkOSFile.h"
#include "SkOSPath.h"
#include "SkOnce.h"
#include "SkScan.h"
DEFINE_bool(cpu, true, "master switch for running CPU-bound work.");
@ -78,14 +79,6 @@ DEFINE_string(properties,
"",
"Space-separated key/value pairs to add to JSON identifying this run.");
DEFINE_bool(analyticAA, true, "If false, disable analytic anti-aliasing");
DEFINE_bool(forceAnalyticAA,
false,
"Force analytic anti-aliasing even if the path is complicated: "
"whether it's concave or convex, we consider a path complicated"
"if its number of points is comparable to its resolution.");
bool CollectImages(CommandLineFlags::StringArray images, SkTArray<SkString>* output) {
SkASSERT(output);
@ -255,3 +248,15 @@ void SetCtxOptionsFromCommonFlags(GrContextOptions* ctxOptions) {
ctxOptions->fReduceOpListSplitting = GrContextOptions::Enable::kYes;
}
}
static DEFINE_bool(analyticAA, true, "If false, disable analytic anti-aliasing");
static DEFINE_bool(forceAnalyticAA, false,
"Force analytic anti-aliasing even if the path is complicated: "
"whether it's concave or convex, we consider a path complicated"
"if its number of points is comparable to its resolution.");
void SetAnalyticAAFromCommonFlags() {
gSkUseAnalyticAA = FLAGS_analyticAA;
gSkForceAnalyticAA = FLAGS_forceAnalyticAA;
}

View File

@ -28,8 +28,6 @@ DECLARE_string(resourcePath);
DECLARE_bool(verbose);
DECLARE_bool(veryVerbose);
DECLARE_string(writePath);
DECLARE_bool(analyticAA);
DECLARE_bool(forceAnalyticAA);
DECLARE_string(key);
DECLARE_string(properties);
@ -58,4 +56,9 @@ bool CollectImages(CommandLineFlags::StringArray dir, SkTArray<SkString>* output
*/
void SetCtxOptionsFromCommonFlags(struct GrContextOptions*);
/**
* Enable, disable, or force analytic anti-aliasing using --analyticAA and --forceAnalyticAA.
*/
void SetAnalyticAAFromCommonFlags();
#endif