OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "LazyDecodeBitmap.h" | 8 #include "LazyDecodeBitmap.h" |
9 #include "SkCommandLineFlags.h" | 9 #include "SkCommandLineFlags.h" |
10 #include "SkPicture.h" | 10 #include "SkPicture.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(&stream, &sk_tools::
LazyDecodeBitmap)); | 40 SkAutoTUnref<SkPicture> pic(SkPicture::CreateFromStream(&stream, &sk_tools::
LazyDecodeBitmap)); |
41 if (!SkToBool(pic.get())) { | 41 if (!SkToBool(pic.get())) { |
42 SkDebugf("Could not load SKP: %s\n", FLAGS_input[0]); | 42 SkDebugf("Could not load SKP: %s\n", FLAGS_input[0]); |
43 return kNotAnSKP; | 43 return kNotAnSKP; |
44 } | 44 } |
45 | 45 |
46 SkAutoTDelete<SkWStream> outStream; | 46 SkAutoTDelete<SkWStream> outStream; |
47 if (FLAGS_output.count() > 0) { | 47 if (FLAGS_output.count() > 0) { |
48 SkFILEWStream* fileStream = SkNEW_ARGS(SkFILEWStream, (FLAGS_output[0]))
; | 48 SkFILEWStream* fileStream = new SkFILEWStream(FLAGS_output[0]); |
49 if (!fileStream->isValid()) { | 49 if (!fileStream->isValid()) { |
50 SkDebugf("Couldn't open output file for writing: %s\n", FLAGS_output
[0]); | 50 SkDebugf("Couldn't open output file for writing: %s\n", FLAGS_output
[0]); |
51 return kIOError; | 51 return kIOError; |
52 } | 52 } |
53 outStream.reset(fileStream); | 53 outStream.reset(fileStream); |
54 } else { | 54 } else { |
55 outStream.reset(SkNEW(SkDebugWStream)); | 55 outStream.reset(new SkDebugWStream); |
56 } | 56 } |
57 | 57 |
58 SkAutoTDelete<SkXMLWriter> xmlWriter(SkNEW_ARGS(SkXMLStreamWriter, (outStrea
m.get()))); | 58 SkAutoTDelete<SkXMLWriter> xmlWriter(new SkXMLStreamWriter(outStream.get()))
; |
59 SkAutoTUnref<SkCanvas> svgCanvas(SkSVGCanvas::Create(pic->cullRect(), xmlWri
ter.get())); | 59 SkAutoTUnref<SkCanvas> svgCanvas(SkSVGCanvas::Create(pic->cullRect(), xmlWri
ter.get())); |
60 | 60 |
61 pic->playback(svgCanvas); | 61 pic->playback(svgCanvas); |
62 | 62 |
63 return kSuccess; | 63 return kSuccess; |
64 } | 64 } |
65 | 65 |
66 #if !defined SK_BUILD_FOR_IOS | 66 #if !defined SK_BUILD_FOR_IOS |
67 int main(int argc, char * const argv[]) { | 67 int main(int argc, char * const argv[]) { |
68 return tool_main(argc, (char**) argv); | 68 return tool_main(argc, (char**) argv); |
69 } | 69 } |
70 #endif | 70 #endif |
OLD | NEW |