moar static flags

Like any normal variable, flags can be made file-scoped static,
and like any normal variable, mostly they should be if they can.

This CL converts most flags to be static, if only so that the
ones that do cross files stand out more clearly, and so that
there's more examples of static flags through the codebase for
people to ape.

Change-Id: Ibb5ddd7aa09fce073d0996ac3ef0487b078b7d79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202800
Commit-Queue: Mike Klein <mtklein@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Auto-Submit: Mike Klein <mtklein@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
This commit is contained in:
Mike Klein 2019-03-21 11:31:36 -05:00 committed by Skia Commit-Bot
parent 1b53106907
commit 84836b799a
30 changed files with 189 additions and 172 deletions

View File

@ -13,7 +13,8 @@
#include "SkOSFile.h"
// Actually zeroing the memory would throw off timing, so we just lie.
DEFINE_bool(zero_init, false, "Pretend our destination is zero-intialized, simulating Android?");
static DEFINE_bool(zero_init, false,
"Pretend our destination is zero-intialized, simulating Android?");
CodecBench::CodecBench(SkString baseName, SkData* encoded, SkColorType colorType,
SkAlphaType alphaType)

View File

@ -15,7 +15,7 @@
#include "SkShader.h"
#include "SkString.h"
DEFINE_double(strokeWidth, -1.0, "If set, use this stroke width in RectBench.");
static DEFINE_double(strokeWidth, -1.0, "If set, use this stroke width in RectBench.");
class RectBench : public Benchmark {
public:

View File

@ -14,11 +14,11 @@
#include "GrContextPriv.h"
// These CPU tile sizes are not good per se, but they are similar to what Chrome uses.
DEFINE_int32(CPUbenchTileW, 256, "Tile width used for CPU SKP playback.");
DEFINE_int32(CPUbenchTileH, 256, "Tile height used for CPU SKP playback.");
static DEFINE_int32(CPUbenchTileW, 256, "Tile width used for CPU SKP playback.");
static DEFINE_int32(CPUbenchTileH, 256, "Tile height used for CPU SKP playback.");
DEFINE_int32(GPUbenchTileW, 1600, "Tile width used for GPU SKP playback.");
DEFINE_int32(GPUbenchTileH, 512, "Tile height used for GPU SKP playback.");
static DEFINE_int32(GPUbenchTileW, 1600, "Tile width used for GPU SKP playback.");
static DEFINE_int32(GPUbenchTileH, 512, "Tile height used for GPU SKP playback.");
SKPBench::SKPBench(const char* name, const SkPicture* pic, const SkIRect& clip, SkScalar scale,
bool useMultiPictureDraw, bool doLooping)

View File

@ -20,13 +20,15 @@
#define ENABLE_COMMAND_LINE_SHAPES_BENCH 0
#if ENABLE_COMMAND_LINE_SHAPES_BENCH
DEFINE_string(shapesType, "mixed", "Type of shape to use in ShapesBench. Must be one of: "
"rect, oval, rrect, mixed.");
DEFINE_string(innerShapesType, "none", "Type of inner shape to use in ShapesBench. Must be one of: "
"none, rect, oval, rrect, mixed.");
DEFINE_int32(numShapes, 10000, "Number of shapes to draw in ShapesBench.");
DEFINE_string(shapesSize, "32x32", "Size of shapes to draw in ShapesBench.");
DEFINE_bool(shapesPersp, false, "Use slight perspective tilt in ShapesBench?");
static DEFINE_string(shapesType, "mixed",
"Type of shape to use in ShapesBench. Must be one of: "
"rect, oval, rrect, mixed.");
static DEFINE_string(innerShapesType, "none",
"Type of inner shape to use in ShapesBench. Must be one of: "
"none, rect, oval, rrect, mixed.");
static DEFINE_int32(numShapes, 10000, "Number of shapes to draw in ShapesBench.");
static DEFINE_string(shapesSize, "32x32", "Size of shapes to draw in ShapesBench.");
static DEFINE_bool(shapesPersp, false, "Use slight perspective tilt in ShapesBench?");
#endif
/*

View File

@ -103,39 +103,42 @@ static SkString to_string(int n) {
return str;
}
DEFINE_int32(loops, kDefaultLoops, loops_help_txt().c_str());
static DEFINE_int32(loops, kDefaultLoops, loops_help_txt().c_str());
DEFINE_int32(samples, 10, "Number of samples to measure for each bench.");
DEFINE_int32(ms, 0, "If >0, run each bench for this many ms instead of obeying --samples.");
DEFINE_int32(overheadLoops, 100000, "Loops to estimate timer overhead.");
DEFINE_double(overheadGoal, 0.0001,
static DEFINE_int32(samples, 10, "Number of samples to measure for each bench.");
static DEFINE_int32(ms, 0, "If >0, run each bench for this many ms instead of obeying --samples.");
static DEFINE_int32(overheadLoops, 100000, "Loops to estimate timer overhead.");
static DEFINE_double(overheadGoal, 0.0001,
"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, "If unknown, estimated maximum number of frames GPU allows to lag.");
static DEFINE_double(gpuMs, 5, "Target bench time in millseconds for GPU.");
static DEFINE_int32(gpuFrameLag, 5,
"If unknown, estimated maximum number of frames GPU allows to lag.");
DEFINE_string(outResultsFile, "", "If given, write results here as JSON.");
DEFINE_int32(maxCalibrationAttempts, 3,
static DEFINE_string(outResultsFile, "", "If given, write results here as JSON.");
static DEFINE_int32(maxCalibrationAttempts, 3,
"Try up to this many times to guess loops for a bench, or skip the bench.");
DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this.");
DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs.");
DEFINE_string(scales, "1.0", "Space-separated scales for SKPs.");
DEFINE_string(zoom, "1.0,0", "Comma-separated zoomMax,zoomPeriodMs factors for a periodic SKP zoom "
"function that ping-pongs between 1.0 and zoomMax.");
DEFINE_bool(bbh, true, "Build a BBH for SKPs?");
DEFINE_bool(lite, false, "Use SkLiteRecorder in recording benchmarks?");
DEFINE_bool(mpd, true, "Use MultiPictureDraw for the SKPs?");
DEFINE_bool(loopSKP, true, "Loop SKPs like we do for micro benches?");
DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run.");
DEFINE_bool(gpuStats, false, "Print GPU stats after each gpu benchmark?");
DEFINE_bool(gpuStatsDump, false, "Dump GPU states after each benchmark to json");
DEFINE_bool(keepAlive, false, "Print a message every so often so that we don't time out");
DEFINE_bool(csv, false, "Print status in CSV format");
DEFINE_string(sourceType, "",
static DEFINE_int32(maxLoops, 1000000, "Never run a bench more times than this.");
static DEFINE_string(clip, "0,0,1000,1000", "Clip for SKPs.");
static DEFINE_string(scales, "1.0", "Space-separated scales for SKPs.");
static DEFINE_string(zoom, "1.0,0",
"Comma-separated zoomMax,zoomPeriodMs factors for a periodic SKP zoom "
"function that ping-pongs between 1.0 and zoomMax.");
static DEFINE_bool(bbh, true, "Build a BBH for SKPs?");
static DEFINE_bool(lite, false, "Use SkLiteRecorder in recording benchmarks?");
static DEFINE_bool(mpd, true, "Use MultiPictureDraw for the SKPs?");
static DEFINE_bool(loopSKP, true, "Loop SKPs like we do for micro benches?");
static DEFINE_int32(flushEvery, 10, "Flush --outResultsFile every Nth run.");
static DEFINE_bool(gpuStats, false, "Print GPU stats after each gpu benchmark?");
static DEFINE_bool(gpuStatsDump, false, "Dump GPU states after each benchmark to json");
static DEFINE_bool(keepAlive, false, "Print a message every so often so that we don't time out");
static DEFINE_bool(csv, false, "Print status in CSV format");
static DEFINE_string(sourceType, "",
"Apply usual --match rules to source type: bench, gm, skp, image, etc.");
DEFINE_string(benchType, "",
"Apply usual --match rules to bench type: micro, recording, piping, playback, skcodec, etc.");
static DEFINE_string(benchType, "",
"Apply usual --match rules to bench type: micro, recording, "
"piping, playback, skcodec, etc.");
DEFINE_bool(forceRasterPipeline, false, "sets gSkForceRasterPipelineBlitter");
static DEFINE_bool(forceRasterPipeline, false, "sets gSkForceRasterPipelineBlitter");
static double now_ms() { return SkTime::GetNSecs() * 1e-6; }

View File

@ -59,17 +59,17 @@
extern bool gSkForceRasterPipelineBlitter;
DEFINE_string(src, "tests gm skp image", "Source types to test.");
DEFINE_bool(nameByHash, false,
"If true, write to FLAGS_writePath[0]/<hash>.png instead of "
"to FLAGS_writePath[0]/<config>/<sourceType>/<sourceOptions>/<name>.png");
DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests.");
DEFINE_string(matrix, "1 0 0 1",
"2x2 scale+skew matrix to apply or upright when using "
"'matrix' or 'upright' in config.");
DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?");
static DEFINE_string(src, "tests gm skp image", "Source types to test.");
static DEFINE_bool(nameByHash, false,
"If true, write to FLAGS_writePath[0]/<hash>.png instead of "
"to FLAGS_writePath[0]/<config>/<sourceType>/<sourceOptions>/<name>.png");
static DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests.");
static DEFINE_string(matrix, "1 0 0 1",
"2x2 scale+skew matrix to apply or upright when using "
"'matrix' or 'upright' in config.");
static DEFINE_bool(gpu_threading, false, "Allow GPU work to run on multiple threads?");
DEFINE_string(blacklist, "",
static DEFINE_string(blacklist, "",
"Space-separated config/src/srcOptions/name quadruples to blacklist. "
"'_' matches anything. '~' negates the match. E.g. \n"
"'--blacklist gpu skp _ _' will blacklist all SKPs drawn into the gpu config.\n"
@ -77,31 +77,32 @@ DEFINE_string(blacklist, "",
"'--blacklist ~8888 svg _ svgparse_' blocks non-8888 SVGs that contain \"svgparse_\" in "
"the name.");
DEFINE_string2(readPath, r, "", "If set check for equality with golden results in this directory.");
static DEFINE_string2(readPath, r, "",
"If set check for equality with golden results in this directory.");
DEFINE_string(uninterestingHashesFile, "",
static DEFINE_string(uninterestingHashesFile, "",
"File containing a list of uninteresting hashes. If a result hashes to something in "
"this list, no image is written for that result.");
DEFINE_int32(shards, 1, "We're splitting source data into this many shards.");
DEFINE_int32(shard, 0, "Which shard do I run?");
static DEFINE_int32(shards, 1, "We're splitting source data into this many shards.");
static DEFINE_int32(shard, 0, "Which shard do I run?");
DEFINE_string(mskps, "", "Directory to read mskps from, or a single mskp file.");
DEFINE_bool(forceRasterPipeline, false, "sets gSkForceRasterPipelineBlitter");
static DEFINE_string(mskps, "", "Directory to read mskps from, or a single mskp file.");
static DEFINE_bool(forceRasterPipeline, false, "sets gSkForceRasterPipelineBlitter");
DEFINE_string(bisect, "",
static DEFINE_string(bisect, "",
"Pair of: SKP file to bisect, followed by an l/r bisect trail string (e.g., 'lrll'). The "
"l/r trail specifies which half to keep at each step of a binary search through the SKP's "
"paths. An empty string performs no bisect. Only the SkPaths are bisected; all other draws "
"are thrown out. This is useful for finding a reduced repo case for path drawing bugs.");
DEFINE_bool(ignoreSigInt, false, "ignore SIGINT signals during test execution");
static DEFINE_bool(ignoreSigInt, false, "ignore SIGINT signals during test execution");
DEFINE_string(dont_write, "", "File extensions to skip writing to --writePath."); // See skia:6821
static DEFINE_string(dont_write, "", "File extensions to skip writing to --writePath."); // See skia:6821
DEFINE_bool(gdi, false, "On Windows, use GDI instead of DirectWrite for font rendering.");
static DEFINE_bool(gdi, false, "On Windows, use GDI instead of DirectWrite for font rendering.");
DEFINE_bool(checkF16, false, "Ensure that F16Norm pixels are clamped.");
static DEFINE_bool(checkF16, false, "Ensure that F16Norm pixels are clamped.");
using namespace DM;
using sk_gpu_test::GrContextFactory;

View File

@ -79,9 +79,9 @@
#include "../third_party/skcms/skcms.h"
DEFINE_bool(multiPage, false, "For document-type backends, render the source"
" into multiple pages");
DEFINE_bool(RAW_threading, true, "Allow RAW decodes to run on multiple threads?");
static DEFINE_bool(multiPage, false,
"For document-type backends, render the source into multiple pages");
static DEFINE_bool(RAW_threading, true, "Allow RAW decodes to run on multiple threads?");
using sk_gpu_test::GrContextFactory;
@ -1323,7 +1323,7 @@ static Error compare_bitmaps(const SkBitmap& reference, const SkBitmap& bitmap)
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
DEFINE_bool(gpuStats, false, "Append GPU stats to the log for each GPU task?");
static DEFINE_bool(gpuStats, false, "Append GPU stats to the log for each GPU task?");
GPUSink::GPUSink(GrContextFactory::ContextType ct,
GrContextFactory::ContextOverrides overrides,
@ -1346,7 +1346,7 @@ GPUSink::GPUSink(GrContextFactory::ContextType ct,
, fThreaded(threaded)
, fBaseContextOptions(grCtxOptions) {}
DEFINE_bool(drawOpClip, false, "Clip each GrDrawOp to its device bounds for testing.");
static DEFINE_bool(drawOpClip, false, "Clip each GrDrawOp to its device bounds for testing.");
Error GPUSink::draw(const Src& src, SkBitmap* dst, SkWStream* dstStream, SkString* log) const {
return this->onDraw(src, dst, dstStream, log, fBaseContextOptions);
@ -1712,7 +1712,7 @@ static Error draw_to_canvas(Sink* sink, SkBitmap* bitmap, SkWStream* stream, SkS
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
DEFINE_bool(check, true, "If true, have most Via- modes fail if they affect the output.");
static DEFINE_bool(check, true, "If true, have most Via- modes fail if they affect the output.");
// Is *bitmap identical to what you get drawing src into sink?
static Error check_against_reference(const SkBitmap* bitmap, const Src& src, Sink* sink) {

View File

@ -79,7 +79,7 @@
#include <iostream>
#include <utility>
DEFINE_bool2(gpuInfo, g, false, "Display GPU information on relevant targets.");
static DEFINE_bool2(gpuInfo, g, false, "Display GPU information on relevant targets.");
// TODO:
// SkTextBlob with Unicode

View File

@ -30,13 +30,13 @@
#include <regex>
#include <signal.h>
DEFINE_string2(bytes, b, "", "A path to a file or a directory. If a file, the "
"contents will be used as the fuzz bytes. If a directory, all files "
"in the directory will be used as fuzz bytes for the fuzzer, one at a "
"time.");
DEFINE_string2(name, n, "", "If --type is 'api', fuzz the API with this name.");
DEFINE_string2(dump, d, "", "If not empty, dump 'image*' or 'skp' types as a "
"PNG with this name.");
static DEFINE_string2(bytes, b, "", "A path to a file or a directory. If a file, the "
"contents will be used as the fuzz bytes. If a directory, all files "
"in the directory will be used as fuzz bytes for the fuzzer, one at a "
"time.");
static DEFINE_string2(name, n, "", "If --type is 'api', fuzz the API with this name.");
static DEFINE_string2(dump, d, "", "If not empty, dump 'image*' or 'skp' types as a "
"PNG with this name.");
DEFINE_bool2(verbose, v, false, "Print more information while fuzzing.");
// This cannot be inlined in DEFINE_string2 due to interleaved ifdefs
@ -64,7 +64,7 @@ static constexpr char g_type_message[] = "How to interpret --bytes, one of:\n"
#endif
"textblob";
DEFINE_string2(type, t, "", g_type_message);
static DEFINE_string2(type, t, "", g_type_message);
static int fuzz_file(SkString path, SkString type);
static uint8_t calculate_option(SkData*);

View File

@ -19,7 +19,7 @@
#include <vector>
DEFINE_string(animatedGif, "images/test640x479.gif", "Animated gif in resources folder");
static DEFINE_string(animatedGif, "images/test640x479.gif", "Animated gif in resources folder");
class AnimatedGifGM : public skiagm::GM {
private:

View File

@ -19,16 +19,16 @@
#include <vector>
DEFINE_string2(input , i, nullptr, "Input .json file.");
DEFINE_string2(writePath, w, nullptr, "Output directory. Frames are names [0-9]{6}.png.");
DEFINE_string2(format , f, "png" , "Output format (png or skp)");
static DEFINE_string2(input , i, nullptr, "Input .json file.");
static DEFINE_string2(writePath, w, nullptr, "Output directory. Frames are names [0-9]{6}.png.");
static DEFINE_string2(format , f, "png" , "Output format (png or skp)");
DEFINE_double(t0, 0, "Timeline start [0..1].");
DEFINE_double(t1, 1, "Timeline stop [0..1].");
DEFINE_double(fps, 30, "Decode frames per second.");
static DEFINE_double(t0, 0, "Timeline start [0..1].");
static DEFINE_double(t1, 1, "Timeline stop [0..1].");
static DEFINE_double(fps, 30, "Decode frames per second.");
DEFINE_int32(width , 800, "Render width.");
DEFINE_int32(height, 600, "Render height.");
static DEFINE_int32(width , 800, "Render width.");
static DEFINE_int32(height, 600, "Render height.");
namespace {

View File

@ -32,12 +32,13 @@ class SkCanvasState;
#ifdef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
#include <dlfcn.h>
DEFINE_string(library, "", "Support library to use for CanvasState test. If empty (the default), "
"the test will be run without crossing a library boundary. Otherwise, "
"it is expected to be a full path to a shared library file, which will"
" be dynamically loaded. Functions from the library will be called to "
"test SkCanvasState. Instructions for generating the library are in "
"gyp/canvas_state_lib.gyp");
static DEFINE_string(library, "",
"Support library to use for CanvasState test. If empty (the default), "
"the test will be run without crossing a library boundary. Otherwise, "
"it is expected to be a full path to a shared library file, which will"
" be dynamically loaded. Functions from the library will be called to "
"test SkCanvasState. Instructions for generating the library are in "
"gyp/canvas_state_lib.gyp");
// This class calls dlopen on the library passed in to the command line flag library, and handles

View File

@ -216,7 +216,7 @@ static void test_systemfonts(skiatest::Reporter* reporter, bool verbose) {
} // namespace
DEFINE_bool(verboseFontNames, false, "verbose FontNames test.");
static DEFINE_bool(verboseFontNames, false, "verbose FontNames test.");
DEF_TEST(FontNames, reporter) {
test_synthetic(reporter, FLAGS_verboseFontNames);

View File

@ -90,12 +90,13 @@ static void setupOne(skiatest::Reporter* reporter, int col, int row, int rot, in
#include "CommandLineFlags.h"
DEFINE_int32(processOffset, 0, "Offset the test by this value. This permits multiple processes "
"to exercise the same test in parallel with different test values.");
DEFINE_int32(processCount, 1, "Test iteration count. This permits multiple "
"processes "
"to exercise the same test in parallel with different test values.");
DEFINE_int32(trialRuns, 100, "Run this many tests (defaults to 100).");
static DEFINE_int32(processOffset, 0,
"Offset the test by this value. This permits multiple processes "
"to exercise the same test in parallel with different test values.");
static DEFINE_int32(processCount, 1,
"Test iteration count. This permits multiple processes "
"to exercise the same test in parallel with different test values.");
static DEFINE_int32(trialRuns, 100, "Run this many tests (defaults to 100).");
DEF_TEST(SixtyOvals, reporter) {
bool skipOneOffs = false;

View File

@ -231,9 +231,10 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
#if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
#include "CommandLineFlags.h"
DEFINE_bool(randomProcessorTest, false, "Use non-deterministic seed for random processor tests?");
DEFINE_uint32(processorSeed, 0, "Use specific seed for processor tests. Overridden by " \
"--randomProcessorTest.");
static DEFINE_bool(randomProcessorTest, false,
"Use non-deterministic seed for random processor tests?");
static DEFINE_uint32(processorSeed, 0,
"Use specific seed for processor tests. Overridden by --randomProcessorTest.");
#if GR_TEST_UTILS

View File

@ -17,7 +17,7 @@
#include "SkTime.h"
#include "Test.h"
DEFINE_bool(timeout, true, "run until alloted time expires");
static DEFINE_bool(timeout, true, "run until alloted time expires");
#define MS_TEST_DURATION 10

View File

@ -13,7 +13,7 @@
#include "SkString.h"
#include "SkTime.h"
DEFINE_string2(tmpDir, t, nullptr, "Temp directory to use.");
static DEFINE_string2(tmpDir, t, nullptr, "Temp directory to use.");
void skiatest::Reporter::bumpTestCount() {}

View File

@ -13,7 +13,8 @@
#include "SkTraceEvent.h"
#include "Test.h"
DEFINE_bool(slowTracingTest, false, "Artificially slow down tracing test to produce nicer JSON");
static DEFINE_bool(slowTracingTest, false,
"Artificially slow down tracing test to produce nicer JSON");
namespace {

View File

@ -25,14 +25,14 @@
using namespace skiatest;
using namespace sk_gpu_test;
DEFINE_bool2(dumpOp, d, false, "dump the pathOps to a file to recover mid-crash.");
DEFINE_bool2(extendedTest, x, false, "run extended tests for pathOps.");
DEFINE_bool2(runFail, f, false, "check for success on tests known to fail.");
DEFINE_bool2(verifyOp, y, false, "compare the pathOps result against a region.");
DEFINE_string2(json, J, "", "write json version of tests.");
static DEFINE_bool2(dumpOp, d, false, "dump the pathOps to a file to recover mid-crash.");
static DEFINE_bool2(extendedTest, x, false, "run extended tests for pathOps.");
static DEFINE_bool2(runFail, f, false, "check for success on tests known to fail.");
static DEFINE_bool2(verifyOp, y, false, "compare the pathOps result against a region.");
static DEFINE_string2(json, J, "", "write json version of tests.");
#if DEBUG_COIN
DEFINE_bool2(coinTest, c, false, "detect unused coincidence algorithms.");
static DEFINE_bool2(coinTest, c, false, "detect unused coincidence algorithms.");
#endif
// need to explicitly declare this, or we get some weird infinite loop llist

View File

@ -13,26 +13,26 @@
#include "includeWriter.h"
#include "selfCheck.h"
DEFINE_string2(status, a, "", "File containing status of documentation. (Use in place of -b -i)");
DEFINE_string2(bmh, b, "", "Path to a *.bmh file or a directory.");
DEFINE_bool2(catalog, c, false, "Write example catalog.htm. (Requires -b -f -r)");
DEFINE_string2(examples, e, "", "File of fiddlecli input, usually fiddle.json (For now, disables -r -f -s)");
DEFINE_bool2(extract, E, false, "Extract examples into fiddle.json");
DEFINE_string2(fiddle, f, "", "File of fiddlecli output, usually fiddleout.json.");
DEFINE_bool2(hack, H, false, "Do a find/replace hack to update all *.bmh files. (Requires -b)");
static DEFINE_string2(status, a, "", "File containing status of documentation. (Use in place of -b -i)");
static DEFINE_string2(bmh, b, "", "Path to a *.bmh file or a directory.");
static DEFINE_bool2(catalog, c, false, "Write example catalog.htm. (Requires -b -f -r)");
static DEFINE_string2(examples, e, "", "File of fiddlecli input, usually fiddle.json (For now, disables -r -f -s)");
static DEFINE_bool2(extract, E, false, "Extract examples into fiddle.json");
static DEFINE_string2(fiddle, f, "", "File of fiddlecli output, usually fiddleout.json.");
static DEFINE_bool2(hack, H, false, "Do a find/replace hack to update all *.bmh files. (Requires -b)");
// h is reserved for help
DEFINE_string2(include, i, "", "Path to a *.h file or a directory.");
DEFINE_bool2(selfcheck, k, false, "Check bmh against itself. (Requires -b)");
DEFINE_bool2(stdout, o, false, "Write file out to standard out.");
DEFINE_bool2(populate, p, false, "Populate include from bmh. (Requires -b -i)");
static DEFINE_string2(include, i, "", "Path to a *.h file or a directory.");
static DEFINE_bool2(selfcheck, k, false, "Check bmh against itself. (Requires -b)");
static DEFINE_bool2(stdout, o, false, "Write file out to standard out.");
static DEFINE_bool2(populate, p, false, "Populate include from bmh. (Requires -b -i)");
// q is reserved for quiet
DEFINE_string2(ref, r, "", "Resolve refs and write *.md files to path. (Requires -b -f)");
DEFINE_string2(spellcheck, s, "", "Spell-check [once, all, mispelling]. (Requires -b)");
DEFINE_bool2(tokens, t, false, "Write bmh from include. (Requires -i)");
DEFINE_bool2(crosscheck, x, false, "Check bmh against includes. (Requires -b -i)");
static DEFINE_string2(ref, r, "", "Resolve refs and write *.md files to path. (Requires -b -f)");
static DEFINE_string2(spellcheck, s, "", "Spell-check [once, all, mispelling]. (Requires -b)");
static DEFINE_bool2(tokens, t, false, "Write bmh from include. (Requires -i)");
static DEFINE_bool2(crosscheck, x, false, "Check bmh against includes. (Requires -b -i)");
// v is reserved for verbose
DEFINE_bool2(validate, V, false, "Validate that all anchor references have definitions. (Requires -r)");
DEFINE_bool2(skip, z, false, "Skip degenerate missed in legacy preprocessor.");
static DEFINE_bool2(validate, V, false, "Validate that all anchor references have definitions. (Requires -r)");
static DEFINE_bool2(skip, z, false, "Skip degenerate missed in legacy preprocessor.");
// -b docs -i include/core/SkRect.h -f fiddleout.json -r site/user/api
// -b docs/SkIRect_Reference.bmh -H

View File

@ -17,13 +17,14 @@
#include <stdio.h>
DEFINE_string2(skps, r, "", ".SKPs to dump.");
DEFINE_string(match, "", "The usual filters on file names to dump.");
DEFINE_bool2(optimize, O, false, "Run SkRecordOptimize before dumping.");
DEFINE_bool(optimize2, false, "Run SkRecordOptimize2 before dumping.");
DEFINE_int32(tile, 1000000000, "Simulated tile size.");
DEFINE_bool(timeWithCommand, false, "If true, print time next to command, else in first column.");
DEFINE_string2(write, w, "", "Write the (optimized) picture to the named file.");
static DEFINE_string2(skps, r, "", ".SKPs to dump.");
static DEFINE_string(match, "", "The usual filters on file names to dump.");
static DEFINE_bool2(optimize, O, false, "Run SkRecordOptimize before dumping.");
static DEFINE_bool(optimize2, false, "Run SkRecordOptimize2 before dumping.");
static DEFINE_int32(tile, 1000000000, "Simulated tile size.");
static DEFINE_bool(timeWithCommand, false,
"If true, print time next to command, else in first column.");
static DEFINE_string2(write, w, "", "Write the (optimized) picture to the named file.");
static void dump(const char* name, int w, int h, const SkRecord& record) {
SkBitmap bitmap;

View File

@ -17,8 +17,10 @@
#include "fiddle_main.h"
DEFINE_double(duration, 1.0, "The total duration, in seconds, of the animation we are drawing.");
DEFINE_double(frame, 1.0, "A double value in [0, 1] that specifies the point in animation to draw.");
static DEFINE_double(duration, 1.0,
"The total duration, in seconds, of the animation we are drawing.");
static DEFINE_double(frame, 1.0,
"A double value in [0, 1] that specifies the point in animation to draw.");
#include "GrBackendSurface.h"
#include "GrContextPriv.h"

View File

@ -22,14 +22,15 @@
#include <iostream>
#include <map>
DEFINE_string2(skps, s, "skps", "A path to a directory of skps or a single skp.");
DEFINE_string2(out, o, "img-out", "A path to an output directory.");
DEFINE_bool(testDecode, false, "Indicates if we want to test that the images decode successfully.");
DEFINE_bool(writeImages, true,
"Indicates if we want to write out supported/decoded images.");
DEFINE_bool(writeFailedImages, false,
"Indicates if we want to write out unsupported/failed to decode images.");
DEFINE_string2(failuresJsonPath, j, "",
static DEFINE_string2(skps, s, "skps", "A path to a directory of skps or a single skp.");
static DEFINE_string2(out, o, "img-out", "A path to an output directory.");
static DEFINE_bool(testDecode, false,
"Indicates if we want to test that the images decode successfully.");
static DEFINE_bool(writeImages, true,
"Indicates if we want to write out supported/decoded images.");
static DEFINE_bool(writeFailedImages, false,
"Indicates if we want to write out unsupported/failed to decode images.");
static DEFINE_string2(failuresJsonPath, j, "",
"Dump SKP and count of unknown images to the specified JSON file. Will not be "
"written anywhere if empty.");

View File

@ -15,8 +15,8 @@
#include "SkString.h"
#include "SkSurface.h"
DEFINE_string2(outFile, o, "skhello", "The filename to write the image.");
DEFINE_string2(text, t, "Hello", "The string to write.");
static DEFINE_string2(outFile, o, "skhello", "The filename to write the image.");
static DEFINE_string2(text, t, "Hello", "The string to write.");
static void doDraw(SkCanvas* canvas, const SkPaint& paint, const char text[]) {
SkRect bounds = canvas->getLocalClipBounds();

View File

@ -15,7 +15,7 @@
#include "microhttpd.h"
DEFINE_string(source, "https://debugger-assets.skia.org", "Where to load the web UI from.");
static DEFINE_string(source, "https://debugger-assets.skia.org", "Where to load the web UI from.");
static SkString generate_template(SkString source) {
SkString debuggerTemplate;

View File

@ -24,9 +24,9 @@
using namespace Response;
DEFINE_int32(port, 8888, "The port to listen on.");
DEFINE_string(address, "127.0.0.1", "The address to bind to.");
DEFINE_bool(hosted, false, "Running in hosted mode on debugger.skia.org.");
static DEFINE_int32(port, 8888, "The port to listen on.");
static DEFINE_string(address, "127.0.0.1", "The address to bind to.");
static DEFINE_bool(hosted, false, "Running in hosted mode on debugger.skia.org.");
class UrlManager {
public:

View File

@ -54,19 +54,21 @@
* Currently, only GPU configs are supported.
*/
DEFINE_bool(ddl, false, "record the skp into DDLs before rendering");
DEFINE_int32(ddlNumAdditionalThreads, 0, "number of DDL recording threads in addition to main one");
DEFINE_int32(ddlTilingWidthHeight, 0, "number of tiles along one edge when in DDL mode");
DEFINE_bool(ddlRecordTime, false, "report just the cpu time spent recording DDLs");
static DEFINE_bool(ddl, false, "record the skp into DDLs before rendering");
static DEFINE_int32(ddlNumAdditionalThreads, 0,
"number of DDL recording threads in addition to main one");
static DEFINE_int32(ddlTilingWidthHeight, 0, "number of tiles along one edge when in DDL mode");
static DEFINE_bool(ddlRecordTime, false, "report just the cpu time spent recording DDLs");
DEFINE_int32(duration, 5000, "number of milliseconds to run the benchmark");
DEFINE_int32(sampleMs, 50, "minimum duration of a sample");
DEFINE_bool(gpuClock, false, "time on the gpu clock (gpu work only)");
DEFINE_bool(fps, false, "use fps instead of ms");
DEFINE_string(src, "", "path to a single .skp or .svg file, or 'warmup' for a builtin warmup run");
DEFINE_string(png, "", "if set, save a .png proof to disk at this file location");
DEFINE_int32(verbosity, 4, "level of verbosity (0=none to 5=debug)");
DEFINE_bool(suppressHeader, false, "don't print a header row before the results");
static DEFINE_int32(duration, 5000, "number of milliseconds to run the benchmark");
static DEFINE_int32(sampleMs, 50, "minimum duration of a sample");
static DEFINE_bool(gpuClock, false, "time on the gpu clock (gpu work only)");
static DEFINE_bool(fps, false, "use fps instead of ms");
static DEFINE_string(src, "",
"path to a single .skp or .svg file, or 'warmup' for a builtin warmup run");
static DEFINE_string(png, "", "if set, save a .png proof to disk at this file location");
static DEFINE_int32(verbosity, 4, "level of verbosity (0=none to 5=debug)");
static DEFINE_bool(suppressHeader, false, "don't print a header row before the results");
static const char* header =
" accum median max min stddev samples sample_ms clock metric config bench";

View File

@ -13,12 +13,12 @@
#include "SkStream.h"
#include "SkTo.h"
DEFINE_string2(input, i, "", "skp on which to report");
DEFINE_bool2(version, v, true, "version");
DEFINE_bool2(cullRect, c, true, "cullRect");
DEFINE_bool2(flags, f, true, "flags");
DEFINE_bool2(tags, t, true, "tags");
DEFINE_bool2(quiet, q, false, "quiet");
static DEFINE_string2(input, i, "", "skp on which to report");
static DEFINE_bool2(version, v, true, "version");
static DEFINE_bool2(cullRect, c, true, "cullRect");
static DEFINE_bool2(flags, f, true, "flags");
static DEFINE_bool2(tags, t, true, "tags");
static DEFINE_bool2(quiet, q, false, "quiet");
// This tool can print simple information about an SKP but its main use
// is just to check if an SKP has been truncated during the recording

View File

@ -14,7 +14,7 @@
#include "SkEventTracer.h"
#include "SkTraceEvent.h"
DEFINE_string(trace,
static DEFINE_string(trace,
"",
"Log trace events in one of several modes:\n"
" debugf : Show events using SkDebugf\n"
@ -23,7 +23,7 @@ DEFINE_string(trace,
" trace events to specified file as JSON, for viewing\n"
" with chrome://tracing");
DEFINE_string(traceMatch,
static DEFINE_string(traceMatch,
"",
"Filter which categories are traced.\n"
"Uses same format as --match\n");

View File

@ -76,11 +76,11 @@ static DEFINE_string2(backend, b, "sw", "Backend to use. Allowed values are " BA
static DEFINE_int32(msaa, 1, "Number of subpixel samples. 0 for no HW antialiasing.");
DEFINE_string(bisect, "", "Path to a .skp or .svg file to bisect.");
static DEFINE_string(bisect, "", "Path to a .skp or .svg file to bisect.");
DECLARE_int32(threads)
DEFINE_string2(file, f, "", "Open a single file for viewing.");
static DEFINE_string2(file, f, "", "Open a single file for viewing.");
const char* kBackendTypeStrings[sk_app::Window::kBackendTypeCount] = {
"OpenGL",