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 "SkForceLinking.h" | 10 #include "SkForceLinking.h" |
11 #include "SkGraphics.h" | 11 #include "SkGraphics.h" |
12 #include "SkImageEncoder.h" | 12 #include "SkImageEncoder.h" |
13 #include "SkOSFile.h" | 13 #include "SkOSFile.h" |
14 #include "SkPicture.h" | 14 #include "SkPicture.h" |
15 #include "SkPixelRef.h" | 15 #include "SkPixelRef.h" |
16 #include "SkStream.h" | 16 #include "SkStream.h" |
17 #include "SkTArray.h" | 17 #include "SkTArray.h" |
18 #include "PdfRenderer.h" | 18 #include "PdfRenderer.h" |
19 #include "picture_utils.h" | 19 #include "picture_utils.h" |
20 #include "LazyDecodeBitmap.h" | |
21 | 20 |
22 __SK_FORCE_IMAGE_DECODER_LINKING; | 21 __SK_FORCE_IMAGE_DECODER_LINKING; |
23 | 22 |
24 #ifdef SK_USE_CDB | 23 #ifdef SK_USE_CDB |
25 #include "win_dbghelp.h" | 24 #include "win_dbghelp.h" |
26 #endif | 25 #endif |
27 | 26 |
28 /** | 27 /** |
29 * render_pdfs | 28 * render_pdfs |
30 * | 29 * |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 sk_tools::PdfRenderer& renderer) { | 151 sk_tools::PdfRenderer& renderer) { |
153 SkString inputFilename = SkOSPath::Basename(inputPath.c_str()); | 152 SkString inputFilename = SkOSPath::Basename(inputPath.c_str()); |
154 | 153 |
155 SkFILEStream inputStream; | 154 SkFILEStream inputStream; |
156 inputStream.setPath(inputPath.c_str()); | 155 inputStream.setPath(inputPath.c_str()); |
157 if (!inputStream.isValid()) { | 156 if (!inputStream.isValid()) { |
158 SkDebugf("Could not open file %s\n", inputPath.c_str()); | 157 SkDebugf("Could not open file %s\n", inputPath.c_str()); |
159 return false; | 158 return false; |
160 } | 159 } |
161 | 160 |
162 SkAutoTUnref<SkPicture> picture( | 161 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream)); |
163 SkPicture::CreateFromStream( | |
164 &inputStream, &sk_tools::LazyDecodeBitmap)); | |
165 | 162 |
166 if (NULL == picture.get()) { | 163 if (NULL == picture.get()) { |
167 SkDebugf("Could not read an SkPicture from %s\n", inputPath.c_str()); | 164 SkDebugf("Could not read an SkPicture from %s\n", inputPath.c_str()); |
168 return false; | 165 return false; |
169 } | 166 } |
170 | 167 |
171 SkDebugf("exporting... [%i %i] %s\n", picture->width(), picture->height(), | 168 SkDebugf("exporting... [%i %i] %s\n", picture->width(), picture->height(), |
172 inputPath.c_str()); | 169 inputPath.c_str()); |
173 | 170 |
174 SkWStream* stream(open_stream(outputDir, inputFilename)); | 171 SkWStream* stream(open_stream(outputDir, inputFilename)); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 293 } |
297 #endif | 294 #endif |
298 return 0; | 295 return 0; |
299 } | 296 } |
300 | 297 |
301 #if !defined SK_BUILD_FOR_IOS | 298 #if !defined SK_BUILD_FOR_IOS |
302 int main(int argc, char * const argv[]) { | 299 int main(int argc, char * const argv[]) { |
303 return tool_main(argc, (char**) argv); | 300 return tool_main(argc, (char**) argv); |
304 } | 301 } |
305 #endif | 302 #endif |
OLD | NEW |