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

Side by Side Diff: tools/skdiff_main.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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/skdiff_image.cpp ('k') | tools/skdiff_utils.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 /* 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 #include "skdiff.h" 7 #include "skdiff.h"
8 #include "skdiff_html.h" 8 #include "skdiff_html.h"
9 #include "skdiff_utils.h" 9 #include "skdiff_utils.h"
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 322
323 /// Comparison routines for qsort, sort by file names. 323 /// Comparison routines for qsort, sort by file names.
324 static int compare_file_name_metrics(SkString **lhs, SkString **rhs) { 324 static int compare_file_name_metrics(SkString **lhs, SkString **rhs) {
325 return strcmp((*lhs)->c_str(), (*rhs)->c_str()); 325 return strcmp((*lhs)->c_str(), (*rhs)->c_str());
326 } 326 }
327 327
328 class AutoReleasePixels { 328 class AutoReleasePixels {
329 public: 329 public:
330 AutoReleasePixels(DiffRecord* drp) 330 AutoReleasePixels(DiffRecord* drp)
331 : fDrp(drp) { 331 : fDrp(drp) {
332 SkASSERT(drp != NULL); 332 SkASSERT(drp != nullptr);
333 } 333 }
334 ~AutoReleasePixels() { 334 ~AutoReleasePixels() {
335 fDrp->fBase.fBitmap.setPixelRef(NULL); 335 fDrp->fBase.fBitmap.setPixelRef(nullptr);
336 fDrp->fComparison.fBitmap.setPixelRef(NULL); 336 fDrp->fComparison.fBitmap.setPixelRef(nullptr);
337 fDrp->fDifference.fBitmap.setPixelRef(NULL); 337 fDrp->fDifference.fBitmap.setPixelRef(nullptr);
338 fDrp->fWhite.fBitmap.setPixelRef(NULL); 338 fDrp->fWhite.fBitmap.setPixelRef(nullptr);
339 } 339 }
340 340
341 private: 341 private:
342 DiffRecord* fDrp; 342 DiffRecord* fDrp;
343 }; 343 };
344 344
345 static void get_bounds(DiffResource& resource, const char* name) { 345 static void get_bounds(DiffResource& resource, const char* name) {
346 if (resource.fBitmap.empty() && !DiffResource::isStatusFailed(resource.fStat us)) { 346 if (resource.fBitmap.empty() && !DiffResource::isStatusFailed(resource.fStat us)) {
347 SkAutoDataUnref fileBits(read_file(resource.fFullPath.c_str())); 347 SkAutoDataUnref fileBits(read_file(resource.fFullPath.c_str()));
348 if (NULL == fileBits) { 348 if (nullptr == fileBits) {
349 SkDebugf("WARNING: couldn't read %s file <%s>\n", name, resource.fFu llPath.c_str()); 349 SkDebugf("WARNING: couldn't read %s file <%s>\n", name, resource.fFu llPath.c_str());
350 resource.fStatus = DiffResource::kCouldNotRead_Status; 350 resource.fStatus = DiffResource::kCouldNotRead_Status;
351 } else { 351 } else {
352 get_bitmap(fileBits, resource, SkImageDecoder::kDecodeBounds_Mode); 352 get_bitmap(fileBits, resource, SkImageDecoder::kDecodeBounds_Mode);
353 } 353 }
354 } 354 }
355 } 355 }
356 356
357 static void get_bounds(DiffRecord& drp) { 357 static void get_bounds(DiffRecord& drp) {
358 get_bounds(drp.fBase, "base"); 358 get_bounds(drp.fBase, "base");
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 drp->fComparison.fStatus = DiffResource::kExists_Status; 470 drp->fComparison.fStatus = DiffResource::kExists_Status;
471 471
472 SkAutoDataUnref baseFileBits(read_file(drp->fBase.fFullPath.c_str()) ); 472 SkAutoDataUnref baseFileBits(read_file(drp->fBase.fFullPath.c_str()) );
473 if (baseFileBits) { 473 if (baseFileBits) {
474 drp->fBase.fStatus = DiffResource::kRead_Status; 474 drp->fBase.fStatus = DiffResource::kRead_Status;
475 } 475 }
476 SkAutoDataUnref comparisonFileBits(read_file(drp->fComparison.fFullP ath.c_str())); 476 SkAutoDataUnref comparisonFileBits(read_file(drp->fComparison.fFullP ath.c_str()));
477 if (comparisonFileBits) { 477 if (comparisonFileBits) {
478 drp->fComparison.fStatus = DiffResource::kRead_Status; 478 drp->fComparison.fStatus = DiffResource::kRead_Status;
479 } 479 }
480 if (NULL == baseFileBits || NULL == comparisonFileBits) { 480 if (nullptr == baseFileBits || nullptr == comparisonFileBits) {
481 if (NULL == baseFileBits) { 481 if (nullptr == baseFileBits) {
482 drp->fBase.fStatus = DiffResource::kCouldNotRead_Status; 482 drp->fBase.fStatus = DiffResource::kCouldNotRead_Status;
483 VERBOSE_STATUS("READ FAIL", ANSI_COLOR_RED, baseFiles[i]); 483 VERBOSE_STATUS("READ FAIL", ANSI_COLOR_RED, baseFiles[i]);
484 } 484 }
485 if (NULL == comparisonFileBits) { 485 if (nullptr == comparisonFileBits) {
486 drp->fComparison.fStatus = DiffResource::kCouldNotRead_Statu s; 486 drp->fComparison.fStatus = DiffResource::kCouldNotRead_Statu s;
487 VERBOSE_STATUS("READ FAIL", ANSI_COLOR_RED, comparisonFiles[ j]); 487 VERBOSE_STATUS("READ FAIL", ANSI_COLOR_RED, comparisonFiles[ j]);
488 } 488 }
489 drp->fResult = DiffRecord::kCouldNotCompare_Result; 489 drp->fResult = DiffRecord::kCouldNotCompare_Result;
490 490
491 } else if (are_buffers_equal(baseFileBits, comparisonFileBits)) { 491 } else if (are_buffers_equal(baseFileBits, comparisonFileBits)) {
492 drp->fResult = DiffRecord::kEqualBits_Result; 492 drp->fResult = DiffRecord::kEqualBits_Result;
493 VERBOSE_STATUS("MATCH", ANSI_COLOR_GREEN, baseFiles[i]); 493 VERBOSE_STATUS("MATCH", ANSI_COLOR_GREEN, baseFiles[i]);
494 } else { 494 } else {
495 AutoReleasePixels arp(drp); 495 AutoReleasePixels arp(drp);
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 // range [0...255] are wrapped (mod 256). Do the conversion ourselves, to 851 // range [0...255] are wrapped (mod 256). Do the conversion ourselves, to
852 // make sure that we only return 0 when there were no failures. 852 // make sure that we only return 0 when there were no failures.
853 return (num_failing_results > 255) ? 255 : num_failing_results; 853 return (num_failing_results > 255) ? 255 : num_failing_results;
854 } 854 }
855 855
856 #if !defined SK_BUILD_FOR_IOS 856 #if !defined SK_BUILD_FOR_IOS
857 int main(int argc, char * const argv[]) { 857 int main(int argc, char * const argv[]) {
858 return tool_main(argc, (char**) argv); 858 return tool_main(argc, (char**) argv);
859 } 859 }
860 #endif 860 #endif
OLDNEW
« no previous file with comments | « tools/skdiff_image.cpp ('k') | tools/skdiff_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698