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

Side by Side Diff: src/svg/skp2svg.cpp

Issue 1416913003: Clean up some dead code. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: kill dump-record Created 5 years, 2 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
« no previous file with comments | « gyp/tools.gyp ('k') | tools/CopyTilesRenderer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "LazyDecodeBitmap.h"
9 #include "SkCommandLineFlags.h"
10 #include "SkPicture.h"
11 #include "SkStream.h"
12 #include "SkSVGCanvas.h"
13 #include "SkXMLWriter.h"
14
15 DEFINE_string2(input, i, "", "input skp file");
16 DEFINE_string2(output, o, "", "output svg file (optional)");
17
18 // return codes:
19 static const int kSuccess = 0;
20 static const int kInvalidArgs = 1;
21 static const int kIOError = 2;
22 static const int kNotAnSKP = 3;
23
24 int tool_main(int argc, char** argv);
25 int tool_main(int argc, char** argv) {
26 SkCommandLineFlags::SetUsage("Converts an SKP file to SVG.");
27 SkCommandLineFlags::Parse(argc, argv);
28
29 if (FLAGS_input.count() != 1) {
30 SkDebugf("Missing input file\n");
31 return kInvalidArgs;
32 }
33
34 SkFILEStream stream(FLAGS_input[0]);
35 if (!stream.isValid()) {
36 SkDebugf("Couldn't open file: %s\n", FLAGS_input[0]);
37 return kIOError;
38 }
39
40 SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(&stream, &sk_tools:: LazyDecodeBitmap));
41 if (!SkToBool(pic.get())) {
42 SkDebugf("Could not load SKP: %s\n", FLAGS_input[0]);
43 return kNotAnSKP;
44 }
45
46 SkAutoTDelete<SkWStream> outStream;
47 if (FLAGS_output.count() > 0) {
48 SkFILEWStream* fileStream = new SkFILEWStream(FLAGS_output[0]);
49 if (!fileStream->isValid()) {
50 SkDebugf("Couldn't open output file for writing: %s\n", FLAGS_output [0]);
51 return kIOError;
52 }
53 outStream.reset(fileStream);
54 } else {
55 outStream.reset(new SkDebugWStream);
56 }
57
58 SkAutoTDelete<SkXMLWriter> xmlWriter(new SkXMLStreamWriter(outStream.get())) ;
59 SkAutoTUnref<SkCanvas> svgCanvas(SkSVGCanvas::Create(pic->cullRect(), xmlWri ter.get()));
60
61 pic->playback(svgCanvas);
62
63 return kSuccess;
64 }
65
66 #if !defined SK_BUILD_FOR_IOS
67 int main(int argc, char * const argv[]) {
68 return tool_main(argc, (char**) argv);
69 }
70 #endif
OLDNEW
« no previous file with comments | « gyp/tools.gyp ('k') | tools/CopyTilesRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698