Add runtime flag to turn compressed alpha masks on
R=bsalomon@google.com, robertphillips@google.com, mtklein@google.com
Author: krajcevski@google.com
Review URL: https://codereview.chromium.org/468293002
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 3522c4a..c8c9c6f 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -56,6 +56,8 @@
"Loop until timer overhead is at most this fraction of our measurments.");
DEFINE_double(gpuMs, 5, "Target bench time in millseconds for GPU.");
DEFINE_int32(gpuFrameLag, 5, "Overestimate of maximum number of frames GPU allows to lag.");
+DEFINE_bool(gpuCompressAlphaMasks, false, "Compress masks generated from falling back to "
+ "software path rendering.");
DEFINE_string(outResultsFile, "", "If given, write results here as JSON.");
DEFINE_int32(maxCalibrationAttempts, 3,
@@ -529,7 +531,9 @@
SkAutoGraphics ag;
#if SK_SUPPORT_GPU
- gGrFactory.reset(SkNEW_ARGS(GrContextFactory, (GrContext::Options())));
+ GrContext::Options grContextOpts;
+ grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks;
+ gGrFactory.reset(SkNEW_ARGS(GrContextFactory, (grContextOpts)));
#endif
if (kAutoTuneLoops != FLAGS_loops) {
diff --git a/gm/gmmain.cpp b/gm/gmmain.cpp
index eb9147b..7f012bc 100644
--- a/gm/gmmain.cpp
+++ b/gm/gmmain.cpp
@@ -1438,6 +1438,8 @@
"object count. " TOSTRING(DEFAULT_CACHE_VALUE) " for either value means "
"use the default. 0 for either disables the cache.");
DEFINE_bool(gpu, true, "Allows GPU configs to be run. Applied after --config.");
+DEFINE_bool(gpuCompressAlphaMasks, false, "Compress masks generated from falling back to "
+ "software path rendering.");
#endif
DEFINE_bool(hierarchy, false, "Whether to use multilevel directory structure "
"when reading/writing files.");
@@ -2284,7 +2286,9 @@
SkTDArray<SkScalar> tileGridReplayScales;
#if SK_SUPPORT_GPU
GrGLStandard gpuAPI = kNone_GrGLStandard;
- GrContextFactory* grFactory = new GrContextFactory(GrContext::Options());
+ GrContext::Options grContextOpts;
+ grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks;
+ GrContextFactory* grFactory = new GrContextFactory(grContextOpts);
#else
GrGLStandard gpuAPI = 0;
GrContextFactory* grFactory = NULL;