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 "SkDevice.h" | 9 #include "SkDevice.h" |
10 #include "SkGraphics.h" | 10 #include "SkGraphics.h" |
11 #include "SkImageDecoder.h" | 11 #include "SkImageDecoder.h" |
12 #include "SkOSFile.h" | 12 #include "SkOSFile.h" |
13 #include "SkPicture.h" | 13 #include "SkPicture.h" |
14 #include "SkStream.h" | 14 #include "SkStream.h" |
15 #include "SkTArray.h" | 15 #include "SkTArray.h" |
16 #include "PdfRenderer.h" | 16 #include "PdfRenderer.h" |
17 #include "picture_utils.h" | 17 #include "picture_utils.h" |
18 | 18 |
| 19 #ifdef SK_USE_CDB |
| 20 #include "win_dbghelp.h" |
| 21 #endif |
| 22 |
19 /** | 23 /** |
20 * render_pdfs | 24 * render_pdfs |
21 * | 25 * |
22 * Given list of directories and files to use as input, expects to find .skp | 26 * Given list of directories and files to use as input, expects to find .skp |
23 * files and it will convert them to .pdf files writing them in the output | 27 * files and it will convert them to .pdf files writing them in the output |
24 * directory. | 28 * directory. |
25 * | 29 * |
26 * Returns zero exit code if all .skp files were converted successfully, | 30 * Returns zero exit code if all .skp files were converted successfully, |
27 * otherwise returns error code 1. | 31 * otherwise returns error code 1. |
28 */ | 32 */ |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 inputs->push_back(SkString(*argv)); | 204 inputs->push_back(SkString(*argv)); |
201 } | 205 } |
202 } | 206 } |
203 | 207 |
204 if (inputs->count() < 1) { | 208 if (inputs->count() < 1) { |
205 usage(argv0); | 209 usage(argv0); |
206 exit(-1); | 210 exit(-1); |
207 } | 211 } |
208 } | 212 } |
209 | 213 |
210 int tool_main(int argc, char** argv); | 214 int tool_main_core(int argc, char** argv); |
211 int tool_main(int argc, char** argv) { | 215 int tool_main_core(int argc, char** argv) { |
212 | |
213 SkAutoGraphics ag; | 216 SkAutoGraphics ag; |
214 SkTArray<SkString> inputs; | 217 SkTArray<SkString> inputs; |
215 | 218 |
216 SkAutoTUnref<sk_tools::PdfRenderer> | 219 SkAutoTUnref<sk_tools::PdfRenderer> |
217 renderer(SkNEW(sk_tools::SimplePdfRenderer)); | 220 renderer(SkNEW(sk_tools::SimplePdfRenderer)); |
218 SkASSERT(renderer.get()); | 221 SkASSERT(renderer.get()); |
219 | 222 |
220 SkString outputDir; | 223 SkString outputDir; |
221 parse_commandline(argc, argv, &inputs, &outputDir); | 224 parse_commandline(argc, argv, &inputs, &outputDir); |
222 | 225 |
223 int failures = 0; | 226 int failures = 0; |
224 for (int i = 0; i < inputs.count(); i ++) { | 227 for (int i = 0; i < inputs.count(); i ++) { |
225 failures += process_input(inputs[i], outputDir, *renderer); | 228 failures += process_input(inputs[i], outputDir, *renderer); |
226 } | 229 } |
227 | 230 |
228 if (failures != 0) { | 231 if (failures != 0) { |
229 SkDebugf("Failed to render %i PDFs.\n", failures); | 232 SkDebugf("Failed to render %i PDFs.\n", failures); |
230 return 1; | 233 return 1; |
231 } | 234 } |
| 235 |
| 236 return 0; |
| 237 } |
| 238 |
| 239 int tool_main(int argc, char** argv); |
| 240 int tool_main(int argc, char** argv) { |
| 241 #ifdef SK_USE_CDB |
| 242 setUpDebuggingFromArgs(argv[0]); |
| 243 __try { |
| 244 #endif |
| 245 return tool_main_core(argc, argv); |
| 246 #ifdef SK_USE_CDB |
| 247 } |
| 248 __except(GenerateDumpAndPrintCallstack(GetExceptionInformation())) |
| 249 { |
| 250 return -1; |
| 251 } |
| 252 #endif |
232 return 0; | 253 return 0; |
233 } | 254 } |
234 | 255 |
235 #if !defined SK_BUILD_FOR_IOS | 256 #if !defined SK_BUILD_FOR_IOS |
236 int main(int argc, char * const argv[]) { | 257 int main(int argc, char * const argv[]) { |
237 return tool_main(argc, (char**) argv); | 258 return tool_main(argc, (char**) argv); |
238 } | 259 } |
239 #endif | 260 #endif |
OLD | NEW |