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

Side by Side Diff: samples/image_diff.cc

Issue 1544923002: Start using allowed C++11 features. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 4 years, 12 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 | « core/src/fxge/ge/fx_ge_fontmap.cpp ('k') | third_party/base/nonstd_unique_ptr.h » ('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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 std::vector<unsigned char> compressed; 73 std::vector<unsigned char> compressed;
74 const size_t kBufSize = 1024; 74 const size_t kBufSize = 1024;
75 unsigned char buf[kBufSize]; 75 unsigned char buf[kBufSize];
76 size_t num_read = 0; 76 size_t num_read = 0;
77 while ((num_read = fread(buf, 1, kBufSize, f)) > 0) { 77 while ((num_read = fread(buf, 1, kBufSize, f)) > 0) {
78 compressed.insert(compressed.end(), buf, buf + num_read); 78 compressed.insert(compressed.end(), buf, buf + num_read);
79 } 79 }
80 80
81 fclose(f); 81 fclose(f);
82 82
83 if (!image_diff_png::DecodePNG(&compressed[0], compressed.size(), 83 if (!image_diff_png::DecodePNG(compressed.data(), compressed.size(), &data_,
84 &data_, &w_, &h_)) { 84 &w_, &h_)) {
85 Clear(); 85 Clear();
86 return false; 86 return false;
87 } 87 }
88 return true; 88 return true;
89 } 89 }
90 90
91 void Clear() { 91 void Clear() {
92 w_ = h_ = 0; 92 w_ = h_ = 0;
93 data_.clear(); 93 data_.clear();
94 } 94 }
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 if (!diff_filename.empty()) { 343 if (!diff_filename.empty()) {
344 return DiffImages(filename1, filename2, diff_filename); 344 return DiffImages(filename1, filename2, diff_filename);
345 } 345 }
346 } else if (!filename2.empty()) { 346 } else if (!filename2.empty()) {
347 return CompareImages(filename1, filename2, histograms); 347 return CompareImages(filename1, filename2, histograms);
348 } 348 }
349 349
350 PrintHelp(); 350 PrintHelp();
351 return kStatusError; 351 return kStatusError;
352 } 352 }
OLDNEW
« no previous file with comments | « core/src/fxge/ge/fx_ge_fontmap.cpp ('k') | third_party/base/nonstd_unique_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698