| 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" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 return stream; | 142 return stream; |
| 143 } | 143 } |
| 144 | 144 |
| 145 /** Reads an skp file, renders it to pdf and writes the output to a pdf file | 145 /** Reads an skp file, renders it to pdf and writes the output to a pdf file |
| 146 * @param inputPath The skp file to be read. | 146 * @param inputPath The skp file to be read. |
| 147 * @param outputDir Output dir. | 147 * @param outputDir Output dir. |
| 148 * @param renderer The object responsible to render the skp object into pdf. | 148 * @param renderer The object responsible to render the skp object into pdf. |
| 149 */ | 149 */ |
| 150 static bool render_pdf(const SkString& inputPath, const SkString& outputDir, | 150 static bool render_pdf(const SkString& inputPath, const SkString& outputDir, |
| 151 sk_tools::PdfRenderer& renderer) { | 151 sk_tools::PdfRenderer& renderer) { |
| 152 SkString inputFilename; | 152 SkString inputFilename = SkOSPath::SkBasename(inputPath.c_str()); |
| 153 sk_tools::get_basename(&inputFilename, inputPath); | |
| 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(SkPicture::CreateFromStream(&inputStream)); | 161 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream)); |
| 163 | 162 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 } | 294 } |
| 296 #endif | 295 #endif |
| 297 return 0; | 296 return 0; |
| 298 } | 297 } |
| 299 | 298 |
| 300 #if !defined SK_BUILD_FOR_IOS | 299 #if !defined SK_BUILD_FOR_IOS |
| 301 int main(int argc, char * const argv[]) { | 300 int main(int argc, char * const argv[]) { |
| 302 return tool_main(argc, (char**) argv); | 301 return tool_main(argc, (char**) argv); |
| 303 } | 302 } |
| 304 #endif | 303 #endif |
| OLD | NEW |