Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: tools/render_pdfs_main.cpp

Issue 327403002: Cleanup: Delete sk_tools::make_filepath() in favor of SkOSPath::SkPathJoin(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixes Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/picture_utils.cpp ('k') | tools/render_pictures_main.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 /** Builds the output filename. path = dir/name, and it replaces expected 105 /** Builds the output filename. path = dir/name, and it replaces expected
106 * .skp extension with .pdf extention. 106 * .skp extension with .pdf extention.
107 * @param path Output filename. 107 * @param path Output filename.
108 * @param name The name of the file. 108 * @param name The name of the file.
109 * @returns false if the file did not has the expected extension. 109 * @returns false if the file did not has the expected extension.
110 * if false is returned, contents of path are undefined. 110 * if false is returned, contents of path are undefined.
111 */ 111 */
112 static bool make_output_filepath(SkString* path, const SkString& dir, 112 static bool make_output_filepath(SkString* path, const SkString& dir,
113 const SkString& name) { 113 const SkString& name) {
114 sk_tools::make_filepath(path, dir, name); 114 *path = SkOSPath::SkPathJoin(dir.c_str(), name.c_str());
115 return replace_filename_extension(path, 115 return replace_filename_extension(path,
116 SKP_FILE_EXTENSION, 116 SKP_FILE_EXTENSION,
117 PDF_FILE_EXTENSION); 117 PDF_FILE_EXTENSION);
118 } 118 }
119 119
120 /** Write the output of pdf renderer to a file. 120 /** Write the output of pdf renderer to a file.
121 * @param outputDir Output dir. 121 * @param outputDir Output dir.
122 * @param inputFilename The skp file that was read. 122 * @param inputFilename The skp file that was read.
123 * @param renderer The object responsible to write the pdf file. 123 * @param renderer The object responsible to write the pdf file.
124 */ 124 */
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 * @param outputDir Output dir. 190 * @param outputDir Output dir.
191 * @param renderer The object responsible to render the skp object into pdf. 191 * @param renderer The object responsible to render the skp object into pdf.
192 */ 192 */
193 static int process_input(const SkString& input, const SkString& outputDir, 193 static int process_input(const SkString& input, const SkString& outputDir,
194 sk_tools::PdfRenderer& renderer) { 194 sk_tools::PdfRenderer& renderer) {
195 int failures = 0; 195 int failures = 0;
196 if (sk_isdir(input.c_str())) { 196 if (sk_isdir(input.c_str())) {
197 SkOSFile::Iter iter(input.c_str(), SKP_FILE_EXTENSION); 197 SkOSFile::Iter iter(input.c_str(), SKP_FILE_EXTENSION);
198 SkString inputFilename; 198 SkString inputFilename;
199 while (iter.next(&inputFilename)) { 199 while (iter.next(&inputFilename)) {
200 SkString inputPath; 200 SkString inputPath = SkOSPath::SkPathJoin(input.c_str(), inputFilena me.c_str());
201 sk_tools::make_filepath(&inputPath, input, inputFilename);
202 if (!render_pdf(inputPath, outputDir, renderer)) { 201 if (!render_pdf(inputPath, outputDir, renderer)) {
203 ++failures; 202 ++failures;
204 } 203 }
205 } 204 }
206 } else { 205 } else {
207 SkString inputPath(input); 206 SkString inputPath(input);
208 if (!render_pdf(inputPath, outputDir, renderer)) { 207 if (!render_pdf(inputPath, outputDir, renderer)) {
209 ++failures; 208 ++failures;
210 } 209 }
211 } 210 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 293 }
295 #endif 294 #endif
296 return 0; 295 return 0;
297 } 296 }
298 297
299 #if !defined SK_BUILD_FOR_IOS 298 #if !defined SK_BUILD_FOR_IOS
300 int main(int argc, char * const argv[]) { 299 int main(int argc, char * const argv[]) {
301 return tool_main(argc, (char**) argv); 300 return tool_main(argc, (char**) argv);
302 } 301 }
303 #endif 302 #endif
OLDNEW
« no previous file with comments | « tools/picture_utils.cpp ('k') | tools/render_pictures_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698