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