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

Side by Side Diff: tools/skhello.cpp

Issue 12521019: SkFlags now follows proper dashing convention. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 2011 Google Inc. 2 * Copyright 2011 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkCommandLineFlags.h" 9 #include "SkCommandLineFlags.h"
10 #include "SkGraphics.h" 10 #include "SkGraphics.h"
11 #include "SkImageEncoder.h" 11 #include "SkImageEncoder.h"
12 #include "SkString.h" 12 #include "SkString.h"
13 13
14 DEFINE_string(o, "skhello.png", "The filename to write the image."); 14 DEFINE_string2(outFile, o, "skhello.png", "The filename to write the image.");
15 DEFINE_string(t, "Hello", "The string to write."); 15 DEFINE_string2(text, t, "Hello", "The string to write.");
16 16
17 int tool_main(int argc, char** argv); 17 int tool_main(int argc, char** argv);
18 int tool_main(int argc, char** argv) { 18 int tool_main(int argc, char** argv) {
19 SkCommandLineFlags::SetUsage(""); 19 SkCommandLineFlags::SetUsage("");
20 SkCommandLineFlags::Parse(argc, argv); 20 SkCommandLineFlags::Parse(argc, argv);
21 21
22 SkAutoGraphics ag; 22 SkAutoGraphics ag;
23 SkString path("skhello.png"); 23 SkString path("skhello.png");
24 SkString text("Hello"); 24 SkString text("Hello");
25 25
26 if (!FLAGS_o.isEmpty()) { 26 if (!FLAGS_outFile.isEmpty()) {
27 path.set(FLAGS_o[0]); 27 path.set(FLAGS_outFile[0]);
28 } 28 }
29 if (!FLAGS_t.isEmpty()) { 29 if (!FLAGS_text.isEmpty()) {
30 text.set(FLAGS_t[0]); 30 text.set(FLAGS_text[0]);
31 } 31 }
32 32
33 SkPaint paint; 33 SkPaint paint;
34 paint.setAntiAlias(true); 34 paint.setAntiAlias(true);
35 paint.setTextSize(SkIntToScalar(30)); 35 paint.setTextSize(SkIntToScalar(30));
36 SkScalar width = paint.measureText(text.c_str(), text.size()); 36 SkScalar width = paint.measureText(text.c_str(), text.size());
37 SkScalar spacing = paint.getFontSpacing(); 37 SkScalar spacing = paint.getFontSpacing();
38 38
39 int w = SkScalarRound(width) + 30; 39 int w = SkScalarRound(width) + 30;
40 int h = SkScalarRound(spacing) + 30; 40 int h = SkScalarRound(spacing) + 30;
(...skipping 15 matching lines...) Expand all
56 SkDebugf("--- failed to write %s\n", path.c_str()); 56 SkDebugf("--- failed to write %s\n", path.c_str());
57 } 57 }
58 return !success; 58 return !success;
59 } 59 }
60 60
61 #if !defined SK_BUILD_FOR_IOS 61 #if !defined SK_BUILD_FOR_IOS
62 int main(int argc, char * const argv[]) { 62 int main(int argc, char * const argv[]) {
63 return tool_main(argc, (char**) argv); 63 return tool_main(argc, (char**) argv);
64 } 64 }
65 #endif 65 #endif
OLDNEW
« tools/flags/SkCommandLineFlags.h ('K') | « tools/render_pictures_main.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698