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

Side by Side Diff: tools/skimage_main.cpp

Issue 14672017: Use separate subset directories in skimage. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 2011 Google Inc. 2 * Copyright 2011 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 "gm_expectations.h" 8 #include "gm_expectations.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkBitmapHasher.h" 10 #include "SkBitmapHasher.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 if (compare_to_expectations_if_necessary(bitmapFromDecodeSub set, 292 if (compare_to_expectations_if_necessary(bitmapFromDecodeSub set,
293 subsetName.c_str(), 293 subsetName.c_str(),
294 &gFailedSubsetDecod es)) { 294 &gFailedSubsetDecod es)) {
295 gSuccessfulSubsetDecodes.push_back().printf("Decoded sub set %s from %s", 295 gSuccessfulSubsetDecodes.push_back().printf("Decoded sub set %s from %s",
296 subsetDim.c_str(), srcPath); 296 subsetDim.c_str(), srcPath);
297 } 297 }
298 298
299 write_expectations(bitmapFromDecodeSubset, subsetName.c_str( )); 299 write_expectations(bitmapFromDecodeSubset, subsetName.c_str( ));
300 300
301 if (writePath != NULL) { 301 if (writePath != NULL) {
302 // Write the region to a file whose name includes the di mensions. 302 // Create a subdirectory to hold the results of decodeSu bset.
303 SkString suffix = SkStringPrintf("_%s.png", subsetDim.c_ str()); 303 SkString dir(*writePath);
304 SkString outPath; 304 dir.appendf("%s%c", "subsets", SkPATH_SEPARATOR);
305 make_outname(&outPath, writePath->c_str(), srcPath, suff ix.c_str()); 305 if (sk_mkdir(dir.c_str())) {
epoger 2013/05/09 17:45:40 What happens if the mkdir fails? Does it pretend
scroggo 2013/05/13 17:34:12 Now it will provide an error.
306 SkDEBUGCODE(bool success =) 306 // Write the subset to a file whose name includes th e dimensions.
307 write_bitmap(outPath.c_str(), &bitmapFromDecodeSubset); 307 SkString suffix = SkStringPrintf("_%s.png", subsetDi m.c_str());
308 SkASSERT(success); 308 SkString outPath;
309 gSuccessfulSubsetDecodes.push_back().printf("\twrote %s" , outPath.c_str()); 309 make_outname(&outPath, dir.c_str(), srcPath, suffix. c_str());
310 // Also use extractSubset from the original for visual c omparison. 310 SkDEBUGCODE(bool success =)
311 SkBitmap extractedSubset; 311 write_bitmap(outPath.c_str(), &bitmapFromDecodeSubse t);
epoger 2013/05/09 17:45:40 Instead of the 3 lines, I think you can do it like
scroggo 2013/05/13 17:34:12 Done.
312 if (bitmap.extractSubset(&extractedSubset, rect)) {
313 suffix.printf("_%s_extracted.png", subsetDim.c_str() );
314 make_outname(&outPath, writePath->c_str(), srcPath, suffix.c_str());
315 SkDEBUGCODE(success =) write_bitmap(outPath.c_str(), &extractedSubset);
316 SkASSERT(success); 312 SkASSERT(success);
313 gSuccessfulSubsetDecodes.push_back().printf("\twrote %s",
314 outPath. c_str());
315 // Also use extractSubset from the original for visu al comparison.
316 // Write the result to a file in a separate subdirec tory.
317 SkBitmap extractedSubset;
318 if (bitmap.extractSubset(&extractedSubset, rect)) {
319 SkString dirExtracted(*writePath);
320 dirExtracted.appendf("%s%c", "extracted", SkPATH _SEPARATOR);
321 if (sk_mkdir(dirExtracted.c_str())) {
322 make_outname(&outPath, dirExtracted.c_str(), srcPath,
323 suffix.c_str());
324 SkDEBUGCODE(success =)
325 write_bitmap(outPath.c_str(), &extractedSubs et);
326 SkASSERT(success);
327 }
328 }
317 } 329 }
318 } 330 }
319 } else { 331 } else {
320 gFailedSubsetDecodes.push_back().printf("Failed to decode re gion %s from %s\n", 332 gFailedSubsetDecodes.push_back().printf("Failed to decode re gion %s from %s\n",
321 subsetDim.c_str(), s rcPath); 333 subsetDim.c_str(), s rcPath);
322 } 334 }
323 } 335 }
324 } 336 }
325 } 337 }
326 if (FLAGS_reencode) { 338 if (FLAGS_reencode) {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 } 517 }
506 518
507 return failed ? -1 : 0; 519 return failed ? -1 : 0;
508 } 520 }
509 521
510 #if !defined SK_BUILD_FOR_IOS 522 #if !defined SK_BUILD_FOR_IOS
511 int main(int argc, char * const argv[]) { 523 int main(int argc, char * const argv[]) {
512 return tool_main(argc, (char**) argv); 524 return tool_main(argc, (char**) argv);
513 } 525 }
514 #endif 526 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698