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

Side by Side Diff: tools/imagediff/image_diff.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | « tools/gn/trace.cc ('k') | ui/base/l10n/l10n_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file input format is based loosely on 5 // This file input format is based loosely on
6 // Tools/DumpRenderTree/ImageDiff.m 6 // Tools/DumpRenderTree/ImageDiff.m
7 7
8 // The exact format of this tool's output to stdout is important, to match 8 // The exact format of this tool's output to stdout is important, to match
9 // what the run-webkit-tests script expects. 9 // what the run-webkit-tests script expects.
10 10
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 377
378 Image diff_image; 378 Image diff_image;
379 bool same = CreateImageDiff(baseline_image, actual_image, &diff_image); 379 bool same = CreateImageDiff(baseline_image, actual_image, &diff_image);
380 if (same) 380 if (same)
381 return kStatusSame; 381 return kStatusSame;
382 382
383 std::vector<unsigned char> png_encoding; 383 std::vector<unsigned char> png_encoding;
384 image_diff_png::EncodeRGBAPNG( 384 image_diff_png::EncodeRGBAPNG(
385 diff_image.data(), diff_image.w(), diff_image.h(), 385 diff_image.data(), diff_image.w(), diff_image.h(),
386 diff_image.w() * 4, &png_encoding); 386 diff_image.w() * 4, &png_encoding);
387 if (file_util::WriteFile(out_file, 387 if (base::WriteFile(out_file,
388 reinterpret_cast<char*>(&png_encoding.front()), 388 reinterpret_cast<char*>(&png_encoding.front()),
389 base::checked_cast<int>(png_encoding.size())) < 0) 389 base::checked_cast<int>(png_encoding.size())) < 0)
390 return kStatusError; 390 return kStatusError;
391 391
392 return kStatusDifferent; 392 return kStatusDifferent;
393 } 393 }
394 394
395 // It isn't strictly correct to only support ASCII paths, but this 395 // It isn't strictly correct to only support ASCII paths, but this
396 // program reads paths on stdin and the program that spawns it outputs 396 // program reads paths on stdin and the program that spawns it outputs
397 // paths as non-wide strings anyway. 397 // paths as non-wide strings anyway.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 base::FilePath(args[2])); 440 base::FilePath(args[2]));
441 } 441 }
442 } else if (args.size() == 2) { 442 } else if (args.size() == 2) {
443 return CompareImages( 443 return CompareImages(
444 base::FilePath(args[0]), base::FilePath(args[1]), histograms); 444 base::FilePath(args[0]), base::FilePath(args[1]), histograms);
445 } 445 }
446 446
447 PrintHelp(); 447 PrintHelp();
448 return kStatusError; 448 return kStatusError;
449 } 449 }
OLDNEW
« no previous file with comments | « tools/gn/trace.cc ('k') | ui/base/l10n/l10n_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698