| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkDocument.h" | 10 #include "SkDocument.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } // namespace | 108 } // namespace |
| 109 | 109 |
| 110 /** Write the output of pdf renderer to a file. | 110 /** Write the output of pdf renderer to a file. |
| 111 * @param outputDir Output dir. | 111 * @param outputDir Output dir. |
| 112 * @param inputFilename The skp file that was read. | 112 * @param inputFilename The skp file that was read. |
| 113 * @param renderer The object responsible to write the pdf file. | 113 * @param renderer The object responsible to write the pdf file. |
| 114 */ | 114 */ |
| 115 static SkWStream* open_stream(const SkString& outputDir, | 115 static SkWStream* open_stream(const SkString& outputDir, |
| 116 const SkString& inputFilename) { | 116 const SkString& inputFilename) { |
| 117 if (outputDir.isEmpty()) { | 117 if (outputDir.isEmpty()) { |
| 118 return SkNEW(NullWStream); | 118 return new NullWStream; |
| 119 } | 119 } |
| 120 | 120 |
| 121 SkString outputPath; | 121 SkString outputPath; |
| 122 if (!make_output_filepath(&outputPath, outputDir, inputFilename)) { | 122 if (!make_output_filepath(&outputPath, outputDir, inputFilename)) { |
| 123 return NULL; | 123 return NULL; |
| 124 } | 124 } |
| 125 | 125 |
| 126 SkAutoTDelete<SkFILEWStream> stream( | 126 SkAutoTDelete<SkFILEWStream> stream(new SkFILEWStream(outputPath.c_str())); |
| 127 SkNEW_ARGS(SkFILEWStream, (outputPath.c_str()))); | |
| 128 if (!stream.get() || !stream->isValid()) { | 127 if (!stream.get() || !stream->isValid()) { |
| 129 SkDebugf("Could not write to file %s\n", outputPath.c_str()); | 128 SkDebugf("Could not write to file %s\n", outputPath.c_str()); |
| 130 return NULL; | 129 return NULL; |
| 131 } | 130 } |
| 132 | 131 |
| 133 return stream.detach(); | 132 return stream.detach(); |
| 134 } | 133 } |
| 135 | 134 |
| 136 /** | 135 /** |
| 137 * Given a SkPicture, write a one-page PDF document to the given | 136 * Given a SkPicture, write a one-page PDF document to the given |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 return -1; | 272 return -1; |
| 274 } | 273 } |
| 275 #endif | 274 #endif |
| 276 return 0; | 275 return 0; |
| 277 } | 276 } |
| 278 #if !defined SK_BUILD_FOR_IOS | 277 #if !defined SK_BUILD_FOR_IOS |
| 279 int main(int argc, char * const argv[]) { | 278 int main(int argc, char * const argv[]) { |
| 280 return tool_main(argc, (char**) argv); | 279 return tool_main(argc, (char**) argv); |
| 281 } | 280 } |
| 282 #endif | 281 #endif |
| OLD | NEW |