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

Side by Side Diff: tools/render_pictures_main.cpp

Issue 321693002: Cleanup: Delete sk_tools::get_basename() in favor of SkOSPath::SkBasename(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rm is_path_seperator() 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/render_pdfs_main.cpp ('k') | no next file » | 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 "LazyDecodeBitmap.h" 8 #include "LazyDecodeBitmap.h"
9 #include "CopyTilesRenderer.h" 9 #include "CopyTilesRenderer.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 136
137 //////////////////////////////////////////////////////////////////////////////// //////////////////// 137 //////////////////////////////////////////////////////////////////////////////// ////////////////////
138 138
139 /** 139 /**
140 * Called only by render_picture(). 140 * Called only by render_picture().
141 */ 141 */
142 static bool render_picture_internal(const SkString& inputPath, const SkString* w ritePath, 142 static bool render_picture_internal(const SkString& inputPath, const SkString* w ritePath,
143 const SkString* mismatchPath, 143 const SkString* mismatchPath,
144 sk_tools::PictureRenderer& renderer, 144 sk_tools::PictureRenderer& renderer,
145 SkBitmap** out) { 145 SkBitmap** out) {
146 SkString inputFilename; 146 SkString inputFilename = SkOSPath::SkBasename(inputPath.c_str());
147 sk_tools::get_basename(&inputFilename, inputPath);
148 SkString writePathString; 147 SkString writePathString;
149 if (NULL != writePath && writePath->size() > 0 && !FLAGS_writeEncodedImages) { 148 if (NULL != writePath && writePath->size() > 0 && !FLAGS_writeEncodedImages) {
150 writePathString.set(*writePath); 149 writePathString.set(*writePath);
151 } 150 }
152 SkString mismatchPathString; 151 SkString mismatchPathString;
153 if (NULL != mismatchPath && mismatchPath->size() > 0) { 152 if (NULL != mismatchPath && mismatchPath->size() > 0) {
154 mismatchPathString.set(*mismatchPath); 153 mismatchPathString.set(*mismatchPath);
155 } 154 }
156 155
157 SkFILEStream inputStream; 156 SkFILEStream inputStream;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 for (int i = 1; i <= 255; ++i) { 345 for (int i = 1; i <= 255; ++i) {
347 if(diffs[i] > 0) { 346 if(diffs[i] > 0) {
348 SkDebugf("Number of pixels with max diff of %i is %i\n", i, diff s[i]); 347 SkDebugf("Number of pixels with max diff of %i is %i\n", i, diff s[i]);
349 } 348 }
350 } 349 }
351 } 350 }
352 351
353 if (FLAGS_writeWholeImage) { 352 if (FLAGS_writeWholeImage) {
354 sk_tools::force_all_opaque(*bitmap); 353 sk_tools::force_all_opaque(*bitmap);
355 354
356 SkString inputFilename; 355 SkString inputFilename = SkOSPath::SkBasename(inputPath.c_str());
357 sk_tools::get_basename(&inputFilename, inputPath);
358 SkString outputFilename(inputFilename); 356 SkString outputFilename(inputFilename);
359 sk_tools::replace_char(&outputFilename, '.', '_'); 357 sk_tools::replace_char(&outputFilename, '.', '_');
360 outputFilename.append(".png"); 358 outputFilename.append(".png");
361 359
362 if (NULL != jsonSummaryPtr) { 360 if (NULL != jsonSummaryPtr) {
363 sk_tools::ImageDigest imageDigest(*bitmap); 361 sk_tools::ImageDigest imageDigest(*bitmap);
364 jsonSummaryPtr->add(inputFilename.c_str(), outputFilename.c_str(), i mageDigest); 362 jsonSummaryPtr->add(inputFilename.c_str(), outputFilename.c_str(), i mageDigest);
365 if ((NULL != mismatchPath) && !mismatchPath->isEmpty() && 363 if ((NULL != mismatchPath) && !mismatchPath->isEmpty() &&
366 !jsonSummaryPtr->matchesExpectation(inputFilename.c_str(), image Digest)) { 364 !jsonSummaryPtr->matchesExpectation(inputFilename.c_str(), image Digest)) {
367 success &= sk_tools::write_bitmap_to_disk(*bitmap, *mismatchPath , NULL, 365 success &= sk_tools::write_bitmap_to_disk(*bitmap, *mismatchPath , NULL,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 jsonSummary.writeToFile(FLAGS_writeJsonSummaryPath[0]); 496 jsonSummary.writeToFile(FLAGS_writeJsonSummaryPath[0]);
499 } 497 }
500 return 0; 498 return 0;
501 } 499 }
502 500
503 #if !defined SK_BUILD_FOR_IOS 501 #if !defined SK_BUILD_FOR_IOS
504 int main(int argc, char * const argv[]) { 502 int main(int argc, char * const argv[]) {
505 return tool_main(argc, (char**) argv); 503 return tool_main(argc, (char**) argv);
506 } 504 }
507 #endif 505 #endif
OLDNEW
« no previous file with comments | « tools/render_pdfs_main.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698