Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: tools/flags/SkCommandLineFlags.cpp

Issue 1528473002: Revert of Add config options to run different GPU APIs to dm and nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@commandbuffer-as-api-03-context-factory-glcontext-type
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/flags/SkCommandLineFlags.h ('k') | tools/flags/SkCommonFlags.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/flags/SkCommandLineFlags.cpp
diff --git a/tools/flags/SkCommandLineFlags.cpp b/tools/flags/SkCommandLineFlags.cpp
index cddf9fb0b35cc5907f55740391f32bf774cab561..9b2c9616cbf4ebc0a70c4bfc33cc98910053bc4d 100644
--- a/tools/flags/SkCommandLineFlags.cpp
+++ b/tools/flags/SkCommandLineFlags.cpp
@@ -22,10 +22,8 @@
bool SkFlagInfo::CreateStringFlag(const char* name, const char* shortName,
SkCommandLineFlags::StringArray* pStrings,
- const char* defaultValue, const char* helpString,
- const char* extendedHelpString) {
- SkFlagInfo* info = new SkFlagInfo(name, shortName, kString_FlagType, helpString,
- extendedHelpString);
+ const char* defaultValue, const char* helpString) {
+ SkFlagInfo* info = new SkFlagInfo(name, shortName, kString_FlagType, helpString);
info->fDefaultString.set(defaultValue);
info->fStrings = pStrings;
@@ -153,16 +151,29 @@
// Maximum line length for the help message.
#define LINE_LENGTH 72
-static void print_indented(const SkString& text) {
- size_t length = text.size();
- const char* currLine = text.c_str();
+static void print_help_for_flag(const SkFlagInfo* flag) {
+ SkDebugf(" --%s", flag->name().c_str());
+ const SkString& shortName = flag->shortName();
+ if (shortName.size() > 0) {
+ SkDebugf(" or -%s", shortName.c_str());
+ }
+ SkDebugf(":\ttype: %s", flag->typeAsString().c_str());
+ if (flag->defaultValue().size() > 0) {
+ SkDebugf("\tdefault: %s", flag->defaultValue().c_str());
+ }
+ SkDebugf("\n");
+ const SkString& help = flag->help();
+ size_t length = help.size();
+ const char* currLine = help.c_str();
const char* stop = currLine + length;
while (currLine < stop) {
+ if (strlen(currLine) < LINE_LENGTH) {
+ // Only one line length's worth of text left.
+ SkDebugf(" %s\n", currLine);
+ break;
+ }
int lineBreak = SkStrFind(currLine, "\n");
- if (lineBreak < 0) {
- lineBreak = static_cast<int>(strlen(currLine));
- }
- if (lineBreak > LINE_LENGTH) {
+ if (lineBreak < 0 || lineBreak > LINE_LENGTH) {
// No line break within line length. Will need to insert one.
// Find a space before the line break.
int spaceIndex = LINE_LENGTH - 1;
@@ -187,26 +198,6 @@
currLine += lineBreak;
}
}
-}
-
-static void print_help_for_flag(const SkFlagInfo* flag) {
- SkDebugf(" --%s", flag->name().c_str());
- const SkString& shortName = flag->shortName();
- if (shortName.size() > 0) {
- SkDebugf(" or -%s", shortName.c_str());
- }
- SkDebugf(":\ttype: %s", flag->typeAsString().c_str());
- if (flag->defaultValue().size() > 0) {
- SkDebugf("\tdefault: %s", flag->defaultValue().c_str());
- }
- SkDebugf("\n");
- const SkString& help = flag->help();
- print_indented(help);
- SkDebugf("\n");
-}
-static void print_extended_help_for_flag(const SkFlagInfo* flag) {
- print_help_for_flag(flag);
- print_indented(flag->extendedHelp());
SkDebugf("\n");
}
@@ -257,10 +248,6 @@
CompareFlagsByName());
for (int i = 0; i < allFlags.count(); ++i) {
print_help_for_flag(allFlags[i]);
- if (allFlags[i]->extendedHelp().size() > 0) {
- SkDebugf(" Use '--help %s' for more information.\n",
- allFlags[i]->name().c_str());
- }
}
} else {
for (SkFlagInfo* flag = SkCommandLineFlags::gHead; flag;
@@ -268,7 +255,7 @@
for (int k = 0; k < helpFlags.count(); k++) {
if (flag->name().equals(helpFlags[k]) ||
flag->shortName().equals(helpFlags[k])) {
- print_extended_help_for_flag(flag);
+ print_help_for_flag(flag);
helpFlags.remove(k);
break;
}
« no previous file with comments | « tools/flags/SkCommandLineFlags.h ('k') | tools/flags/SkCommonFlags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698