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

Side by Side Diff: tools/SkFlags.cpp

Issue 12632015: Make gm use SkFlags. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: update command_line Created 7 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkFlags.h" 8 #include "SkFlags.h"
9 9
10 SkFlagInfo* SkFlags::gHead; 10 SkFlagInfo* SkFlags::gHead;
(...skipping 20 matching lines...) Expand all
31 bool helpPrinted = false; 31 bool helpPrinted = false;
32 // Loop over argv, starting with 1, since the first is just the name of the program. 32 // Loop over argv, starting with 1, since the first is just the name of the program.
33 for (int i = 1; i < argc; i++) { 33 for (int i = 1; i < argc; i++) {
34 if (0 == strcmp("-h", argv[i]) || 0 == strcmp("--h", argv[i]) 34 if (0 == strcmp("-h", argv[i]) || 0 == strcmp("--h", argv[i])
35 || 0 == strcmp("-help", argv[i]) || 0 == strcmp("--help", argv[i ])) { 35 || 0 == strcmp("-help", argv[i]) || 0 == strcmp("--help", argv[i ])) {
36 // Print help message. 36 // Print help message.
37 SkDebugf("%s\n%s\n", argv[0], gUsage.c_str()); 37 SkDebugf("%s\n%s\n", argv[0], gUsage.c_str());
38 SkDebugf("Flags:\n"); 38 SkDebugf("Flags:\n");
39 SkFlagInfo* flag = SkFlags::gHead; 39 SkFlagInfo* flag = SkFlags::gHead;
40 while (flag != NULL) { 40 while (flag != NULL) {
41 SkDebugf("\t--%s:\ttype: %s\tdefault: %s\n", flag->name().c_str( ), 41 SkDebugf("\t--%s:\ttype: %s", flag->name().c_str(),
42 flag->typeAsString().c_str(), flag->defaultValue().c_s tr()); 42 flag->typeAsString().c_str());
43 if (flag->defaultValue().size() > 0) {
44 SkDebugf("\tdefault: %s", flag->defaultValue().c_str());
45 }
46 SkDebugf("\n");
43 const SkString& help = flag->help(); 47 const SkString& help = flag->help();
44 size_t length = help.size(); 48 size_t length = help.size();
45 const char* currLine = help.c_str(); 49 const char* currLine = help.c_str();
46 const char* stop = currLine + length; 50 const char* stop = currLine + length;
47 while (currLine < stop) { 51 while (currLine < stop) {
48 if (strlen(currLine) < LINE_LENGTH) { 52 if (strlen(currLine) < LINE_LENGTH) {
49 // Only one line length's worth of text left. 53 // Only one line length's worth of text left.
50 SkDebugf("\t\t%s\n", currLine); 54 SkDebugf("\t\t%s\n", currLine);
51 break; 55 break;
52 } 56 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 gHead = NULL; 129 gHead = NULL;
126 while (flag != NULL) { 130 while (flag != NULL) {
127 SkFlagInfo* next = flag->next(); 131 SkFlagInfo* next = flag->next();
128 SkDELETE(flag); 132 SkDELETE(flag);
129 flag = next; 133 flag = next;
130 } 134 }
131 if (helpPrinted) { 135 if (helpPrinted) {
132 exit(0); 136 exit(0);
133 } 137 }
134 } 138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698